Forward from chip@perlsupport.com concerning [bothner@cygnus.com: Re: [EGCS-PATCHES] C++ parser]
Bradley M. Kuhn
bkuhn@ebb.org
Mon, 9 Aug 1999 08:50:04 -0400
[I hope this appropriate for me to use kragen-discuss as sort of a bkuhn-fw :]
These were some interesting comments made by Per Bothner concerning parsers
(I picked it up on perl6-porters). Interesting comments. After all these
years, primer compiler writers are encouraging hand-written parsers.
Interesting... Kragen, comments?
----- Forwarded message from Chip Salzenberg <chip@perlsupport.com> -----
Date: Wed, 5 May 1999 22:01:41 -0400
From: Chip Salzenberg <chip@perlsupport.com>
To: Perl 6 Porters <perl6-porters@perl.org>
Subject: [bothner@cygnus.com: Re: [EGCS-PATCHES] C++ parser]
X-Mailer: Mutt 0.95.4i
Per Bothner has some interesting comments on parsers.
----- Forwarded message from Per Bothner <bothner@cygnus.com> -----
To: Chip Salzenberg <chip@perlsupport.com>
Cc: Mark Mitchell <mark@codesourcery.com>, nathan@cs.bris.ac.uk,
egcs-patches@egcs.cygnus.com
Subject: Re: [EGCS-PATCHES] C++ PATCH: rethrow from cdtor function try block
Date: Wed, 05 May 1999 14:05:39 -0700
From: Per Bothner <bothner@cygnus.com>
> If not yacc, then ... ?
My hard-learned recommendation: Think twice or more before using
Yacc (or Bison) for non-toy programs. Instead, use a hand-written
recursive-descent parser. Much easier to tweak, to handle exceptions,
to generate good error messages, to debug, to understand what is
going on, to get good performance.
The Chill grammar was re-written from Yacc to recursive-descent,
because it became too painful to fight against Yacc.
The C++ grammar needs to be re-written for the same reason.
We did the Java grammar using Bison, because the Java Language
Specification had resolved out the ambiguities, and included
a full grammar. Unfortunately, it does not include the
inner classes extension. Unfortunately, there are other
complications.
Yacc is very nice when it works. Unfortunately, in practice, it
seldom does.
I looked at ANTRL. It is powerful, but it seems to have a lot of overhead,
both run-time efficiency, and in terms of learning and understanding.
(It is also Java-based, so not appropriate for Gcc.) I see no
major win over recursive-descent, and I do see major downsides.
--Per Bothner
bothner@cygnus.com http://www.cygnus.com/~bothner
----- End forwarded message -----
--
Chip Salzenberg - a.k.a. - <chip@perlsupport.com>
"When do you work?" "Whenever I'm not busy."
----- End forwarded message -----
--
- bkuhn@ebb.org - Bradley M. Kuhn - bkuhn@gnu.org -
http://www.ebb.org/bkuhn
----- End forwarded message -----
--
- bkuhn@ebb.org - Bradley M. Kuhn - bkuhn@gnu.org -
http://www.ebb.org/bkuhn