简体   繁体   English

(E)BNF解析为XML

[英](E)BNF Parsing to XML

Is there any (E)BNF parser out there which is able to generate XML trees of the AST? 是否有(E)BNF解析器能够生成AST的XML树?

Rephrasing: what is the quickest way to compile an (E)BNF defined language into some sort of XML? 改写:将(E)BNF定义的语言编译成某种XML的最快方法是什么?

Bonus: Using Javascript :-) 奖励:使用Javascript :-)

It seems my best bet so far is to use AntLR and the StringTemplate Interface. 到目前为止,似乎最好的选择是使用AntLR和StringTemplate接口。 It also supports a JavaScript target . 它还支持JavaScript目标

Not free, but generates XML: DMS Software Reengineering Toolkit . 它不是免费的,但是会生成XML: DMS软件再造工具包 Available with a variety of predefined langauge defintions (C, C++, C#, Java, COBOL, Javascript, XML, ...). 提供各种预定义的语言定义(C,C ++,C#,Java,COBOL,Javascript,XML等)。

The question is, what will you do with that? 问题是,您将如何处理? If you are processing some langauge seriously, you need much more than just the AST (almost always you need a symbol table). 如果您正在认真处理某些语言,则不仅需要AST(几乎总是需要一个符号表),而且还需要更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM