Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source code generation

I am using grako utility of python to parse my OIL file to AST. but i want to re generate the source code back from the AST after modifying the AST. Is grako is having feature to do this or else any other utility in python is available for this source code re generation.

like image 718
Ravi Shankar Avatar asked Jun 09 '26 13:06

Ravi Shankar


1 Answers

Grako-style code generation is done through in-line templates using string.Formatter.

Look into the grako.codegen and grako.model modules/packages, and take a look at the examples/antlr2grako example.

Code generation is one of the least documented parts of Grako (in the README), but it is all there.

like image 165
Apalala Avatar answered Jun 11 '26 03:06

Apalala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!