CozySynthesizer / cozy

The collection synthesizer
https://cozy.uwplse.org
Apache License 2.0
209 stars 18 forks source link

Initial RPython codegen #48

Closed MostAwesomeDude closed 6 years ago

MostAwesomeDude commented 6 years ago

Hi! This codegen backend generates Python 2.7 syntax which is compatible with the RPython toolchain, as used in projects like PyPy and Typhon.

I'm still refining the output. In particular, I haven't gotten anything to translate with RPython properly. So this isn't quite ready to merge. On the other hand, there is at least one bugfix in the synthesis package here.

MostAwesomeDude commented 6 years ago

Hi Calvin! I'm gonna reply inline, but the basic outline:

So yeah, let's not merge this, but let's also figure out how to do better next time.

Calvin-L commented 6 years ago

Sounds good! I've cherry-picked your synthesis fix into master.

smart constructors for statements and some expressions

This is already sort-of done in the Java and C++ codegen, where all iterative operations distribute over singletons, appends, etc. It would probably be better to handle those in a separate simplification pass.

I'm also not sure how mutability works in Cozy

Most values are mutable, but there is no aliasing. Two different bag variables are always different bags; changes to one do not affect the other. Pointers (aka handles) are the only exception.

Calvin-L commented 6 years ago

@MostAwesomeDude I closed this PR since you didn't feel confident in it, but I want to reemphasize that I think adding additional backends is a great project.

Are you still planning to continue working on this? Infrastructure to make writing new backends easier would be extremely helpful as well. Your "smart constructors" idea is neat, but I think a lot of those transformations could be done in a pre-codegen simplification pass (#49). It would also help simplify the Java and C++ backends a lot.