retagged by
1,977 views

1 Answer

Best answer
1 1 vote

From source code, lexical analysis produces tokens, the words in a language, which are then parsed to produce a syntax tree, which checks that tokens conform with the rules of a language. Semantic analysis is then performed on the syntax tree to produce an annotated tree. In addition to this, a literal table, which contains information on the strings and constants used in the program, and a symbol table, which stores information on the identifiers occuring in the program (e.g., variable names, constant names, procedure names, etc), are produced by the various stages of the process. An error handler also exists to catch any errors generated by any stages of the program (e.g., a syntax error by a poorly formed line). The syntax tree forms an intermediate representation of the code structure, and has links to the symbol table.

From the annotated tree, intermediate code generation produces intermediate code (e.g., that suitable for a virtual machine, or pseudo-assembler), and then the final code generation stage produces target code whilst also referring to the literal and symbol table and having another error handler. Optimisation is then applied to the target code. The target code could be assembly and then passed to an assembler, or it could be direct to machine code.

We can consider the front-end as a two stage process, lexical analysis and syntactic analysis....

This is what happens in compilation process .If you want to go into more depth and want to learn more about each stage you can google out there are thousands of tutorial on it. But I have written  exactly what you asked.

selected by
Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
1.6k
1.6k views
shekhar chauhan asked Jun 7, 2016
1,627 views
Even though Semantic analysis is one of the important phase of compiler design.But recently i came across a line that said "The compiler does not detect semantic errors, ...
2 2 votes
1 1 answer
1.5k
1.5k views
ankitgupta.1729 asked Nov 12, 2017
1,475 views
Why do we use Three Address Code generally in intermediate Code Generation phase of compiler ?
0 0 votes
1 1 answer
1.9k
1.9k views
goluabhinan asked Sep 16, 2018
1,891 views
Any transcription error can be repaired by(a) insertion alone (b) deletion alone(c) insertion and deletion alone (d) replacement alone
0 0 votes
1 answers 1 answer
2.6k
2.6k views
himgta asked Sep 1, 2018
2,618 views
Which of the following is true?A) Symbol table is constructed during the analysis part of compiler i.e., (front endB) Type checking is done during syntax analysis phase...