An idea for an extensible, Lexer/Parser/Framework for compilers.

BCS ao at pathlink.com
Thu Mar 6 22:03:34 PST 2008


Reply to Ryan,

> BCS Wrote:
> 
>> Ryan Bloomfield wrote:
>> 
>>> The generator could then scan all the classes and generate a grammer
>>> description that could be used to make the lexer and parser.
>>> 
>> with respect to the above, take a look at this:
>> 
>> http://www.dsource.org/projects/scrapple/browser/trunk/dparser/dparse
>> .d
>> 
> Wow, that's some pretty meta-programming. :)  I thought of doing some
> simple meta-program just to see what it looked like compared to c++
> templates.  I did enough c++ template programming, including a psuedo
> if statement, to really get excited about D's stuff.
> 
>> it doesn't do lexing but it is a fully functional parser generator
>> that does it's processing in-language using templates and string
>> precessing. The input is a BNF text string.
>> 
>> It's very limited at this time because it generates huge symbols (it
>> takes 700MB of ram to compile a ~50 rule grammar) but I have some
>> ideas on how to fix much of that and another idea on how to make it
>> easier to build in common actions.
>> 
>> Is that something along the lines of what you are thinking of?
>> 
> I like it, it would definitely simplify the generated Parser.  I'm
> thinking it might be a good idea to make the Parser generator very
> high level(i.e. D-like specific), I haven't tried yet, but maybe there
> is a way to make it work much like a hand-written recursive descent
> parser.  I'm going to use this is part of my research. Thank you!
> 
> Ryan
> 

let me known if you run into problems. Knowing someone will benefit from 
something will help me find time to work on it.





More information about the Digitalmars-d mailing list