Yacc/Lex grammar
101 Uses for a Yacc
A parser generator such as Yacc/lex is how you get the front end of a compiler
out quickly. It takes a description of the language, and gives you a C
program (yes, I know, where is the Pascal generation version) that parses
an input Pascal program and passes this information to the back end, the
intermediate or direct machine code encoder.
Thats the good news. The bad news is that it leaves the major part
of the compiler, the semantics, undone.
However, there are many reasons you might want to use a generated front
end:
-
Cross reference generator
-
Language translator
-
Prettyprinter
Or, you might want to actually build a compiler.
pascal.y Contains the yacc
parser generator specification.
pascal.l Contains the lex scanner
generator specification.
For more information contact: Scott A. Moore samiam@moorecad.com