Anyone interested in a Spirit for D?

Pragma ericanderton at yahoo.removeme.com
Wed Oct 18 12:34:31 PDT 2006


Walter Bright wrote:
> Along the lines of Don's regexp template metaprograms, is anyone 
> interested in a Spirit-like parser generator capability in D?
> 
> http://spirit.sourceforge.net/
> 
> Apparently, someone has gotten Spirit to work with C#:
> 
> http://www.codeproject.com/useritems/spart.asp

Now there's an idea!

Words of caution to follow:

FWIW, I looked into doing this years ago, and didn't get to far.  The 
biggest hurdle, aside from the limitations of templates at the time, was 
a lack of unary operators to override.  In particular, not being able to 
override unary '*' and '!' caused some cosmetic problems.

The only other major hangup I had was not having IFTI so I could 
instantiate templates transparently.  This feature alone could close the 
gap on most of Spirit's useage of C++ templates.  At a minimum, it means 
that a D programmer could get very close to the cosmetic appeal of 
Spirit (operator problems aside).

Don't get me wrong: I'm not a nay-sayer here.  I think this is very 
doable and worthwhile suggestion by Walter.  Folks should take it 
seriously. But it will require some design compromises and changes from 
the original - IMO, it'll probably require more of a re-write than a port.

-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list