I'm coding a compiler for an non-existing language ( it's an example language for a university project). In the section reserved for function definitions, the compiler should be able to correctly compile such definitions:
function a() {
//some code...
b();
//other code...
}
//other function definitions
function b() {
printf("hello\n");
}
The compiler should parse definition for function "suspending" existence checking for function b usage inside function a . At the end of all function definitions, the compiler would check that all function used have been previously defined. Could anyone suggest a smart way to do this?