D parsing

Martin Nowak code at dawg.eu
Tue Nov 5 11:05:58 PST 2013


On 11/04/2013 06:52 AM, Philippe Sigaud wrote:
> Do you know what part of the D grammar makes it non-LALR(1)?

At least function and template function declarations are not even LR(1).
You need to look for a second left parenthesis to distinguish both.

It's fairly easy to solve this though.
1. Add a new token r")[ ]*("
2. Add an alternate rule that never matches but forces the parser to 
look behind the closing paren of the function arguments.
...


More information about the Digitalmars-d mailing list