Sections


Main-Menu

header image

CASE: Language Processing System


Language Processing Systems

  • Language processing systems are used to convert programs to machine code.
  • The provision of a helpful compilation system reduces the costs of program development by making program errors easier to find and by producing program listings which include information about program structure as seen by the compiler.
  • The error diagnostic facilities of a compiler are partially dependent on the language being compiled. A Pascal compiler, for example, can detect many more errors than a FORTRAN compiler. Not only are the rules that govern the validity of a program more strict for Pascal than for FORTRAN, but the Pascal programmer must also supply more information to the compiler about the entities to be manipulated by the program. This information allows the compiler to detect forbidden operations on these entities.

As well as providing information to the programmer, a compilation system must also generate efficient machine code. This latter task involves a good deal of program analysis and can be very time consuming. This has the consequence that it is generally uneconomic to carry out this operation for anything apart from completely developed programs.

A software engineering environment, might contain two compatible compilers for each language - a development compiler and an optimizing compiler.

Development compilers should be written to compile code as quickly as possible and to provide the maximum amount of diagnostic information to the programmer. Optimizing compilers, on the other hand, should be tailored to generate efficient machine code without considering compilation speed and diagnostic facilities. Programs are developed using the development system and, when complete, the optimizing system is used to produce the final version of the program for production use.

Within the confines of the language being processed, development compilers should provide as much information as possible about the program being compiled:

  1. The compiler listing of the program should associate a line number with each program line.
  2. When a program syntax or semantic error is discovered, the compiler should indicate where it found the error and what the error appears to be. It may also be appropriate to indicate the possible cause of the error.
  3. The compiler should include directives which allow the programmer some control over the program listing generated by the compiler. These directives should allow the suppression of parts of the listing, control over the pagination of the listing, and the enhancement of program keywords by bold printing or underlining.
  4. When a program in a block-structured language is compiled, the compiler should indicate the lexical level at the beginning and the end of each block. This allows misplaced begin/end brackets to be easily identified.
  5. The compiler should separate source text provided by the user from information provided by the compiler. This can be accomplished by delimiting the input source using special characters such as ‘|’, and prefacing compiler messages by some string of special characters such as ‘%%’.
  6. The compiler should identify where each procedure in a program starts and finishes. When a program listing is searched for a particular procedure, the location of that procedure is often not immediately obvious because the name of the procedure is not distinguished from the remainder of the source text. When compiling a procedure heading, the procedure name should be abstracted and, as well as listing the procedure heading normally, the procedure name should be reprinted so that it stands out from the rest of the program text.

These facilities were supported in the XPL compiler ([McKeeman 1970]), which was part of a compiler construction system. It is unfortunate that many of the display facilities provided by XPL have not been taken up by later compilers.

If an environment supports both development and optimizing compilers, there is no need for the optimizing compiler to provide comprehensive diagnostic facilities. Rather, given that code optimization is a time-consuming business, the compiler may allow the user to specify the degree of optimization to be carried out by the compiler or whether time or space considerations are most important. Ada has a specific construct called a pragma which, amongst other things, provides some facilities for the user to control compiler optimization.

Separate Compilation

Separate compilation of program units: Units may be compiled separately and subsequently integrated to form a complete program.

The integration process is carried out by another software tool known as a linker or link editor. Without the facility of separate compilation, a programming language should not be considered as a viable language for software engineering.

A large program may consist of several hundred thousand lines of source code and it may take hours or even days to compile the complete program. If every program unit needed to be recompiled each time any one of the units was changed, this would impose significant overhead and increase the costs of program development, debugging and maintenance. If separate compilation is available, compiling the whole system is unnecessary. Only modified units need be recompiled and relinked.

Compiler Support Tools

The compilation process involves an analysis of the support text and, given this analysis, it is possible to provide additional information for the programmer and to lay out the program code, automatically, in a standard way. Commonly, these facilities are embedded in a compilation system. Other analysis tools, called static program analysers, are intended to detect anomalies in the source code.


Related Articles :



Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Shaadi.com Matrimony - Register for FREE