Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Added 'import' and module support:
- cfrantz@bunk:~/src/lang/df$ cat hello2.df
- import stdio;
- // Program entry at main
- main() -> int32 {
- stdio::printf("Hello World\n");
- return 0;
- }
- cfrantz@bunk:~/src/lang/df$ cat hello2.s
- SECTION .data
- str_2:
- DB 72,101,108,108,111,32,87,111,114,108,100,10,0
- SECTION .text
- ;
- ; hello2.df:0: import stdio;
- ;
- ;
- ; builtin/stdio.df:2: printf: extern __magic__("alias:printf") (format: &uint8, ...) -> int32;
- ;
- %define stdio$printf printf
- EXTERN printf
- ;
- ; hello2.df:3: main() -> int32 {
- ;
- GLOBAL main
- main:
- PUSH ebp
- MOV ebp, esp
- AND esp, -16
- SUB esp, 32
- MOV [ebp-4], ebx
- MOV [ebp-8], esi
- MOV [ebp-12], edi
- ;
- ; hello2.df:4: stdio::printf("Hello World\n");
- ;
- MOV eax, str_2
- MOV [esp+0], eax
- CALL stdio$printf
- ;
- ; hello2.df:5: return 0;
- ;
- MOV eax, 0
- fnexit_main_1:
- MOV ebx, [ebp-4]
- MOV esi, [ebp-8]
- MOV edi, [ebp-12]
- MOV esp, ebp
- POP ebp
- RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement