(DOCX, Unknown)

Lexical & Syntax Analysis
1. Lexical Analysis
Lexical analysis is the first phase of a compiler. It takes the modified source code
from language pre-processors that are written in the form of sentences. Each of the
statement will contain some keyword to tell the computer what it is doing.
2. Syntax Analysis
A syntax analyser takes the input from a lexical analyser in the form of token
streams. The syntax analyses the source code against the production rules to detect
any errors in the code.
3. Code Generation
Code generation is the final action of a compiler. It converts source code via the
output of lexical and syntactic analysis into machine code. The result is stored as an
object file.
4. Optimisation
Optimisation means to produce code that is as fast and efficient as possible.
1) In the Lexical Analysis, you identify each word and assign a meaning to it but
in the Syntactic Analysis phase, you verify whether the code follows the language
2) The feature is it is the final action of a compiler.
3) The feature remove any remaining lines that are not necessary.