COUSINS OF COMPILER
1. Preprocessor 2. Assembler 3. Loader and Link-editor
Preprocessor
A preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers.
They may perform the following functions :
1. Macro processing 3. Rational Preprocessors
2. File Inclusion 4. Language extension
1. Macro processing:
A macro is a rule or pattern that specifies how a certain input sequence should be mapped to an output sequence according to a defined procedure. The mapping process that instantiates a macro into a specific output sequence is known as macro expansion.
2. File Inclusion:
Preprocessor includes header files into the program text. When the preprocessor finds an #include directive it replaces it by the entire content of the specified file.
3. Rational Preprocessors:
These processors change older languages with more modern flow-of-control and data-structuring facilities.
4. Language extension :
These processors attempt to add capabilities to the language by what amounts to built-in macros. For example, the language Equel is a database query language embedded in C.
Assembler
Assembler creates object code by translating assembly instruction mnemonics into machine code. There are two types of assemblers:
Linker and Loader
A linker or link editor is a program that takes one or more objects generated by a compiler and combines them into a single executable program. Three tasks of the linker are
1.Searches the program to find library routines used by program, e.g. printf(), math routines.
2. Determines the memory locations that code from each module will occupy and relocates its instructions by adjusting absolute references
3. Resolves references among files.
A loader is the part of an operating system that is responsible for loading programs in memory, one of the essential stages in the process of starting a program.
1. What is the purpose of lexical analysis in compilers? |
2. How is lexical analysis performed in a compiler? |
3. What is the role of computer science and IT engineering in compiler design? |
4. What are some common challenges in compiler design? |
5. How does computer science and IT engineering impact the future of compiler design? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|