Hacker News new | past | comments | ask | show | jobs | submit login

We recently added a way to dump out the compiler's intermediate representation as JSON, so it's actually very straightforward to create new backends by transforming that output [1].

The representation is fairly compact, so the requirements for a PureScript compiler backend are fairly minimal. You just have to translate all of the features of the IR:

- Functions with lexical scoping - Support for the primitive types defined by PureScript (we need to define some of these types more concretely in a specification) - A way to encode records. This could be something like JavaScript's objects, or just a map data structure.

The JS backend actually does more optimizations before code generation, but it starts from the same intermediate representation.

[1] https://github.com/paf31/24-days-of-purescript-2016/blob/mas...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: