public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Gary Funck" <gary@Intrepid.Com>
To: <gcc@gcc.gnu.org>
Subject: RE: C++ lexer (GCC 3.1.1) requires knowledge of other C dialects
Date: Fri, 02 Aug 2002 07:41:00 -0000	[thread overview]
Message-ID: <OPEMKGFHJACLLMMADFLKOEOHCMAA.gary@intrepid.com> (raw)
In-Reply-To: <200208012142.OAA10973@atrus.synopsys.com>



> -----Original Message-----
> From: Joe Buck [mailto:Joe.Buck@synopsys.com]
> Sent: Thursday, August 01, 2002 2:42 PM
> To: Gary Funck
> Cc: gcc@gcc.gnu.org
> Subject: Re: C++ lexer (GCC 3.1.1) requires knowledge of other C
> dialects
>
>
>
> > Although this is a bit of philosophical debate (regarding the merits of
> > handbuilt vs. program-generated parsers), I'll point out that the ANTLR
> > parser generator (http://www.antlr.org) generates LL(k)
> recursive descent
> > parsers with additional features which include: [ many features ]
>
> However, the ANTLR FAQ explains that you can't write a C++ parser in ANTLR
> because of the complexities of the language.  They recommend hand-written.
>
> See http://www.jguru.com/faq/view.jsp?EID=531848
>

Yes, though further down that same page, they mention the following:
"I should mention that John Lilley produced a fairly decent C++ parser for
ANTLR's predecessor, PCCTS, but it required a modification to PCCTS and is
not compatible with latest ANTLR."

PCCTS is described here:
http://www.antlr.org/pccts133.html
which in turn refers to this implementation of a C++ grammar:
http://www.empathy.com/pccts/
and
http://www.empathy.com/pccts/download.html
and this interesting resource page
http://www.empathy.com/pccts/roskind.html
which contains Jim Roskind's implementation of a C++ parser written for an
LALR parser generator (yacc/bison), along with an analysis of the
difficulties encountered.

While we're on the topic, there is this a backtracking implementation of
yacc, known as btyacc, which according to the authors has been used to build
a C++ parser:
http://www.siber.org/btyacc/

It turns out that ANTLR might not be suitable for building a parser for GCC
because ANTLR is written in Java, and neither ANTLR nor PCCTS are GPL'd
(though they are explicitly public domain with a BSD-like copyright notice).
I wasn't trying to imply that these would be the tool of choice, but simply
noting that these automatic parser generators meet many of the technical
objections mentioned by advocates of handbuilt recursive descent parsers. In
the sense that bison is a GPL'd implementation of YACC, there would nothing
to prevent re-implemtnating (and extending) any of the tools mentioned above
in a form suitable for inclusion into GCC.




  reply	other threads:[~2002-08-02 14:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-01  3:21 Robert Dewar
2002-08-01 11:59 ` Gary Funck
2002-08-01 14:42   ` Joe Buck
2002-08-02  7:41     ` Gary Funck [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-08-02 11:19 Robert Dewar
2002-08-02  7:53 Robert Dewar
2002-08-02  9:16 ` Gary Funck
2002-07-31  8:10 Gary Funck
2002-07-31 20:30 ` Neil Booth
2002-07-31 21:58   ` Gary Funck
2002-07-31 22:32     ` Neil Booth
2002-07-31 23:03     ` Stan Shebs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OPEMKGFHJACLLMMADFLKOEOHCMAA.gary@intrepid.com \
    --to=gary@intrepid.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).