Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am not sure I understand why the transpiler/compiler distinction is really meaningful. Theoretically someone could just write a program in machine language too.


It's the value added by writing something in the source language instead of the target language.

When I'm writing assembly, I can jump to labels and don't have to worry about using the right opcode for my particular ADD instruction.

When I'm writing C, I no longer have to worry about calling conventions, register allocation, manually managing the stack.

When I'm writing Nim, I no longer have to worry about managing the heap or doing metaprogramming using the C preprocessor or doing unsafe parametric polymorphism.

A transpiler from tomahto to tomahto isn't either useful or instructive. It's like teaching someone how to use an EDM machine by having them cut a piece of metal in half along a straight line.


I don't imagine anyone wants to write a program in the "Teeny Tiny" language in the first place but a toy example is often easier to use to understand a concept than a realistic one.


Depends what your goal is. If you want to learn mostly parsing and some high level principles, a transpiler is fine, but parsing resources is dime a dozen.

If you want to learn to compile into a low level target, using a transpiler as the learning resource means a whole lot of essential aspects of code generation will get left out.




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

Search: