Request for comments: std.d.lexer

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Jan 27 12:55:12 PST 2013


28-Jan-2013 00:45, Philippe Sigaud пишет:
[snip]
>>> AFAICT, one interesting consequence is the ability to have composition
>>> of grammars, which I sure have with Pegged. But maybe it's not related
>>> that much, that's not something I stopped to think about.
>>> In any case, grammar composition is something I've learnt to like quite a
>>> lot.
>>>
>>
>> You can still have composability of grammars. In fact I'd define a couple of
>> a less powerful but better optimized variations if I were you.
>
> Yes, getting an automaton to deal with the regular part would be good.
> But then, there already is std.regex ;)

Reminds me to tweak/refactor/optimize CT-part of it.
[snip]
> What I still can't get an easy answer on is: is the D grammar LR(1),
> LR(0), LALR?
>

I *think* you can shoehorn it into any one of these: LALR(1),  LL(k)+ 
some lookahead, LL(*) a generalization of it, or PEG. As usual you might 
need semantic predicates to iron out some quirks though. We are getting 
OT quick ;)

The hint is that your question is a bit faulty: by calling it "the D 
grammar" do you mean the exact one listed on the website or any 
equivalent that parses the same language (including the ones obtained by 
simple transformations)?

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list