[fpc-devel] Dumping the syntax tree

Michael Van Canneyt michael at freepascal.org
Thu Oct 23 22:12:16 CEST 2014



You had better use the fcl-passrc units. They dump a complete syntax tree.
It is used to generate (a currently limited version of)  javascript, and 
used to create documentation.

so it should be usable to generate C code...

The test program re-dumps a pascal program. 
Presumably you can adapt that to generate C.

Michael.

On Thu, 23 Oct 2014, Kostas Michalopoulos wrote:

> Lazarus has a Pascal tokenizer unit under components\mpaslex\mpaslex.pp. It seems old and doesn't look like it supports the full FPC syntax, but it might be a starting point
> since most likely you can convert the code to C++ with GNU GCC extensions (nested functions, etc) straightforward.



More information about the fpc-devel mailing list