syntax definition language

Martin Nowak dawg at dawgfoto.de
Sun Oct 23 10:19:48 PDT 2011


On Sun, 23 Oct 2011 15:10:08 +0200, Gor Gyolchanyan  
<gor.f.gyolchanyan at gmail.com> wrote:

> Anyway, I'm writing a general-purpose parser base, so i won't need it  
> for now.
> And when i do, I'd like to have a correct grammar definition, so i can
> feed it to my parser.
> Who should i ask to ensure it's correctness?
>
> Once I'm done, I'll send a pull request for something around
> "etc.dcfe" for "D compiler front end".
> It won't be perfect, of course, but it will be a start, from which the
> front-end would be gradually developed.
> I wanna at least have an AST parser by the time i make the pull request.
>
> On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr at gmx.ch> wrote:
>> On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
>>>
>>> Yeah, i know about EBNF, but it uses completely different syntax.
>>> I'm really excited about having a standard D compiler front-end as a
>>> library solution, so i though it would be best to parse the syntax
>>> from the syntax definition of dpl.org
>>>
>>
>> That can currently not be done. The syntax specification on dpl.org is  
>> out
>> of date and contains many errors and inaccuracies. (at least it was  
>> that way
>> the last time I checked)
>>

I've written a fast and pretty complete D lexer  
(https://gist.github.com/1262321).

It is based on a generic lexer component which will generate efficient  
matching
functions at compile time (https://gist.github.com/1255439).

I think there are still some compiler bugs to be sorted out so you won't  
be able to compile
it out of the box.

martin


More information about the Digitalmars-d mailing list