From: | "Derek M. Jones" <derek@knosof.co.uk> |
Newsgroups: | comp.compilers |
Date: | 22 Dec 2006 01:09:40 -0500 |
Organization: | ntl Cablemodem News Service |
References: | 06-09-029 06-09-042 06-09-048 06-09-060 06-09-078 06-09-093 06-12-064 06-12-066 06-12-076 06-12-078 |
Keywords: | C, C++, parse |
Posted-Date: | 22 Dec 2006 01:09:40 EST |
George,
> Note that I am in no way championing this style of compiler design,
> and I have never written a C or C++ compiler ... most of my work has
> been in scripting DSLs, Lisp and Pascal derivatives ... but, to date,
> I haven't encountered any language syntax ambiguities that I believed
> could not be resolved after parsing was complete.
If you are willing to accept multiple parse trees for the same
token sequence it is always possible to 'successfully' parse
a language.
I have a parser for C that does not use any symbol table. The most
common ambiguous parse is:
f(i); // function taking one argument, or perhaps
// a declaration of i to have type f with redundant ()
I am currently working on a C++ parser. The main problem with
C++ is that there are a lot more constructs that lead to an
ambiguous parse.
I know of at least one other tool vendor who fully parses C/C++ source
using syntax information only, before building a symbol table.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.