click below
click below
Normal Size Small Size show me how
1.2
Programs Related to Compilers , Compiler Construction Principles Practice Kennet
| Question | Answer |
|---|---|
| describe other programs that are related to or used together with compilers and often come together with compilers in a complete language development environment | Interpreters |
| key terms | interpreters, assembler, loaders, linkers, preprocessors, editors, structure based, sccs source code control system), rcs (revision control system), breakpoints, macro relocatable, debuggers, profilers, project managers |
| interpreters | a language translator like a compiler |
| how does an interpreter differ from a compiler | it executes the source program immediately rather than generating object code that is executed after translation is complete |
| any programming language can be | either interpreted or compiled |
| when would an interpreter be more useful than a compiler | an interpreter may be preferred to compiler depending on the language in use and the situation under which translation occurs (language BASIC is more usually interpreted than compiled. Functional languages LISP tend to be interpreted) |
| functional languages tend to be | interpreted |
| when are interpreters used | often used in educational and software development situations where programs are likely to be translated and retranslated many times |
| when is a compiler preferred over an interpreter | if speed of execution is a primary consideration |
| why is the speed of execution faster for compilation than using an interpreter | compiled object code is invariably faster than interpreted source code (sometimes by a factor of 10 or more) |
| how are interpreters and compilers related | interpreters share many of their operations with compilers |
| what is the in between of an interpreter and compiler | there can be translators that are hybrids |
| assembler | a translator for the assembly language of a particular computer |
| what is assembly language | a symbolic form of the machine language of the computer and is particularly easy to translate |
| what is a process flow of a compiler using an assembler | sometimes a compiler will generate assembly language as its target language and then rely on an assembler to finish the translation into object code |
| linker | program that compilers and assemblers rely on which collects code separately compiled or assembled in different object files into a file that is directly executable |
| object code distinctions regarding linkers | distinction can be made between object code - machine code that has not yet been linked - and executable machine code |
| tasks of a linker | a linker connects an object program to the code for standard library functions and to resources supplied by the operating system of the computer (memory allocators and input and output devices) |
| linkers perform what compiler historic task | linkers now perform the task that was originally one of the principal activities of a compiler (compile- to construct by collecting from different sources) |
| linking process | topic |
| what is the linking process dependent on | linking process is extremely dependent on the details of the operating system and processor |
| will not make a distinction between unlinked object code and executable code | Note: not relevant to computation techniques |
| Loaders | will resolve all relocatable addresses relative to a given base (starting) address |
| relocatable | such code where - often a compiler/assembler/linker will produce code that is not yet completely fixed and ready to execute but whose principal memory references are all made relative to an undetermined starting location that can be anywhere in memory |
| what does the use of a loader do | the use of a loader makes executable code more flexible |
| when does the loading process occur | often occurs behind the scenes (as part of the operating environment) or in conjunction with linking - rarely is a loader an actual separate program |
| preprocessor | separate program that is called by the compiler before actual translation begins |
| what are some tasks a preprocessor can do | delete comments, include other files and perform macro substitutions |
| macro | shorthand description of a repeated sequence of text |
| how are preprocessors implemented | preprocessors can be required by the language (c) , or can be later add-ons that provide additional facilities (Ratfor preprocessor for FORTRAN) |
| what do compilers accept as input | compilers usually accept source programs written using any editor that will produce a standard file (ASCII file) |
| what have compilers been bundled with | compilers have been bundled together with editors and other programs into an interactive development environment (IDE) |
| what does the editor output when used in an IDE bundle with a compiler | in such a case, an editor while still producing standard files may be orientated toward the format or structure of the programming language in questions |
| structure based | editors that while still producing standard files may be orientated toward the format or structure of the programming language in question |
| what is the benefit of structure based editors | already include some of the operations of a compiler (the programmer can be informed of errors as the program is written rather than when it is compiled) |
| what can structure based editors do | the compiler and its companion programs can also be called from within the editor so that the programmer can execute the program without leaving the editor |
| debugger | program that can be used to determine execution errors in a compiled program |
| what is often packaged with a compiler in an IDE | debugger |
| how does running a program with a debugger differ from straight execution | the debugger keeps track of most or all of the source code information, such as line numbers and names of variables and procedures. |
| breakpoints | debuggers can halt execution at prespecified locations |
| what information can a debugger provide at a breakpoint | provide information on what functions have been called and what the current values of variables are |
| for a debugger to provide information on what functions have been called and what the current values of variables are, what is needed? | the debugger must be supplied with appropriate symbolic information by the compiler |
| what is difficult around using a debugger in compilation | the debugger must be supplied with appropriate symbolic information by the compiler which can sometimes be difficult (especially in a compiler that tries to optimize the object code |
| Profiler | a program that collects statistics on the behavior of an object program during execution |
| what are some typical statistics that may be of interest to a programmer that a profiler can provide | number of times each procedure is called and the percentage of execution time spent in each procedure |
| what are statistics that can help the programmer to improve the execution speed of the program | number of times each procedure is called and the percentage of execution time spent in each procedure |
| what does a compiler do when it uses output from a profiler | sometimes the compiler will even use the output of the profiler to automatically improve the object code without intervention by the programmer |
| describe the programming requirements for a modern approach to large software projects | modern software projects are usually so large that they are undertaken by groups of programmers rather than a single programmer |
| when software projects are so large that they are undertaken by groups of programmers rather than a single programmer what is important to consider | it is important that the files being worked on by different people are coordinated |
| what is the job of the project manager | coordinates the files being worked on by different people |
| what are the primary features of a project manager | coordinate the merging of separate versions of the same file produced by different programmers maintain a history of changes to each of a group of files (so that coherent versions of a program under development can be maintained |
| what is a useful feature for a project manager even with a single programmer project | maintain a history of changes to each of a group of files (so that coherent versions of a program under development can be maintained |
| are project managers language dependent | can be written in a language independent way |
| what are the pros of using a language dependent project manager bundled together with a compiler | can maintain information on the specific compiler and linker operations needed to build a complete executable program |
| project managers for Unix | sccs (source code control system) rcs (revision control system) |