4 ms·
But isn't that what this is? I was under the impression that a compiler turns source code into machine code whereas a transpiler turns source code into differne
by castis 10y ago
But isn't that what this is? I was under the impression that a compiler turns source code into machine code whereas a transpiler turns source code into differnet source code?
- daeken 10y agoAll compilers turn one form of code into another. Whether that's C to assembly (to machine code), or JavaScript to bytecode to machine code, or Python to Python. Transpiler is just a term referring to a compiler taking one high-level language to another. It's unnecessary because a Coffeescript to JavaScript compiler is a transpiler already; saying "transpiler" there tells you nothing you don't already know.
- omaranto 10y agoThe phrase "an A to B compiler" might not gain anything from changing compiler to transpiler, but the phrase "an A compiler" does.
- sigjuice 10y agoI would suggest reading the first couple of pages of any compiler book. e.g. https://books.google.com/books?id=_tgh4bgQ6PAC&printsec=frontcover&dq=engineering+a+compiler&hl=en&sa=X&ved=0ahUKEwiM3_aVgMXTAhVD0WMKHd1YDtkQ6AEIJjAA#v=onepage&q=engineering%20a%20compiler&f=false https://books.google.com/books?id=_tgh4bgQ6PAC&printsec=fron... Compilers are computer programs that translate a program written in one language into a program written in another language. Example of a compiler in action. $ cat hello.c #include <stdio.h> int main(void) { printf("hello world\n"); return 42; } $ cc -O3 -S hello.c -o - .section __TEXT,__text,regular,pure_instructions .macosx_version_min 10, 12 .globl _main .align 4, 0x90 _main: ## @main .cfi_startproc ## BB#0: pushq %rbp Ltmp0: .cfi_def_cfa_offset 16 Ltmp1: .cfi_offset %rbp, -16 movq %rsp, %rbp Ltmp2: .cfi_def_cfa_register %rbp leaq L_str(%rip), %rdi callq _puts movl $42, %eax popq %rbp retq .cfi_endproc .section __TEXT,__cstring,cstring_literals L_str: ## @str .asciz "hello world" .subsections_via_symbols