On 14/10/2010 23:47, Andrej Mitrovic wrote:
Hey,
I've been looking for a D2 parser.. there seems to be a few D1 lexers, parsers,
and even some minimal semantic analysis tools but I can't find much of anything
for D2. Perhaps Goldie will be D2 compatible some day soon. :)
There's a "CodeAnalyzer" lexer/parser with some minimal semantics, but it's D1
only and kind of dead for some years. The Poseidon author added some D2 support for it in
his editor, so I have kept an eye on that. But interfacing with D1 code from D2 is kind
of complicated, and I need to use it from D2. (I guess I could get away with writing a
DLL with a simple interface for D2 or something..).
I had a visit on the prowiki site and most of the parser projects there are
either D1-only or dead. So is there anything usable for D2? Specifically I need
these tools for use with an editor/IDE, which is something I'm working on for
fun atm. But working on a parser is probably a ton of work, + the whole thing
screams NIH to me. Luckily enough I don't have to reinvent a GUI and an editing
control, there's DFL and Scintilla which are pretty awesome for my needs.
Maybe I should take a look at how Descent/DDT and VisualD do their parsing.. :)
If you just need a d2 parser library, then my port of boost::spirit
might fill you need:
http://www.sstk.co.uk/spiritd.php
(I pretty sure the bug that stopped it working got fixed in the last
release, but I've not tested it yet.)
Though spirit generates LL parsers which aren't really suited for
parsing human generated input; as getting accurate error location
reporting is tricky, but it's handy for small inline parsers and other
simple grammars.
If you are after a d2 parser written in d2, then I dunno.
You could write that using spirit in theory but it would be a job and a
half.
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk