Barnard-PL-Labs / tsltools

Library and tools for the TSL specification format
Other
7 stars 4 forks source link

fix code generation bugs #43

Closed leoqiao18 closed 1 year ago

leoqiao18 commented 1 year ago

Fixing issue #39 . This is still unfinished, but I want to start this PR to track the progress and maybe have some discussions.

The problem is a lot more ingrained in the method of code generation. The best approach is to define some more datatypes and do transformations on these datatypes, instead of manipulating strings directly and in a hacky way.

I am still thinking about how to do this in the cleanest way possible, but most likely it will be a complete rewrite.

leoqiao18 commented 1 year ago

Implement a Codegen module to transform HOA to an internal program representation.

Implement an Imp module to provide easy template for imperative code generation.

Implement Python and Javascript modules using Imp.

leoqiao18 commented 1 year ago

This makes it simpler to generate code for different languages (see Python and JS module for reference). It also fixes the function/predicate application bug in #39.

leoqiao18 commented 1 year ago

Checked some outputs with online syntax validator. Correct for Python and JS.

I think this is ready to be used.