[fpc-devel] Dumping the syntax tree

Michael Van Canneyt michael at freepascal.org
Thu Oct 23 22:36:17 CEST 2014


See the FPC sources:

packages/fcl-passrc/examples/test_parser.pp

Michael.

On Thu, 23 Oct 2014, Vsevolod Alekseyev wrote:

> What test program, please? Where?
>
> On 10/23/2014 4:12 PM, Michael Van Canneyt wrote:
>> 
>> 
>> 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 at lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>> 
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>



More information about the fpc-devel mailing list