On Mon, Sep 6, 2010 at 11:33 AM, Per Bothner <[email protected]> wrote:

> As an old curmudgeon, I still prefer a hard-written recursive-descent
> parser.  It's simple, efficient, and much easier to debug.

I strongly agree.  Lua, where code compactness is almost everything,
started out with a yacc parser (and hand-written lexer; in those days
lex produced slow and bulky code) because they were still mutating the
language quite a bit.  When the syntax mostly stabilized in Lua 3.0,
they switched to the much smaller recursive descent parser they use
today.

> (For typical arithmetic with infix operators, one uses an operator
> precedence sub-parser.)

I wouldn't even bother, unless you are dealing with a very slow
processor or a language like C with way too many levels of precedence.

> Error recovery is a mixed issue: It is easier and more flexible to add
> recovery in a hand-written parser,

The Lua folks agree.  And you have control over what to do, whereas
typical yacc-likes have at least partly hard-coded recovery
strategies.

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to