Create Delphi code that will parse a file with the specified BNF format

Is there a parser code or parser component for Delphi or a program that will accept BNF (Backus-Naur Form) notation as input and output Delphi (or pascal) code for parsing?

The reason for this is that I am going to completely disassemble the data sets, following the different versions of the GEDCOM standard (used for genealogy), and they will need to process the file from state to state upon reaching the tokens. I would prefer an automatic program to do the hard work of setting up the base pascal code to make a state to handle the state for me.

Otherwise, I will have to manually build state structures myself.

I saw the following question (and TinyPG looks good, but I need Delphi code): Parser-generator that outputs C # using BNF grammar?

If there is no such beast, are there other available tools to facilitate this task?

+8
parsing delphi code-generation bnf gedcom
source share
1 answer

I recommend you a GOLD analysis system. GOLD grammars are based on Backus-Naur form and regular expressions.

Resources

Engines

Engines for Delphi are especially listed here .

This one for Rob van den Brink's Object Pascal might be of interest.

Quote:

Rob van den Brink has updated his engine for programming the Object Pascal Language. In its implementation, a program template is used to create a fully functional program. This approach includes parsing tables directly in the source code. As a result, you do not need to download the compiled grammar table file. The download contains a program template as well as several examples.

Sample project using GOLD

GOLD is powerful, it is used as a parsing mechanism for dcu2pas , the Delphi Compiled Unit (dcu files) decompiler, which is located here (bitbucket.org). Note that this is written in d .

+6
source share

All Articles