Pre-requisites, Course Objectives and outcomes
Pre-requisites: Programming in C or C++, Computer Architecture, Operating System, Theory of Computation
The objective the compiler course is to understand the basic principles of compiler design, its various constituent parts, algorithms and data structures required to be used in the compiler.
Yet, other objective is, to understand relations between computer architecture and how its understanding is useful in design of a compiler.
The other objective is, how to construct efficient algorithms for compilers.
The Lexical analysis phase of compiler is concerned about generating tokens out of the source program, skipping the whitespaces and comments, and to point out the lexical errors.
For achieving its objectives lexical analyzer scans the source code from a buffer, constructs the finite automata from regular expressions, and assembles the source code in the form of tokens.
This phase also creates a symbol table where tokens and their attributes are entered, which used by the remaining phases of the compiler.
The syntax analysis is compiler phase next to lexical analysis. It is concerned about the grammatical structure of the program and its statements.
The syntax analysis, also called Parsing, is hardware independent and its output, which is a Parse-tree for each HLL statement, is used for intermediate code generation for any machine.
Syntax Directed Translation, storage allocation, intermediate code generation, code optimization, code generation
The syntax Directed Translation (SDT) makes use of syntax of the grammar to carry out the translation of statements of the corresponding language. SDT is carried out using L-attributed translations, which covers virtually all translations that can be performed during parsing. There is also a smaller class, called ``S-attributed translation.