Re:Stop Building on Corporate-Controlled Languages
by mike_hearn on Wednesday January 18, 2023 @04:52PM
(#34433642)
That's what GraalVM is. Created by a corporation of course, but it's open source.
GraalVM has Truffle, which is an API for creating languages. If you use it, you get a lot of features for "free". All you have to do is write an AST interpreter. I wrote about it a long time ago here:
• Advanced JIT compiler with support for static and dynamic typing, multiple CPU archs.
• Advanced multi-threaded portable runtime.
• Several cutting edge garbage collectors (you don't have to use them).
• Native standalone single binary for your language's interpreter/jit.
• Interop with other languages! (call into js, python, ruby, java, kotlin etc).
• Can also call into WebAssembly and native code compiled with LLVM, your JIT will optimize across the boundary.
• Can implement your language stdlib in any other language (see interop) meaning programs written in your language run on every major OS out of the box.
• Profiling support.
• Debugger support (chrome devtools).
• Sandboxing.
• Heap snapshotting.
• Code coverage support.
• Some Language Server Protocol support.
Probably more I forgot about already. It's really a pretty amazing generalization of the JVM and drops the cost of creating competitive new languages through the floor. IDE integration is the weakest part, but as you're writing your AST interp in Java, making a converter to the IntelliJ PSI AST API isn't much more work so an IntelliJ plugin would be easy. And IntelliJ is itself open source so you can fork it to make a dedicated language IDE if you want.
GraalVM has Truffle, which is an API for creating languages. If you use it, you get a lot of features for "free". All you have to do is write an AST interpreter. I wrote about it a long time ago here:
https://blog.plan99.net/graal-truffle-134d8f28fb69
Misc things you get:
• Advanced JIT compiler with support for static and dynamic typing, multiple CPU archs.
• Advanced multi-threaded portable runtime.
• Several cutting edge garbage collectors (you don't have to use them).
• Native standalone single binary for your language's interpreter/jit.
• Interop with other languages! (call into js, python, ruby, java, kotlin etc).
• Can also call into WebAssembly and native code compiled with LLVM, your JIT will optimize across the boundary.
• Can implement your language stdlib in any other language (see interop) meaning programs written in your language run on every major OS out of the box.
• Profiling support.
• Debugger support (chrome devtools).
• Sandboxing.
• Heap snapshotting.
• Code coverage support.
• Some Language Server Protocol support.
Probably more I forgot about already. It's really a pretty amazing generalization of the JVM and drops the cost of creating competitive new languages through the floor. IDE integration is the weakest part, but as you're writing your AST interp in Java, making a converter to the IntelliJ PSI AST API isn't much more work so an IntelliJ plugin would be easy. And IntelliJ is itself open source so you can fork it to make a dedicated language IDE if you want.