refactor: 重构模板代码

This commit is contained in:
zhangxun 2025-08-04 14:50:10 +08:00
parent 87560db20d
commit d11822f4ba
2 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ public class ASTPrinter {
NodeContext _ NodeContext _
) -> { ) -> {
System.out.println(pad + "function " + name System.out.println(pad + "function " + name
+ "(params=" + parameters + ", return=" + returnType + ")"); + "(params=" + parameters + ", returns=" + returnType + ")");
for (StatementNode stmt : body) { for (StatementNode stmt : body) {
print(stmt, indent + 1); print(stmt, indent + 1);
} }

View File

@ -24,8 +24,8 @@ public final class SnowExample {
return """ return """
module: Math module: Math
function: main function: main
parameter: params:
return_type: int returns: int
body: body:
Math.factorial(6) Math.factorial(6)
return 0 return 0
@ -33,9 +33,9 @@ public final class SnowExample {
end function end function
function: factorial function: factorial
parameter: params:
declare n: int declare n: int
return_type: int returns: int
body: body:
declare num1: int = 1 declare num1: int = 1
loop: loop: