Delphi parser from TextTransformer grammar

Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Sun, 23 Aug 2009 15:13:08 +0200

          From comp.compilers

Related articles
Delphi parser from TextTransformer grammar Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2009-08-23)
Re: Delphi parser from TextTransformer grammar marcov@stack.nl (Marco van de Voort) (2009-08-27)
Re: Delphi parser from TextTransformer grammar Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2009-09-01)
Re: Delphi parser from TextTransformer grammar marcov@stack.nl (Marco van de Voort) (2009-09-07)
| List of all articles for this month |

From: Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Newsgroups: comp.compilers
Date: Sun, 23 Aug 2009 15:13:08 +0200
Organization: Compilers Central
Keywords: Pascal, tools
Posted-Date: 27 Aug 2009 12:45:42 EDT

There is a TextTransformer grammar now for the creation of a Delphi
parser. I think, that this is worth mentioning here because there have
been a lot of attempts to create such a grammar for other parser
generators, but no grammar is published, that really works without
severe restrictions.


The reason is, that there are some special difficulties with the
Delphi grammar:


- there is no standard specification of this proprietary language. The
specification has to be concluded from the Delphi help files. So
indeed, the completeness of the grammar cannot be proved. The actual
project can parse the complete VCL which accompanies the CBuilder 6
and it was tested at more than 2000 files of my installed Delphi
components.


- though the grammar can be made nearly LL(1) conform, there are cases
where looking-ahead in the code cannot be avoided. TextTransformer can
do so, but the project was written so that look-ahead's are as rare as
possible.


- there are non-reserved keywords like "read" or "name", which also
can be used as identifiers. TextTransformer has the special option, to
look for the expected tokens only. So these keywords are recognized at
places only, where they are allowed to occur.




You can read more about the grammar and download it here:


http://www.texttransformer.org/Delphi_en.html


The conditional compiling is managed by a preprocessor:


http://www.texttransformer.org/Delphi_pp_en.html


The use of the grammar is demonstrated by a Delphi pretty-printer:


http://www.texttransformer.org/DelphiPrettyPrint_en.html


The pretty-printer can be called from Delphi too by means of the
TetraComponents. That can be tested directly with the example binary,
which is contained in the package:


http://www.texttransformer.org/Components.html


Last but not least TextTransformer 1.7.2 just has been released at:


http://www.texttransformer.com



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.