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

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!




For 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 It also includes an example "Mini-C" language compiler.


Something else that could make your code generation for your JVM language easier: ProGuardCORE (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), Brainf*ck compiler (https://github.com/mrjameshamilton/bf), Lox compiler (https://github.com/mrjameshamilton/klox)

Disclaimer: I work at Guardsquare on ProGuardCORE so may be biased :)


What'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).


ProGuardCORE 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/). For example, taint analysis https://guardsquare.github.io/proguard-core/taintcpa.html


Awesome! 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! :) )


If you haven't heard of it already check out Truffle/graalvm


I 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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: