4 ms·
This is awesome. I have been toying with writing my own little JVM language (for education purposes) and this could go a long way to making that a bunch easier
by jpgvm 4y ago
This is awesome.
I have been toying with writing my own little JVM language (for education purposes) and this could go a long way to making that a bunch easier.
Thanks for sharing!
- noone_youknow 4y agoAwesome! I started this for educational purposes too, but if it turns out to be useful then I'll be very happy! Hope it turns out that way (and let me know if there's anything else you need to make it useful! :) )
- kjeetgill 4y agoIf you haven't heard of it already check out Truffle/graalvm
- jpgvm 4y agoI have but Truffle was a bit further than I wanted to go for now. If I wanted to build a production ready language it would likely be my first choice though.
- deleted 4y ago[deleted]
- hashmash 4y agoFor the code generation phase, it might be easier to bypass emitting a text-based assembly format and just use the ASM library directly. If you want something easier, I wrote a code generation library specifically for that purpose: https://github.com/cojen/Maker https://github.com/cojen/Maker It also includes an example "Mini-C" language compiler.
- j_ham3 4y agoSomething else that could make your code generation for your JVM language easier: ProGuardCORE (https://github.com/Guardsquare/proguard-core https://github.com/Guardsquare/proguard-core). It can be used to read, generate and analyse Java bytecode. Some examples for code generation: ProGuard where the project originated (https://github.com/Guardsquare/proguard https://github.com/Guardsquare/proguard), Brainf*ck compiler (https://github.com/mrjameshamilton/bf https://github.com/mrjameshamilton/bf), Lox compiler (https://github.com/mrjameshamilton/klox https://github.com/mrjameshamilton/klox) Disclaimer: I work at Guardsquare on ProGuardCORE so may be biased :)
- whizzter 4y agoWhat's the main difference compared to the ASM library? When I was still JVM stuff it was really on the right abstraction level for most things. (I was recently doing some .NET IL and gotta say that MS made it even easier to get started with DynamicMethod:s).
- j_ham3 4y agoProGuardCORE is very similar to ASM; they have a similar feature set and a similar visitor-based API. ProGuardCORE came about because ProGuard itself never used ASM when the project was started 20 years ago. We split out ProGuardCORE from ProGuard 2 years ago, to provide as a library the core underlying bytecode manipulation & analysis tools that ProGuard and the Android security solution DexGuard both use. Much of our recent focus in ProGuardCORE has been on the code analysis components: we've recently added to ProGuardCORE some of the analyses that power our AppSweep mobile security scanning service (https://appsweep.guardsquare.com/ https://appsweep.guardsquare.com/). For example, taint analysis https://guardsquare.github.io/proguard-core/taintcpa.html https://guardsquare.github.io/proguard-core/taintcpa.html