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.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel