Re: Compiler Books? Parsers? (Henry Spencer)
2 Nov 2003 14:46:21 -0500

          From comp.compilers

Related articles
Compiler Books? (2003-10-27)
Re: Compiler Books? (2003-10-31)
Re: Compiler Books? Parsers? (2003-11-01)
Re: Compiler Books? Parsers? (2003-11-01)
Re: Compiler Books? Parsers? (2003-11-02)
Re: Compiler Books? Parsers? (2003-11-08)
Re: Compiler Books? Parsers? (Jeff Kenton) (2003-11-21)
Re: Compiler Books? Parsers? (Chris F Clark) (2003-12-03)
Re: Compiler Books? Parsers? (Rodney M. Bates) (2003-12-08)
Re: Compiler Books? Parsers? (Nick Roberts) (2003-12-08)
Re: Compiler Books? Parsers? (Marco van de Voort) (2003-12-20)
[7 later articles]
| List of all articles for this month |

From: (Henry Spencer)
Newsgroups: comp.compilers
Date: 2 Nov 2003 14:46:21 -0500
Organization: SP Systems, Toronto, Canada
References: 03-10-113 03-10-145 03-11-010
Keywords: C, parse, tools
Posted-Date: 02 Nov 2003 14:46:21 EST

Mohd Hanafiah Abdullah <> wrote:
>I have never used parser generators such as yacc/bison or antlr.
>Would be nice to know people's opinion on manual implementation vs
>automation of parsers, especially from those who have done both...

My opinion:

Automation wins for readability (less clutter obscuring the syntax),
efficiency (table walking is often faster than procedure calling), and
above all, ease of experimentation (particularly because bottom-up
parsing, which is more powerful and imposes fewer constraints, lends
itself to automation but not to hand-crafting).

Manual implementation wins for ease of semantics integration (easy to
interweave with the syntax, and top-down means more context is known),
ease of adding kludges to get around difficult spots, ease of
producing good error messages (again, better knowledge of context),
and avoiding dependence on major tools that may not be available

(One caveat: as I've hinted at, people often assume that hand-crafted
means top-down and automated means bottom-up, and that confuses the issues
some. Automated top-down also exists.)
MOST launched 30 June; first light, 29 July; 5arcsec | Henry Spencer
pointing, 10 Sept; first science, early Oct; all well. |
[Automation also wins for accuracy. You can be quite confident that
the parser that yacc or another generator writes for you parses
exactly the grammar you gave it, but it's very easy to leave
undiagnosed holes in a hand-written RD parser. -John]

Post a followup to this message

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