DocumentCode
2046507
Title
Simple calculator compiler using Lex and YACC
Author
Upadhyaya, Mohit
Author_Institution
Dept. of Comput. Sci. & Engg, Jodhpur Nat. Univ., Jodhpur, India
Volume
6
fYear
2011
fDate
8-10 April 2011
Firstpage
182
Lastpage
187
Abstract
This paper contains the details of how one can develop the simple compiler for procedural lanaguage using Lex (Lexical Analyzer Generator) and YACC (Yet Another Compiler-Compiler). Lex tool helps write programs whose control flow is directed by instances of regular expressions in the input stream. It is well suited for editor-scripts type transformations and for segmenting input in preparation for a parsing routine. Lex tool source is the table of regular expressions and corresponding program fragments. The table is translated to a program which reads an input stream, copying it to an output stream and partitioning the input into strings which match the given expressions. On the other hand YACC tool receives input of the user grammar. Starting from this grammar it generates the C source code for the parser. YACC invokes Lex to scan the source code and uses the tokens returned by Lex to build a syntax tree. With the help of YACC and Lex tool one can write their own compiler.
Keywords
compiler generators; computational linguistics; high level languages; rewriting systems; source coding; trees (mathematics); Lex tool; YACC; control flow; copying; editor-scripts type transformations; lexical analyzer generator; parsing; procedural lanaguage; simple calculator compiler; source code; syntax tree; user grammar; yet another compiler-compiler; Algorithms; Calculators; Generators; Grammar; Pattern matching; Production; Syntactics; LALR; compiler; lex; optimization; parser; pattern; regular expressions; scanner; yacc;
fLanguage
English
Publisher
ieee
Conference_Titel
Electronics Computer Technology (ICECT), 2011 3rd International Conference on
Conference_Location
Kanyakumari
Print_ISBN
978-1-4244-8678-6
Electronic_ISBN
978-1-4244-8679-3
Type
conf
DOI
10.1109/ICECTECH.2011.5942077
Filename
5942077
Link To Document