Re: Parsing C++ (John Nagle)
18 Nov 1996 00:36:02 -0500

          From comp.compilers

Related articles
Parsing C++ (1996-11-15)
Re: Parsing C++ (Graham Hughes) (1996-11-18)
Re: Parsing C++ (1996-11-18)
Re: Parsing C++ (Jan Gray) (1996-11-19)
Re: Parsing C++ (1996-12-03)
Re: Parsing C++ (David L Moore) (1996-12-07)
Re: Parsing C++ (1996-12-09)
Re: Parsing C++ (1996-12-09)
Re: Parsing C++ (1996-12-10)
[1 later articles]
| List of all articles for this month |

From: (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$>
Keywords: C++, parse (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 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.