retagged by
1,582 views

1 Answer

Best answer
4 votes
4 votes

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

Related questions

0 votes
0 votes
1 answer
2
goluabhinan asked Sep 16, 2018
1,537 views
Any transcription error can be repaired by(a) insertion alone (b) deletion alone(c) insertion and deletion alone (d) replacement alone