首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 62 毫秒
1.
This paper presents a practical method of adding problem-specific notation to an established computer language. Our idea is to use unrestricted operator overloading as a tool to map the problem domain notation directly into an existing programming language. Our method introduces new operator symbols and function names into a host language by overloading existing usage. We extend the host programming language syntax to an augmented language which is mapped to the host language by a programmable preprocessor. The preprocessor uses a programmer-modifiable symbolic language grammar to translate an augmented program into a standard program. This process gives a natural extension to any computer language without modifying the host language. Direct use of problem notation can improve program legibility and code comprehension within the problem domain. The preprocessor provides a useful research tool for exploring language issues without the need to write a compiler for a new language. It can also be used to provide a domain specific language for a programming group at lower cost than new language development. This paper presents several working examples which illustrate our work. We redefine many of the standard C operators to alleviate some of the more common programming errors, thus creating a ‘cleaner’ C. As a more esoteric example, we encode a subset of APL vector operators as an algebraic extension to the C language. A curious application of our method shows its success in an arbitrary problem domain by compiling and executing poetry. Our final example introduces standard symbolic logic notation into C for tautology verification. © 1998 John Wiley & Sons, Ltd.  相似文献   

2.
A good programming language alone is not sufficient for economic software production. The programming environment has a significant influence on the productivity of software engineers. Providing a programmer with information about an object-oriented software system requires extracting information from the source code, e.g. class, method and variable names. We use separate structure files for holding this information and take advantage of proven tools such as make and the C preprocessor for keeping the structure files up to date and for processing software systems that heavily use macros. In this paper we describe the concepts used for comfortable processing of C++ software systems, and discuss interesting design and implementation aspects, including structure files, the applied make mechanism and the exploitation of the C preprocessor.  相似文献   

3.
C++ was originally designed as a sequential programming language. For development of multithreaded applications, libraries, such as Pthreads, Windows threads, and Boost, are traditionally used. The C++11 standard introduced some basic concepts and means for developing parallel and concurrent programs, but the direct use of these low-level means requires high programming skills and significant efforts. The absence of high-level models of parallelism in C++ is somewhat compensated for by various parallel libraries and directive parallelization tools (such as OpenMP), as well as by language extensions supported by some compilers (Intel CilkPlus). Nevertheless, we still require more advanced means to express parallelism in programs at the level of language standard and language library. In this survey, we consider the means for parallel and concurrent programming that are included into the C++17 standard, as well as some capabilities that are to be expected in the future standards.  相似文献   

4.
Software tools can improve the quality and maintainability of software, but are expensive to acquire, deploy, and maintain, especially in large organizations. We explore how to quantify the effects of a software tool once it has been deployed in a development environment. We present an effort-analysis method that derives tool usage statistics and developer actions from a project's change history (version control system) and uses a novel effort estimation algorithm to quantify the effort savings attributable to tool usage. We apply this method to assess the impact of a software tool called VE, a version-sensitive editor used in Bell Labs. VE aids software developers in coping with the rampant use of certain preprocessor directives (similar to #if/#endif in C source files). Our analysis found that developers were approximately 40 percent more productive when using VE than when using standard text editors.  相似文献   

5.
The grammar of the language in which some given code is written is essential for developing automated tools for maintenance, reengineering, and program analysis. Frequently grammar is available for a language but not for its variants that are implemented by various vendors and in which the given code may be written. In this work we address the problem of obtaining the grammar from source code, which can then be used for generating tools for the programs. We propose an incremental method for obtaining grammar for a particular language variant, from a set of programs written in the language variant and an approximate grammar (presumably of the standard language) with some user interaction. We also present the design of a tool for implementing this approach and our experience in working with grammars of C, C++ and COBOL. Copyright © 2004 John Wiley & Sons, Ltd.  相似文献   

6.
Joseph L. Steffen 《Software》1984,14(4):323-334
Debugging tools are usually highly machine and compiler dependent programs that are either impossible to move or require a tremendous effort to move to another machine. This paper describes Ctrace, a portable debugging tool for the C language that provides the same, easy-to-use debugging environment on all machines. A similar debugger can be written for any language. Ctrace is a preprocessor that inserts source language debugging code into the program before compilation that, at execution time, prints the text of each source language statement along with the values of variables it uses and modifies. Redundant trace output from program loops is detected and eliminated. Tracing can be limited to selected statements or functions. Ctrace has shown its usefulness and popularity by its installation on over 200, computers at Bell Laboratories. It has proven its portability by being used to test software on four different operating systems and nine different processors.  相似文献   

