Preprocess program before bytecodeifying
This commit is contained in:
17
src/main.c
17
src/main.c
@@ -236,8 +236,23 @@ int main(int argc, char** argv) {
|
||||
.labels = NULL,
|
||||
.variables = NULL
|
||||
};
|
||||
GroundBytecode bc = Ground.New.Bytecode(&codegen.as.success, &state);
|
||||
// Ground requires we preprocess the program before converting to bytecode
|
||||
GroundProgram preprocessed = Ground.Program.preprocess(&codegen.as.success, &state);
|
||||
if (Ground.Flags.error) {
|
||||
Ground.Log.printErrors();
|
||||
return 1;
|
||||
}
|
||||
// Then generate and save bytecode
|
||||
GroundBytecode bc = Ground.New.Bytecode(&preprocessed, &state);
|
||||
if (Ground.Flags.error) {
|
||||
Ground.Log.printErrors();
|
||||
return 1;
|
||||
}
|
||||
Ground.Bytecode.save(&bc, args.outputFile);
|
||||
if (Ground.Flags.error) {
|
||||
Ground.Log.printErrors();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SA_COMPILE: {
|
||||
|
||||
Reference in New Issue
Block a user