Convert purescript code to intermediate representation
Hello @csicar
How about if we can convert purescript code to intermediate representation?
I mean this one https://github.com/JetBrains/kotlin/tree/master/compiler/ir
Or maybe LLVM (I know some article about it http://www.stephendiehl.com/llvm)
Hi @xgrommx
At the moment pskt works by converting Purescripts CoreFn into Kotlin Source Files, which can then be compiled to class files (or jar files for that matter)
If I understand it correctly, you are suggesting to compile CoreFn to Kotlin's intermediate representation, which can then be compiled to class files.
I'm open for the idea. Some questions about it:
- What advantages would that have?
- Would that simplify the code generation or increase performance?
- Is there an interface to access the Kotlin IR from
kotlincor similar?
Some possible downsides to consider:
- In the current version of pskt, the generated kotlin files can be (mostly) read and also used for debugging. Would it be possible to keep that feature?
In terms of LLVM: I think that LLVM is not the right choice for this project, since interoperability with normal Kotlin/Java/Android code would be harder, which would make the project redundant. For such a backend, purescript-native would probably be the right place