gppg/gplex equivalent in D?

When I was working in C#, I found the gppg and gplex parser/lexer generators to be perfect for my needs. I'm wondering if there's something similar for the D programming language (ie a utility that, given a grammar in BNF or EBNF, outputs D code that lexes/parses that language into a abstract syntax tree).

The closest I've found is Goldie, but I'm having so much trouble understanding it that I'm not able to get anything up and running.


I have found Goldie pretty awesome for context-insensitive grammars, are you sure about it? Also, http://www.wikiservice.at/d/wiki.cgi?GrammarParsers lists some, no idea which are still developed. If ANTLR-D still works, it is probably on of the best choices.


Goldie is probably your best bet, but there's also ragel which can emit D. It's not exactly what you asked for (composable state machines) though it might suffice for many cases and it's really nice.

Trunk version can compile to D2 code with the undocumented -E switch, I'm not sure yet how mature that is.

http://www.complang.org/ragel/

链接地址: http://www.djcxy.com/p/63202.html

上一篇: 词法分析器和分析器之间的通信

下一篇: D中的gppg / gplex等价物?