|Parser question firstname.lastname@example.org (Mike \(News\)) (2008-07-11)|
|Re: Parser question email@example.com (Aeran) (2008-07-13)|
|Re: Parser question firstname.lastname@example.org (Max Hailperin) (2008-07-13)|
|Re: Parser question DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-07-15)|
|Re: Parser question email@example.com (Mikael =?ISO-8859-1?Q?Str=F6m?=) (2008-07-17)|
|Re: Parser question firstname.lastname@example.org (Max Hailperin) (2008-07-19)|
|From:||"Mike \(News\)" <email@example.com>|
|Date:||Fri, 11 Jul 2008 19:21:05 +0800|
|Posted-Date:||12 Jul 2008 23:54:02 EDT|
I blow the dust of my old Dragon book and started to read. I got some
inspiration to make a very simple (read subset of a) C compiler.
The implementation is a predictive parser that construct a syntax tree
holding both expression and statements. As the grammar is recursive,
so is the implementation. However, i wish to find some shortcuts to
rewrite (at least some of) the recursive functions to be
iterative. Are there any well known algorithms of doing this? I could
not find much info on this topic in the dragon book.
For instance the grammar for:
expr -> term moreterms
moreterms -> + term | - term | N5
Is inherently recursive. How would I write iterative code for this using
my tree function makenode_op(operand, left, right)?
An example in pseudo code would be most helpful to get me started.
Thanks in advance!
Return to the
Search the comp.compilers archives again.