
Ask HN: Beginner non-trivial transpiler projects to learn from? - kesava
I have some compilers background and would like to study beginner non-trivial transpiler source code. Any recommendations?
======
HackedBunny
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...](https://github.com/blitz-
research/monkey2/tree/develop/src/mx2cc)

... 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](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://blitzresearch.itch.io/monkey2)
[https://blitzmax.org/](https://blitzmax.org/)

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

------
Const-me
Take a look there: [https://github.com/Const-
me/vis_avs_dx/tree/master/avs_dx/Dx...](https://github.com/Const-
me/vis_avs_dx/tree/master/avs_dx/DxVisuals/Expressions) Couple test cases:
[https://github.com/Const-
me/vis_avs_dx/blob/master/avs_dx/Co...](https://github.com/Const-
me/vis_avs_dx/blob/master/avs_dx/CompilerTest/CompilerTest.cpp)

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.

------
quickthrower2
I knocked something up. It might be a bit too trivial but I’ll let you judge:
[https://github.com/mcapodici/badlanguage](https://github.com/mcapodici/badlanguage)

~~~
kesava
thank you! Having scheme/lisp on either end of transpilation seems like a good
beginner project to learn from.

~~~
quickthrower2
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!

------
max_
You may want to have a look at an "MVP" compiler one of such projects is The
Super Tiny Compiler[0]

[0][https://github.com/jamiebuilds/the-super-tiny-
compiler](https://github.com/jamiebuilds/the-super-tiny-compiler)

