生成将解析具有给定 BNF 格式的文件的 Delphi 代码
是否有用于 Delphi 的解析器代码或解析器组件或接受 BNF(巴科斯范式)表示法作为输入并生成 Delphi(或 pascal)代码来进行解析的程序?
这样做的原因是我将尝试完美解析以下各种版本的数据集 GEDCOM 标准(用于谱系),并且需要在达到令牌时处理不同状态的文件。我更喜欢一个自动化程序来完成设置基本 pascal 代码的繁重工作,为我进行状态到状态处理。
否则,我将不得不自己手动构建状态结构。
我确实看到了以下问题(以及 TinyPG 看起来不错,但我需要 Delphi 代码): 在给定 BNF 语法的情况下输出 C# 的解析器生成器?< /a>
如果没有这样的野兽,是否有其他可用的工具可以使这项任务变得更容易?
Is there parser code or a parser component for Delphi or a program that will accept BNF (Backus-Naur Form) notation as input and produce Delphi (or pascal) code to do the parsing?
The reason for this is that I am going to be attempting to perfectly parse data sets following various versions of the GEDCOM standard (used for genealogy), and will need to process the file from state to state as tokens are reached. I would prefer an automated program to do the grunt work of setting up the basic pascal code to do the state to state processing for me.
Otherwise, I'll have to manually build the state structures myself.
I did see the following question (and TinyPG looks good, but I need Delphi code):
Parser-generator that outputs C# given a BNF grammar?
If there isn't such a beast, are there any other tools available that will make this task easier?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我向您推荐 GOLD 解析系统。 GOLD 语法基于 Backus-Naur 形式和正则表达式。
资源
引擎
特别列出了 Delphi 引擎此处。
这是 Rob van 为 Object Pascal 设计的 den Brink 可能会感兴趣。
引用:
使用GOLD的示例项目
GOLD功能强大,它用作dcu2pas的解析引擎,一个 Delphi 编译单元(dcu 文件)反编译器,托管于 此处 (bitbucket.org)。请注意,它是用 d 编写的。
I recommend you the GOLD parsing system. GOLD grammars are based on Backus-Naur form and regular expressions.
Resources
Engines
Engines for Delphi are particularly listed here.
This one for Object Pascal by Rob van den Brink might be of interest.
Quote:
Sample project using GOLD
GOLD is powerfull, it is used as the parsing engine of dcu2pas, a Delphi Compiled Unit (dcu files) decompiler which is hosted here (bitbucket.org). Notice instead that it's written in d.