Files
ground-rewrite/test/test.c
2026-06-16 20:08:21 +10:00

30 lines
917 B
C

#include <ground.h>
#include <stdio.h>
int main() {
GroundProgram program = Ground.New.Program();
GroundState state = {NULL, NULL, NULL};
// Instruction 1: CREATELABEL start
GroundInstruction label_inst = Ground.New.Instruction(GroundInstruction_CREATELABEL);
Ground.Instruction.append(&label_inst, Ground.New.Arg.LabelRef("start"));
Ground.Program.append(&program, label_inst);
// Instruction 2: JUMP start
GroundInstruction jump_inst = Ground.New.Instruction(GroundInstruction_JUMP);
Ground.Instruction.append(&jump_inst, Ground.New.Arg.LabelRef("start"));
Ground.Program.append(&program, jump_inst);
// Execute program
Ground.Program.execute(&program, &state);
if (Ground.Flags.error) {
printf("Error set during execution!\n");
Ground.Log.printErrors();
return 1;
} else {
printf("Success!\n");
return 0;
}
}