test: 重构 Demo

This commit is contained in:
zhangxun 2025-08-04 14:52:13 +08:00
parent 359c65228d
commit 582ba2ce27
30 changed files with 52 additions and 52 deletions

View File

@ -1,7 +1,7 @@
module: Main
import:Math
function: main
return_type: int
returns: int
body:
Math.add(6,1)
return 0

View File

@ -1,9 +1,9 @@
module: Math
function: add
parameter:
params:
declare n1: int
declare n2: int
return_type: int
returns: int
body:
return n1 + n2
end body

View File

@ -1,5 +1,5 @@
function: main
return_type: int
returns: int
body:
declare res: boolean = 8L > 7L
if res then

View File

@ -1,5 +1,5 @@
function: main
return_type: int
returns: int
body:
return 65537
end body

View File

@ -1,6 +1,6 @@
module: Main
function: main
return_type: int
returns: int
body:
foo()
@ -9,7 +9,7 @@ module: Main
end function
function: foo
return_type: int
returns: int
body:
if false then
return 1

View File

@ -1,6 +1,6 @@
module: Main
function: main
return_type: int
returns: int
body:
5 == 7
5 == 7s

View File

@ -1,7 +1,7 @@
module: Main
import: os
function: main
return_type: void
returns: void
body:
os.print(222)
end body

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -3,7 +3,7 @@ module: Main
globals:
declare num2:int=10
function: main
return_type: void
returns: void
body:
declare num1:int=11
os.print(num1+num2+abc())
@ -11,7 +11,7 @@ module: Main
end function
function: abc
return_type: int
returns: int
body:
return 1
end body

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
import: os
function: main
return_type: int
returns: int
body:
loop:
init:

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
import: os
function: main
return_type: int
returns: int
body:
loop:
init:

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
import: os
function: main
return_type: int
returns: int
body:
loop:
init:

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
import: os
function: main
return_type: void
returns: void
body:
declare n: int[][][][] = [
[

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: int
params:
returns: int
body:
return (1+2) / 3 * 4 + 2 *2
end body

View File

@ -1,7 +1,7 @@
module: Main
import:os
function: main
return_type: void
returns: void
body:
declare arr: int[] = [1, 2, 3]
arr[0] = 5

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -3,8 +3,8 @@ module: Main
globals:
declare sum: int = 123
function: main
parameter:
return_type: int
params:
returns: int
body:
declare arr: int[][][][][][][][][][][][][][][][][][][][][][] = [[[[[[[[[[[[[[[[[[[[[[1], [2], [3]]]]]]]]]]]]]]]]]]]]]]
loop:

View File

@ -1,9 +1,9 @@
module: os
import: os
function: print
parameter:
params:
declare i1: int
return_type: void
returns: void
body:
syscall("PRINT",i1)
end body

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: int
params:
returns: int
body:
declare n1: int =1
declare n2: int =2

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: boolean
params:
returns: boolean
body:
declare b1: boolean =true

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: int
params:
returns: int
body:
declare b1: boolean = true
loop:

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: int
params:
returns: int
body:
declare b1 :int = -1
return b1

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: boolean
params:
returns: boolean
body:
declare b1 :boolean = true
return !b1

View File

@ -1,7 +1,7 @@
module: Main
function: main
parameter:
return_type: long
params:
returns: long
body:
declare n: long
n = 2147483647

View File

@ -1,7 +1,7 @@
module: Math
function: main
parameter:
return_type: int
params:
returns: int
body:
Math.factorial(6)
return 0
@ -9,9 +9,9 @@ module: Math
end function
function: factorial
parameter:
params:
declare n:int
return_type: int
returns: int
body:
declare num1:int = 1
loop: