Overlapping functionality: IFTI, templates, is-expressions

BCS ao at pathlink.com
Wed Mar 19 18:14:43 PDT 2008


Reply to Russell,

> I don't really have logical reasoning here, so take what I'm about to
> say as "the story of what Russ did" instead of "substantive criticism
> of any details":
> 
> The thing that I stumbled on was that, if I understood you correctly,
> your project is a port of the dmd front-end.  What I'm looking for is
> a parser for the D language which is explicitly not tied to dmd.

Um. OK that understanding would make a big difference. 

What I have is a general parser generator. I also have a (non-functional) 
D grammar for it.

>  Not
> because dmd is bad (I use it all the time), but because I think that,
> for the health of the community, I think we really need more than one
> compiler.

that's why I'm writing it.

> 
> The other thing I'm doing is that I'm experimenting with my new parser
> architecture (infill delegates instead of building parse trees in the
> first pass), so I don't expect that other parser libraries are likely
> to be places to play with that.  I posted a description of this parser
> architecture in one of my (very few) posts to digitalmars.D.learn
> 

You /might/ be able to use what I have to build that. You would need to embed 
the delegate generation/passing stuff in the action though.

> BTW, my current (95% working, just had some corner cases that wouldn't
> auto-detect the right specialized templates) parser library uses
> syntax like this:
> 
> or!(':',
> Parse_block,  /* parses a nonterminal */
> chain!("import", array!(IDENT, ','), ';'),
> ... many other alternativess ...)
> (delegate void(... auto-generated arg types ...)
> {
> ... process successful parse here ...
> });

Errk!! Ow, Ow, ow. To much extra syntax! (for my taste) Mine works off a 
single string:

|mixin(MakeMixin!("root",ReduceWhite("
|	next :
|		bar / baz |
|		pig / owl * horse owl ;
|	root : 
|		beer / next baz |
|		pig  / baz horse owl |
|		keg  / cat horse+ owl? baz |
|		pig  / cat* cat cat |
|		beer / twin * car;
|	twin :
|		beer / king qween* ;
|	car :
|		keg / king qween qween king;")));


that, in the right place, with a few more template defined, make a parser.





More information about the Digitalmars-d mailing list