Last active
August 29, 2015 13:58
-
-
Save antonijn/10363874 to your computer and use it in GitHub Desktop.
What code compiled by FACC might look like (FAC-syntax)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global main | |
| main: | |
| push bp | |
| mov bp, sp | |
| sub sp, 2 | |
| mov word [ss:bp - 2], 0 | |
| .for0.start: | |
| cmp word [ss:bp - 2], 10 | |
| jnl .for0.break | |
| sub sp, 0 | |
| mov ax, .strlit0 | |
| push ax | |
| call printf | |
| add sp, 2 | |
| .for0.continue: | |
| inc word [ss:bp - 2] | |
| add sp, 0 | |
| jmp .for0.start | |
| .for0.break: | |
| mov ax, 0 | |
| add sp, 2 | |
| pop bp | |
| ret | |
| .strlit0: db "Hello, world!", 0x0a, 0x00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| include("stdio.h"); | |
| int main() { | |
| for (int i = 0; i < 10; ++i) { | |
| printf("Hello, world!\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment