Monday, September 25, 2006

25th July 06

This was the "INTRODUCTION TO COMPILERS" day. We learnt in a very highly INTERACTIVE session what a compiler was. After a lot of discussion we finally came to a general agreement ..... that, a compiler translates a high level language to a low level language, generally to a machine code. A compiler analyzes the source language based on its rules and synthesizes the target language on its rule set.The analysis part consists of lexical, syntax and semantic analysis.
We learnt that lexical analysis consists of breaking the sentences into a set of tokens. Then the parser creates the PARSE TREE. All tokens should be consumed by the tree and no non terminals are left to be expanded. Semantics checks for the meaning and validity of the sentences.

The synthesis consists of generating an intermediate code and iteratively optimising it and finally converting it to machine code.

1 comment:

Anay said...

Actually, a slight correction. Compiler converts one language to another and it need not be from high level to low level. A good example is the original C++ compiler that converted C++ to C code. Here both are high level languages.