Re: Parsing techniques
1 Dec 1996 22:52:42 -0500

          From comp.compilers

Related articles
Parsing techniques (1993-05-04)
Re: Parsing techniques (1993-05-07)
Re: Parsing techniques (1993-05-08)
Parsing techniques (Kent Rollins) (1996-11-26)
Re: Parsing techniques (Scott Stanchfield) (1996-12-01)
Re: Parsing techniques (1996-12-01)
Re: Parsing techniques (1996-12-01)
Re: Parsing techniques (1996-12-01)
Re: Parsing techniques (1996-12-03)
Re: Parsing techniques (Ron House) (1996-12-07)
Re: Parsing techniques (1996-12-09)
Re: Parsing techniques (Terence Parr) (1996-12-09)
[2 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
Date: 1 Dec 1996 22:52:42 -0500
Organization: Mauney Computer Consulting
References: 96-11-157
Keywords: parse, C++, LL(1), LALR

Kent Rollins <> writes:

>... Most of the literature I have read seems to imply that
>LL(k) grammars are only for small/simple languages and that LR
>grammars must be used for thicker languages like C++.
>... Can C++ successfully be parsed with an LL(k) grammar? If

Having written both LL and LR parser generators, and both LL and LR
parsers using those and several other tools, let me give my take:

If you're trying to actually get something accomplished, the quality
of the specific tool is more important than the theoretical properties
of the parsing algorithm. You want a generator that automates as much
grunt work as possible, while giving you flexibility at the same time.
There's a lot more to that than just computing state machnes and
follow sets.

Good parser generators go well beyond what the clean theoretical model
implies. The dangling-else construct of C is theoretically impossible
for LL parsers, but LL parser generators typically handle it anyway.
The correct LR grammar for C's if-then-else is a pain in the butt, but
LR generators accept the more convenient form and handle it properly.
I maintain that syntax error handling is far easier in LL, in theory,
but the real question is how well the tool does it, not how well the
published research articles do it. Ugly languages like C++ require so
many compromises that you will quickly forget what the parsing
algorithm is anyway.

If you want to parse C++, you'll get a lot farther starting with PCCTS
than with yacc.
Jon Mauney
Mauney Computer Consulting (919) 828-8053
Raleigh NC

Post a followup to this message

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