Re: building an interpreter for Aho, Ullman and Sethi's appendix example

robert.thorpe@antenova.com
9 Jan 2004 23:44:49 -0500

          From comp.compilers

Related articles
building an interpreter for Aho, Ullman and Sethi's appendix example leena_pattnaik@hotmail.com (Leena Pattnaik) (2003-12-23)
Re: building an interpreter for Aho, Ullman and Sethi's appendix examp franck.pissotte@alussinan.org (Franck Pissotte) (2003-12-27)
Re: building an interpreter for Aho, Ullman and Sethi's appendix examp robert.thorpe@antenova.com (2004-01-09)
| List of all articles for this month |
From: robert.thorpe@antenova.com
Newsgroups: comp.compilers
Date: 9 Jan 2004 23:44:49 -0500
Organization: Compilers Central
References: 03-12-133
Keywords: books, parse
Posted-Date: 09 Jan 2004 23:44:49 EST

Bill <wbs@wschindler.net> 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
things simpler.


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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.