mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-24 15:48:47 +00:00
Added X86 codegeneration interface and tests
This commit is contained in:
parent
77ec064c5c
commit
de018e76aa
12 changed files with 320 additions and 34 deletions
22
runtime/runtime.c
Normal file
22
runtime/runtime.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* Runtime library */
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
/* Lread is an implementation of the "read" construct */
|
||||
extern int Lread () {
|
||||
int result;
|
||||
|
||||
printf ("> ");
|
||||
fflush (stdout);
|
||||
scanf ("%d", &result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Lwrite is an implementation of the "write" construct */
|
||||
extern int Lwrite (int n) {
|
||||
printf ("%d\n", n);
|
||||
fflush (stdout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue