Hand-written rec-descent parser of GCC-4.1 is WRONG!!!
jc-nospam@jr-pizarro.jazztel.es
jc-nospam@jr-pizarro.jazztel.es
Wed Mar 16 07:20:00 GMT 2005
| > It's possible that C++ doesn't require unbounded lookahead
|
| No, it's not.
| In fact, if you'd read the language grammar definition, you'd discover
| you could pretty produce the anti-program with some work.
| That given any k, it produces a C++ program that cannot be parsed with
| an LR(k) parser.
|
| Unless you are going to refute that this is possible (and it has been
| done before, so trying to refute it would just make you look sily), this
| proves that C++ is not an LR(k) language.
Then the final solution with better compilation space-time and valid grammar
is to kill the evil standard C++ and to make a new standard D++ compatible
with LALR(1) or LL(1) languages.
(e.g. as Delphi or Object Pascal but using the C/C++-like style)
Good bye.
More information about the Gcc
mailing list