CD Module1 18 1 23 PDF
CD Module1 18 1 23 PDF
Introduction
Soumya Majumdar
Text/Reference Books
1. Linear Analysis: This involves a scanning phase where the stream of characters is read from
left to right. It is then grouped into various tokens having a collective meaning.
2. Syntax Analysis: In this analysis phase, based on a collective meaning, the tokens are
categorized hierarchically into nested groups.
3. Semantic Analysis: This phase is used to check whether the components of the source
program are meaningful or not.
Synthesis phase
● Synthesis part constructs the desired target program from the intermediate representation and the
information in the symbol table
Lexical Analysis
● First phase of compiler is also called lexical analysis/scanning
● Lexical analyzer reads stream of characters making up the source program and groups
characters into meaningful sequences called lexeme
● For each lexeme, lexical analyzer produces as output a token of form
(token-name, attribute-value)
● In token, first component token-name is an abstract symbol that is used during syntax analysis,
● Second component attribute-value points to an entry in the symbol table for this token.
● Information from the symbol-table entry 'is needed for semantic analysis and code generation
● suppose a source program contains the assignment statement