Re: Parsing C++

nagle@netcom.com (John Nagle)
18 Nov 1996 00:36:02 -0500

          From comp.compilers

Related articles
Parsing C++ manowar@sauropod.engin.umich.edu (1996-11-15)
Re: Parsing C++ graham.hughes@resnet.ucsb.edu (Graham Hughes) (1996-11-18)
Re: Parsing C++ nagle@netcom.com (1996-11-18)
Re: Parsing C++ jsgray@acm.org (Jan Gray) (1996-11-19)
Re: Parsing C++ jlilley@empathy.com (1996-12-03)
Re: Parsing C++ dlmoore@ix.netcom.com (David L Moore) (1996-12-07)
Re: Parsing C++ jlilley@empathy.com (1996-12-09)
Re: Parsing C++ jlilley@empathy.com (1996-12-09)
Re: Parsing C++ fjh@mundook.cs.mu.OZ.AU (1996-12-10)
[1 later articles]
| List of all articles for this month |
From: nagle@netcom.com (John Nagle)
Newsgroups: comp.lang.c++.moderated,comp.compilers
Date: 18 Nov 1996 00:36:02 -0500
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: 96-11-102 <56mgd9$qp0@netlab.cs.rpi.edu>
Keywords: C++, parse

manowar@sauropod.engin.umich.edu (Krisztian Flautner) wrote:
>I have been reading "The Design and Evolution of C++" book, in which
>Stroustrup mentions that there is considerable difficulty parsing
>C++ with a LALR(1) grammar.


            C and C++ are context-dependent, unlike Pascal and Ada. You can't
parse C++ without knowing which names are type names. This has several
implications, all bad:


      - C++ source files can't be parsed in isolation; you have to parse
the include files too, and process all the declarations.
This makes writing simple tools that operate on C++ source
much more difficult, which is why there are so few of them.
      - Forward references have to be declared, unlike Java and FORTRAN.
      - Undefined type names cause compiler parsers to get lost, yielding
large numbers of erronious diagnostics.


John Nagle


            [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
            [ about comp.lang.c++.moderated. First time posters: do this! ]




--


Post a followup to this message

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