6 ms·
Compiler. Like clang or gcc - a program that converts from one language to another. $ cat hello.c #include <stdio.h> int main(void) { pri
by sigjuice 10y ago
Compiler. Like clang or gcc - a program that converts from one language to another.
$ 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
- sedatk 10y agoassembly source is the byproduct of compilers not their output.
- smcl 10y agoGenerally speaking compiler will take C/C++/Go/whatever and produce assembly as output. The Assembler will produce take this output .asm/.s and produce some form of binary. The Linker will take these binaries and produce an executable you can run. Note this is oversimplified (and in some cases wrong) but the general point is that when you call a "compiler" you're generally calling a high-level utility that ties a number of separate components together.
- srean 10y agoFully agree. Not sure why you are being downvoted. The word 'transpiler' annoys me a great deal because we already had a word in frequent use for that.
- sigjuice 10y agoThe project README doesn't use this word either. The Forth source code is compiled to Tcl procedures for execution in the Tcl run time system.