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

Ryan Bloomfield _sir_maniacREMOVE_ME at yahoo.com
Thu Mar 6 14:42:23 PST 2008


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



More information about the Digitalmars-d mailing list