]>
git.bts.cx Git - sun.git/blob - runtime/src/sun/compiler/compiler.c
1 #include <sun/compiler/compiler_internal.h>
5 #include "sun_parser.h" // This needs to be first.
8 #include <sun/compiler/vm_generator.h>
9 #include <sun/tree/node.h>
10 #include <sun/tree/tree.h>
11 #include <sun/vm/vm.h>
13 extern int yyparse(SLTNode
**moduleOut
, yyscan_t
*scanner
);
15 SVMModule
*slcCompileSource(const SLCCompileConfiguration
*configuration
) {
20 extra
.readCallback
= configuration
->sourceReadCallback
;
21 extra
.readCallbackParameter
= configuration
->sourceUserParam
;
23 yylex_init_extra(&extra
, &sc
);
24 SLTNode
*module
= NULL
;
25 int parse_return
= yyparse(&module
, sc
);
28 switch (parse_return
) {
30 return slcGenerateVMInstructions(module
);
37 printf("Out of memory\n");
41 printf("Unknown error...\n");