Open Access Open Access  Restricted Access Subscription Access

An Approach to Design a Compiler in Context of Lexical Analyzer (Scanner) and Parser Generation (Parser) Followed by Non-optimized Intermediate Code Generation using Compiler Construction Tools

partha ghosh


It is very tedious and lengthy task to write a compiler. To realize the various phases of compilers we can use some specific tools. These tools are called compiler construction tools. Furthermore, we call it as compiler-compiler, compiler-generators, or translator writing system. A mixture of compiler building tools are Scanner generator —it generates lexical analyzers. The patterns specified to these generators are in the type of regular expressions. The LINUX has utility for a scanner generator called LEX. The specification given to the LEX consists of regular expressions for representing various tokens. Parser generators — these produce the syntax analyzer. The specification given to these generators is given in the form of CFG. Typically LINUX has a tool called YACC, which is a parser generator. Syntax-directed translation engines — in this tool the parse tree is scanned fully to generate an intermediate code. The translation is done for each node of the tree.


Tokens, Lexeme, Lex, AST, Yacc

Full Text:



Alfred V. Aho, Ravi Sethi, Jeffery D. Ullman, Compilers- Principles, Techniques, and Tools: Addison-Wesley; 2007.

William A. Barrett, Compiler Design, CmpE 152, FALL Version, San Jose State University; 2005.

G.M6nier, G. Lorette, Lexical Analyzer based on a Self-Organizing Feature Map, IEEE Xplore. 1997. 0-8186-7898-4.

Lex, Yacc, UNIX Programming/UNIX Utilities. 2nd Edn; John R. Levine, Tony Mason and Doug Brown–O’Reilly (Ed.): ISBN 1-56592-000-7.

Jeffrey E.F. Friedl–O’Reilly, Mastering Regular Expressions. 1997, ISBN: 1-56592-257-3.

William M. Waite, Assad Jarrahian, Michele H. Jackson, Amer Diwan, 2006. Design and Implementation of a Modern Compiler Course, ACM 1595930558/06/0006.

K.L.P. Mishra, N.Chandrasekharan, Theory of Computer Science 2007, 3rd Edn., PHI.


  • There are currently no refbacks.