QnnOkabayashi / curse-lang

1 stars 1 forks source link

Conversion to CPS #18

Open William103 opened 1 year ago

William103 commented 1 year ago

Implement #17. I'm currently almost done, but things are still very rough around the edges.

TODOS in no particular order:

Eventually, probably in a different PR, I'd like to write a new interpreter that interprets the CPS code.

William103 commented 1 year ago

... can you just make everything methods on a struct?

That was my first attempt. I'm translating some SML code, so it gets wild with all the references. The callbacks everywhere would end up needing to take a &mut self as well as convert_record and its callbacks, and that's too many mutable references for the borrow checker to be happy. It could maybe be possible with a bunch of Rc<RefCell<self>> but that sounds horrible. I'm sure there's a way to do the whole algorithm more imperatively with a struct but idk how; I barely understand the functional version.