Current D grammar

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 15 22:21:08 PDT 2015


On 15 Jun 2015 02:10, "Manfred Nowak via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> With my favorite LALR-CompilerCompiler I analyzed the current D grammar.
> After preliminary eliminating the RR-conflicts around 1800 states
remained,
> from which around 100 states are still contaminated with SR-conflicts.
>
> Two possibilities:
> 1) Those ambiguities are not in DMD but introduced by excerpting the
> grammar from DMD
> 2) Those ambiguities do exist in DMD.
>
> Which one do you prefer? Is the grammar usable?
>
> -manfred

The most complete grammar I'm aware of is:

https://github.com/Hackerpilot/DGrammar

I've done a basic LALR grammar (expressions only so far) with YACC, but it
depends on a two tier lexer in order to resolve interpolating identifiers
and dots before applying grammar rules.  This I've found is the best way to
get over most SR errors and allow (PostExpression).ident to be accepted,
among others to be accepted correctly.

https://github.com/ibuclaw/gdb/blob/dlang/gdb/d-exp.y

Regards
Iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150616/1158f162/attachment.html>


More information about the Digitalmars-d mailing list