4 ms·
> where your target is MORE sophisticated than your own lang. I.. hadn't thought of this. I mean I wouldn't transpile to a slow lang like python but choosing Z
by alcover 2y ago
> where your target is MORE sophisticated than your own lang.
I.. hadn't thought of this. I mean I wouldn't transpile to a slow lang like python but choosing Zig or C++ is tempting. Zig maybe not as it's unfinished. But C++ instead of C would make my life easier (for ex. implementing classes).
> prelude with some hand-crafted functions that do the lifting. With this I mean things like `fn int(I:Int):Int'` so your code output is like `plus(int(1), int(2))`
Curious what you mean here. Is it `1+2` -> ast Binop{'+', left, right} -> gen `plus(1,2)` ?? Sorry it's late here and I should sleep..
- travisgriggs 2y ago> Zig maybe not as it’s unfinished But, but, but… They share the same two start letters! They were clearly meant to cohabitate! Zinc on Zig, what a Zing! (Just a casual at-a-distance zig fan)
- unquietwiki 2y agoNim might be useful, either as a compiler or transpiler. https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/ https://hookrace.net/blog/introduction-to-metaprogramming-in... https://livebook.manning.com/book/nim-in-action/chapter-9/ https://livebook.manning.com/book/nim-in-action/chapter-9/
- mamcx 2y ago> Curious what you mean here. Is it `1+2` -> ast Binop{'+', left, right} -> gen `plus(1,2)` ?? Sorry it's late here and I should sleep.. Yes, `plus(1,2)`. The problem will become more apparent when you find things like `plus` need some overloading support/macros/generics/etc, so thing like `print` too. So, eventually you need to think in macros, multiple versions of the same thing, or, if you craft things very carefully, only support things your target support so you can avoid it (but I wonder how much is feasible)
- rerdavies 2y agoI've been down this path. Code generation is great; but the downside to this approach is that making the language debug-able is pretty much impossible. (An MPEG-SA structured audio compiler with a C++ back end).