-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathumka_compiler.h
66 lines (55 loc) · 2.04 KB
/
umka_compiler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef UMKA_COMPILER_H_INCLUDED
#define UMKA_COMPILER_H_INCLUDED
#include "umka_common.h"
#include "umka_lexer.h"
#include "umka_types.h"
#include "umka_vm.h"
#include "umka_gen.h"
#include "umka_ident.h"
#include "umka_const.h"
#include "umka_runtime.h"
#include "umka_api.h"
typedef struct
{
UmkaAPI api; // Must be the first field
Storage storage;
Modules modules;
Blocks blocks;
Externals externals;
Lexer lex;
Types types;
Idents idents;
Consts consts;
CodeGen gen;
VM vm;
DebugInfo debug;
Error error;
// Pointers to built-in types
Type *voidType,
*nullType,
*int8Type, *int16Type, *int32Type, *intType,
*uint8Type, *uint16Type, *uint32Type, *uintType,
*boolType,
*charType,
*real32Type, *realType,
*strType,
*fiberType,
*ptrVoidType, *ptrNullType,
*anyType;
// Command-line arguments
int argc;
char **argv;
// Original codepage (Windows only)
unsigned int originalCodepage;
} Compiler;
void compilerInit (Compiler *comp, const char *fileName, const char *sourceString, int stackSize, int argc, char **argv, bool fileSystemEnabled, bool implLibsEnabled);
void compilerFree (Compiler *comp);
void compilerCompile (Compiler *comp);
void compilerRun (Compiler *comp);
void compilerCall (Compiler *comp, FuncContext *fn);
char *compilerAsm (Compiler *comp);
bool compilerAddModule (Compiler *comp, const char *fileName, const char *sourceString);
bool compilerAddFunc (Compiler *comp, const char *name, ExternFunc func);
bool compilerGetFunc (Compiler *comp, const char *moduleName, const char *funcName, FuncContext *fn);
void compilerMakeFuncContext (Compiler *comp, Type *fnType, int entryOffset, FuncContext *fn);
#endif // UMKA_COMPILER_H_INCLUDED