Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parser generator for Delphi?

Can anyone recommend a parser generator that will produce win32 Delphi code? What I'm trying to do is create a simple Domain-Specific Language.

like image 242
dan-gph Avatar asked Dec 06 '22 05:12

dan-gph


2 Answers

How complex is your DSL?

I created a parser (in Delphi) for the new Delphi RIDL language to support some in-house COM generation tools we use.

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. I then hand-coded a recursive descent parser (based on the Java generated by ANTLR). I was also using the Castalia Delphi Parser in the project, so I based my lexical analyser on that.

Recursive descent parsers are actually really simple (but tedious :-) ) to write manually.

like image 159
Alistair Ward Avatar answered Dec 07 '22 17:12

Alistair Ward


The Delphi versions of Coco/R are quite ok:

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

most notably Pat Terry's one:

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

like image 25
Marco van de Voort Avatar answered Dec 07 '22 19:12

Marco van de Voort