Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Cousins of Compiler - Lexical Analysis, Computer Science and IT Engineering

Cousins of Compiler - Lexical Analysis, Computer Science and IT Engineering - Computer Science Engineering (CSE) PDF Download

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:

  • One-pass assemblers go through the source code once and assume that all symbols will be defined before any instruction that references them.
  • Two-pass assemblers create a table with all symbols and their values in the first pass, and then use the table in a second pass to generate code

 Cousins of Compiler - Lexical Analysis, Computer Science and IT Engineering - Computer Science Engineering (CSE)


Linker and Loader

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.

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.

The document Cousins of Compiler - Lexical Analysis, Computer Science and IT Engineering - Computer Science Engineering (CSE) is a part of Computer Science Engineering (CSE) category.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)

Top Courses for Computer Science Engineering (CSE)

FAQs on Cousins of Compiler - Lexical Analysis, Computer Science and IT Engineering - Computer Science Engineering (CSE)

1. What is the purpose of lexical analysis in compilers?
Ans. Lexical analysis is the process of analyzing a sequence of characters and converting it into a sequence of tokens, which can be understood by a compiler. The tokens represent the basic units of meaning in a programming language. The purpose of lexical analysis is to identify the tokens in the input and group them into categories, such as keywords, identifiers, literals, operators, and punctuation symbols.
2. How is lexical analysis performed in a compiler?
Ans. Lexical analysis is performed using a lexical analyzer, also known as a lexer or scanner. The lexer reads the characters from the input and converts them into tokens. It uses regular expressions to match the input against a set of patterns, which define the syntax of the programming language. The lexer then outputs the tokens to the parser, which uses them to generate an abstract syntax tree.
3. What is the role of computer science and IT engineering in compiler design?
Ans. Computer science and IT engineering play a key role in compiler design by providing the theoretical foundation and practical tools needed to implement a compiler. Computer science provides the algorithms and data structures used in lexical analysis, parsing, intermediate code generation, optimization, and code generation. IT engineering provides the software development tools, programming languages, operating systems, and hardware platforms used in compiler implementation.
4. What are some common challenges in compiler design?
Ans. Some common challenges in compiler design include handling complex syntactic and semantic rules, optimizing the generated code for performance and memory usage, handling error and exception handling, supporting multiple programming languages and platforms, and dealing with constantly evolving technologies and standards.
5. How does computer science and IT engineering impact the future of compiler design?
Ans. Computer science and IT engineering will continue to impact the future of compiler design by providing new algorithms, data structures, and software development tools that can help to improve the performance, reliability, and maintainability of compilers. Additionally, advances in artificial intelligence and machine learning may enable compilers to automatically generate optimized code based on user input and feedback.
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

MCQs

,

shortcuts and tricks

,

mock tests for examination

,

ppt

,

video lectures

,

Important questions

,

Exam

,

past year papers

,

Viva Questions

,

Semester Notes

,

practice quizzes

,

Computer Science and IT Engineering - Computer Science Engineering (CSE)

,

Cousins of Compiler - Lexical Analysis

,

Sample Paper

,

Free

,

study material

,

Previous Year Questions with Solutions

,

Computer Science and IT Engineering - Computer Science Engineering (CSE)

,

Cousins of Compiler - Lexical Analysis

,

Computer Science and IT Engineering - Computer Science Engineering (CSE)

,

Summary

,

Extra Questions

,

pdf

,

Cousins of Compiler - Lexical Analysis

,

Objective type Questions

;