Ask HN: Beginner non-trivial transpiler projects to learn from?

7 points by kesava ↗ HN
I have some compilers background and would like to study beginner non-trivial transpiler source code. Any recommendations?

6 comments

[ 3.0 ms ] story [ 26.5 ms ] thread
These might be too far off the beaten track for you, being non-standard languages with full game library systems, but Mark Sibly's Monkey2 (discontinued for lack of support) is a complex transpiler project written in a very read-friendly language:

https://github.com/blitz-research/monkey2/tree/develop/src/m...

... and one of his previous languages, BlitzMax, is continued by others today as BlitzMaxNG, and it uses a frequently-updated transpiler based off the former/similar Monkey language:

https://github.com/bmx-ng/bcc

Again, easy to read, and the principles are the same for almost any language.

Downloadable distros:

https://blitzresearch.itch.io/monkey2 https://blitzmax.org/

Targets include Windows x86/64, Mac, Linux, Android and HTML5... among others!

I knocked something up. It might be a bit too trivial but I’ll let you judge: https://github.com/mcapodici/badlanguage
thank you! Having scheme/lisp on either end of transpilation seems like a good beginner project to learn from.
He he when looking at it, be critical because I knocked this up. A pro haskeller could probably find a few flaws in it and the JS generated code will not be performant!
Take a look there: https://github.com/Const-me/vis_avs_dx/tree/master/avs_dx/Dx... Couple test cases: https://github.com/Const-me/vis_avs_dx/blob/master/avs_dx/Co...

The transpiler is in C++/17. The source language is something called NSEEL, implemented in Winamp couple decades ago. The original runtime was a JIT into old-school x87 code. The target language is Microsoft HLSL, specifically it’s for shader model 5 for Direct3D 11.0.

I have little to no background with compiler development, but IMO my transpiler ain’t too bad, and it’s very efficient.