|building an interpreter for Aho, Ullman and Sethi's appendix example firstname.lastname@example.org (Leena Pattnaik) (2003-12-23)|
|Re: building an interpreter for Aho, Ullman and Sethi's appendix examp email@example.com (Franck Pissotte) (2003-12-27)|
|Re: building an interpreter for Aho, Ullman and Sethi's appendix examp firstname.lastname@example.org (2004-01-09)|
|Date:||9 Jan 2004 23:44:49 -0500|
|Posted-Date:||09 Jan 2004 23:44:49 EST|
Bill <email@example.com> wrote:
> In the same book is a discussion of tools for building compilers and
> interpreters. You might want to review lex and yacc. It is pretty
> straight-forward to write the exercise using these tools. I use these
> tools all the time to build not only interpreters but compiler
> front-ends as well.
> I would strongly urge you to get to know these tools. One could argue
> that you could hand code the parser etc. to gain performance, but you
> may sacrifice ease of debugging and code clairity by doing so.
Normally I would agree. But in the case of a Pascal like langauge
recursive descent is extremely easy. It can be treated entirely with
recursive descent. Nic Wirth intend Pascal to be a teaching language,
and the last part of the course was to write a small compiler for a
subset of it.
For an example of a pascal subset treated using recursive decent
search the web for "cfoogol".
Even if Yacc is unnecessary, Lex (or better flex) might probably make
If you intend to learn compiler design it's worth knowing how to use
Yacc and Lex, *and* how to write simple hand coded parsers.
Return to the
Search the comp.compilers archives again.