简体   繁体   English

Delphi的解析器生成器?

[英]Parser generator for Delphi?

Can anyone recommend a parser generator that will produce win32 Delphi code? 任何人都可以推荐一个生成win32 Delphi代码的解析器生成器吗? What I'm trying to do is create a simple Domain-Specific Language. 我要做的是创建一个简单的领域特定语言。

The Delphi versions of Coco/R are quite ok: Delphi版本的Coco / R非常好用:

http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/ http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/

most notably Pat Terry's one: 最引人注目的是Pat Terry的一个:

http://www.scifac.ru.ac.za/coco/ http://www.scifac.ru.ac.za/coco/

How complex is your DSL? 你的DSL有多复杂?

I created a parser (in Delphi) for the new Delphi RIDL language to support some in-house COM generation tools we use. 我为新的Delphi RIDL语言创建了一个解析器(在Delphi中),以支持我们使用的一些内部COM生成工具。

My approach was to use ANTLR to play around with the syntax rules until I had something that parsed the various test files I had. 我的方法是使用ANTLR来解决语法规则,直到我有一些东西解析了我的各种测试文件。 I then hand-coded a recursive descent parser (based on the Java generated by ANTLR). 然后我手工编写了一个递归下降解析器(基于ANTLR生成的Java)。 I was also using the Castalia Delphi Parser in the project, so I based my lexical analyser on that. 我在项目中也使用了Castalia Delphi Parser,因此我将我的词法分析器基于此。

Recursive descent parsers are actually really simple (but tedious :-) ) to write manually. 递归下降解析器实际上非常简单(但很乏味:-))手动编写。

I have not tried this at all and I just noticed the information while I was reading through the documentation, but FastScript, in their documentation which you can get here , says that you can use their parser to create your own language which you specify in an XML file. 我还没有在所有尝试这样做,我只注意到的信息,而我是通过文档阅读,但FastScript,它们的文档中,你可以在这里说,你可以用自己的解析器来创建要在指定自己的语言XML文件。 This might give you something you can use. 这可能会给你一些你可以使用的东西。

I found Antlr For Delphi 3.1.1 . 我找到了Antlr For Delphi 3.1.1

SharpPlus Antlr For Delphi Target 3.1.1, a language tool that provides a framework for constructing recognizers, interpreters, compilers with Delphi! SharpPlus Antlr For Delphi Target 3.1.1,一种语言工具,提供了使用Delphi构建识别器,解释器和编译器的框架!

It is a commercial product. 它是一种商业产品。 I have no idea what it is like. 我不知道它是什么样的。

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

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