7.
Most large software applications rely on an external relational database for storing and managing persistent data. Typically, such applications interact with the database by first constructing strings that represent SQL statements, and then submitting these for execution by the database engine. The fact that these statements are only checked for correctness at runtime is a source for many potential defects, including type and syntax errors and vulnerability to injection attacks.The AraRat system presented here offers a method for dealing with these difficulties by coercing the host C++ compiler to do the necessary checks of the generated strings. A library of templates and preprocessor directives is used to embed in C++ a little language representing an augmented relational algebra formalism. Type checking of this embedded language, carried out by our template library, assures, at compile-time, the correctness and safety of the generated SQL strings. All SQL statements constructed by AraRat are guaranteed to be syntactically correct, and type safe with respect to the database schema. Moreover, AraRat statically ensures that the generated statements are immune to all injection attacks.The standard techniques of “expression templates” and “compile-time symbolic derivation” for compile-time representation of symbolic structures, are enhanced in our system. We demonstrate the support of a type system and a symbol table lookup of the symbolic structure. A key observation of this work is that type equivalence of instantiated nominally typed generics in C++ (as well as other languages, e.g., Java) is structural rather than nominal. This makes it possible to embed the structural type system, characteristic to persistent data management, in the nominal type system of C++.For some of its advanced features, AraRat relies on two small extensions to the standard C++ language: the typeof pseudo operator and the __COUNTER__ preprocessor macro.  相似文献   

8.
Due to increasing demands in processing power on the one hand, but the physical limit on CPU clock speed on the other hand, multi-threaded programming is becoming more important in current applications. Unfortunately, multi-threaded programs are prone to programming mistakes that result in hard to find defects, mainly race-conditions and deadlocks. The need for tools that help finding these faults is immanent, but currently available tools are either difficult to use because of the need for annotations, unable to cope with more than a few 10 kLOC, or issue too many false warnings. This paper describes experiments with the freely available tool Helgrind and results obtained by using it for debugging a server application comprising 500 kLOC. We present improvements to the runtime analysis of C++ programs that result in a dramatic reduction of false warnings.  相似文献   

9.
10.
11.
This paper deals with design considerations and implementation of a program structuring preprocessor for a macro assembly language. The macro assembly language is used for writing the code generation pass of a compiler. Macro instructions become lengthy, tedious and cumbersome when they incorporate some mild code improvement. This is chiefly because the macro assembly language lacks an adequate program structuring facility. Program structuring is a great help in improving ease of programming and the under-standability of the expansion control statements of a macro instruction in such a kind of programming. Considerations on the design of the source language and the outline of implementation are described. The design objective is ease of implementation and ease of use, and is fairly well satisfied by the language.  相似文献   

12.
安全协议的人工实现是一个低效且易错的过程.安全协议编译器Hlpsl2Cpp可以自动从用HLPSL语言描述的安全协议生成C 的协议实现代码.Hlpsl2Cpp节省了人工实现协议的大量重复劳动,避免了人工实现安全协议带来的各种讹误和实现相关漏洞.  相似文献   

13.
Do background colors improve program comprehension in the #ifdef hell?   总被引:1,自引:1,他引:0  
Software-product-line engineering aims at the development of variable and reusable software systems. In practice, software product lines are often implemented with preprocessors. Preprocessor directives are easy to use, and many mature tools are available for practitioners. However, preprocessor directives have been heavily criticized in academia and even referred to as “#ifdef hell”, because they introduce threats to program comprehension and correctness. There are many voices that suggest to use other implementation techniques instead, but these voices ignore the fact that a transition from preprocessors to other languages and tools is tedious, erroneous, and expensive in practice. Instead, we and others propose to increase the readability of preprocessor directives by using background colors to highlight source code annotated with ifdef directives. In three controlled experiments with over 70 subjects in total, we evaluate whether and how background colors improve program comprehension in preprocessor-based implementations. Our results demonstrate that background colors have the potential to improve program comprehension, independently of size and programming language of the underlying product. Additionally, we found that subjects generally favor background colors. We integrate these and other findings in a tool called FeatureCommander, which facilitates program comprehension in practice and which can serve as a basis for further research.  相似文献   

14.
P. A. Lee 《Software》1983,13(5):389-405
This paper describes a software package which has been constructed to allow programs written in the C language to make use of exception handling facilities. The package is implemented as a set of macros and procedures and requires no modification to the C compiler or preprocessor. The operation of the package and its facilities are described, and practical experience of its use is presented. The code in the package is given in the appendix.  相似文献   

15.
Program understanding is an essential part of all software maintenance and enhancement activities. As currently practiced, program understanding consists mainly of code reading. The few automated understanding tools that are actually used in industry provide helpful but relatively shallow information, such as the line numbers on which variable names occur or the calling structure possible among system components. These tools rely on analyses driven by the nature of the programming language used. As such, they are adequate to answer questions concerning implementation details, so called what questions. They are severely limited, however, when trying to relate a system to its purpose or requirements, the why questions. Application programs solve real‐world problems. The part of the world with which a particular application is concerned is that application's domain. A model of an application's domain can serve as a supplement to programming‐language‐based analysis methods and tools. A domain model carries knowledge of domain boundaries, terminology, and possible architectures. This knowledge can help an analyst set expectations for program content. Moreover, a domain model can provide information on how domain concepts are related. This article discusses the role of domain knowledge in program understanding. It presents a method by which domain models, together with the results of programming‐language‐based analyses, can be used to answers both what and why questions. Representing the results of domain‐based program understanding is also important, and a variety of representation techniques are discussed. Although domain‐based understanding can be performed manually, automated tool support can guide discovery, reduce effort, improve consistency, and provide a repository of knowledge useful for downstream activities such as documentation, reengineering, and reuse. A tools framework for domain‐based program understanding, a dowser, is presented in which a variety of tools work together to make use of domain information to facilitate understanding. Experience with domain‐based program understanding methods and tools is presented in the form of a collection of case studies. After the case studies are described, our work on domain‐based program understanding is compared with that of other researchers working in this area. The paper concludes with a discussion of the issues raised by domain‐based understanding and directions for future work.  相似文献   

16.
TIM COOPER  MICHAEL WISE 《Software》1997,27(5):497-517
Traditional programming environments represent program source code as a set of source files. These files have various ‘dependencies’ on each other, such that a file needs recompilation if it depends on a file which has changed. A ‘build tool’ is used to process these dependencies and bring the application ‘up-to-date’. An example of a build tool is the UNIX ‘make’. This paper examines what happens when the dependencies used by the build tool are expressed between functions (or objects) rather than between files. Qualitative differences arise from the difference in granularity. The result is an effective incremental compilation programming environment, based on the C++ language. It is called ‘Barbados’, and is fully implemented. The environment resembles an interpreter in that changes to source code appear to be immediately reflected in all object code, except that errors are reported early as in compiled systems. Incremental compilation is not a well-used technology, possibly because the ‘fine-grain build’ problem is not well understood. Nevertheless, incremental compilation systems do exist. The advantages of the system described here are that it works with relatively standard compilation technology, it works for the C++ language including the preprocessor, it is an elegant solution and it is more efficient than competing algorithms. © 1997 by John Wiley & Sons, Ltd.  相似文献   

17.
18.
徐晨  蒋华  袁红林 《计算机工程与应用》2006,42(17):111-113,122
文章讨论了一种增强Verilog硬件描述语言建模能力的编译预处理器的设计问题。VerilogHDL是专用集成电路设计中应用广泛的一种硬件描述语言,它尚存在一些缺陷。编译预处理器的功能是增强数字系统设计中对模块输入输出端口阵列等参数化设计的能力。在分析IEEEVerilog1364—2001建模特性的基础上,基于LEX和YACC设计出专门的编译预处理器,显著降低了程序规模,可以方便地嵌入其他仿真或综合工具中,增强了VerilogHDL参数化的建模特性。  相似文献   

19.
A style of programming that uses higher-order functions has become common in C++, following the introduction of the Standard Template Library (STL) into the standard library. In addition to their utility as arguments to STL algorithms, function parameters are useful as callbacks on GUI events, defining tasks to be executed in a thread, and so forth. C++’s mechanisms for defining functions or function objects are, however, rather verbose, and they often force the function’s definition to be placed far from its use. As a result, C++ frustrates programmers in taking full advantage of its own standard libraries. The effective use of modern C++ libraries calls for a concise mechanism for defining small one-off functions in the language, a need that can be fulfilled with lambda expressions.This paper describes a design and implementation of language support for lambda expressions in C++. C++’s compilation model, where activation records are maintained in a stack, and the lack of automatic object lifetime management make safe lambda functions and closures challenging: if a closure outlives its scope of definition, references stored in a closure dangle. Our design is careful to balance between conciseness of syntax and explicit annotations to guarantee safety. The presented design is included in the draft specification of the forthcoming major revision of the ISO C++ standard, dubbed C++0x. In rewriting typical C++ programs to take advantage of lambda functions, we observed clear benefits, such as reduced code size and improved clarity.  相似文献   

20.
R. J. Munn  J. M. Stewart 《Software》1980,10(9):743-749
In preparing a revision of XRAY, a large scientific crystallographic software package, it was decided to use a structured language as the primary coding language. RATFOR was chosen as the most appropriate preprocessor. Initial implementation experience showed that while RATFOR improved the quality of the coding it did little to ease the problems of portability. By augmenting RATFOR with a powerful macro processor, a versatile tool for generating portable scientific software was developed. The resulting preprocessor, RATMAC, is portable and can be optimized, via macros, to a local operating environment. Its characteristics, strengths and weaknesses are described.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号