ps5: map generate_function in generate_program

This commit is contained in:
2026-03-28 21:39:03 +01:00
parent 2bbc045294
commit f96df358c9

View File

@@ -29,6 +29,18 @@ void generate_program(void)
// TODO (Task 3):
// For each function in global_symbols, generate it using generate_function ()
bool found = false;
symbol_t *entry;
for (int i = 0; i < global_symbols->n_children; i++) {
symbol_t *sym = global_symbols->children[i];
if (sym->type == SYMBOL_FUNCTION) {
if (!found) {
entry = sym;
found = true;
}
generate_function(sym);
}
}
// In VSL, the topmost function in a program is its entry point.
// We want to be able to take parameters from the command line,
@@ -38,6 +50,7 @@ void generate_program(void)
// and passed as the (argc, argv)-pair, we need to make a wrapper for our entry function.
// This wrapper handles string -> int64_t conversion, and is already implemented.
// call generate_main ( <entry point function symbol> );
generate_main(entry);
}
// Prints one .asciz entry for each string in the global string_list