Files
ground-rewrite/test/test.c

30 lines
917 B
C
Raw Normal View History

2026-06-15 20:27:50 +10:00
#include <ground.h>
2026-06-16 20:08:21 +10:00
#include <stdio.h>
2026-06-15 20:27:50 +10:00
int main() {
GroundProgram program = Ground.New.Program();
GroundState state = {NULL, NULL, NULL};
2026-06-16 20:08:21 +10:00
// 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
2026-06-15 20:27:50 +10:00
Ground.Program.execute(&program, &state);
2026-06-16 20:08:21 +10:00
if (Ground.Flags.error) {
printf("Error set during execution!\n");
Ground.Log.printErrors();
return 1;
} else {
printf("Success!\n");
return 0;
}
2026-06-15 20:27:50 +10:00
}