/; _indent (int idt) /; loop (int i = 0; i < idt) [i++] _printf(" \0") ;/ ;/ /; generate (~utils.File fin, fout) # Parse files into AST parse.Node ast = parse.generate_ast(fin) ast.update_children() parse.print_ast(~ast) # Create output buffer CompBuf buffer buffer.init() # Transform into a module tree Module mod mod.init(~ast, ~buffer) mod.update_children() # Compile code _gen_prims(~mod) mod.compile(~buffer) mod.print() # Write assembly to output file fout.create() buffer.write_to(fout) fout.close() # Free all structs mod.end() buffer.end() ast.end() ;/ /; _gen_prim(int size, ~uint8 id) [Struct] Var t Struct s s.size = size s.methods = NULL s.members.init(len t) s.name = utils.strcpy(id) s._up = NULL return s ;/ /; _gen_prims (~Module m) Struct s # One byte prims s = _gen_prim(1, "bool\0") m`.structs.push(~s) s = _gen_prim(1, "uint8\0") m`.structs.push(~s) s = _gen_prim(1, "int8\0") m`.structs.push(~s) # Two byte prims s = _gen_prim(2, "uint16\0") m`.structs.push(~s) s = _gen_prim(2, "int16\0") m`.structs.push(~s) # Four byte prims s = _gen_prim(4, "uint32\0") m`.structs.push(~s) s = _gen_prim(4, "int32\0") m`.structs.push(~s) s = _gen_prim(4, "float32\0") m`.structs.push(~s) # Eight byte prims s = _gen_prim(8, "uint64\0") m`.structs.push(~s) s = _gen_prim(8, "int64\0") m`.structs.push(~s) s = _gen_prim(8, "float64\0") m`.structs.push(~s) s = _gen_prim(8, "uint\0") m`.structs.push(~s) s = _gen_prim(8, "int\0") m`.structs.push(~s) s = _gen_prim(8, "float\0") m`.structs.push(~s) s = _gen_prim(8, "void\0") m`.structs.push(~s) ;/