AST idea
This commit is contained in:
19
new_print.c
19
new_print.c
@@ -202,19 +202,32 @@ decl_print(Decl *node){
|
||||
}
|
||||
} break;
|
||||
|
||||
case DECL_Const:
|
||||
case DECL_Variable:{
|
||||
println("%s: ", node->name.s.str);
|
||||
B32 r = typespec_print(node->var_decl.type);
|
||||
if(node->var_decl.typespec) typespec_print(node->var_decl.typespec);
|
||||
print_assign_expr(node->var_decl.expr);
|
||||
if(r) printf(";");
|
||||
} break;
|
||||
|
||||
case DECL_Typedef:{
|
||||
println("typedef %s ", node->name.s.str);
|
||||
typespec_print(node->typedef_decl.type);
|
||||
typespec_print(node->typedef_decl.typespec);
|
||||
printf(";");
|
||||
} break;
|
||||
|
||||
case DECL_Function:{
|
||||
println("");
|
||||
typespec_print(node->func_decl.ret);
|
||||
printf(" %s", node->name.s.str);
|
||||
printf("(");
|
||||
for(Decl_Function_Arg *arg = node->func_decl.first; arg; arg=arg->next){
|
||||
printf("%s: ", arg->name.s.str);
|
||||
typespec_print(arg->typespec);
|
||||
if(arg != node->func_decl.last)
|
||||
printf(", ");
|
||||
}
|
||||
printf(");");
|
||||
} break;
|
||||
|
||||
case DECL_Struct:
|
||||
case DECL_Union :{
|
||||
|
||||
Reference in New Issue
Block a user