test: 重构 Demo
This commit is contained in:
parent
359c65228d
commit
582ba2ce27
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import:Math
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
Math.add(6,1)
|
||||
return 0
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
declare res: boolean = 8L > 7L
|
||||
if res then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
return 65537
|
||||
end body
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module: Main
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
5 == 7
|
||||
5 == 7s
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import: os
|
||||
function: main
|
||||
return_type: void
|
||||
returns: void
|
||||
body:
|
||||
os.print(222)
|
||||
end body
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import: os
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
loop:
|
||||
init:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import: os
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
loop:
|
||||
init:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import: os
|
||||
function: main
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
loop:
|
||||
init:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
import: os
|
||||
function: main
|
||||
return_type: void
|
||||
returns: void
|
||||
body:
|
||||
declare n: int[][][][] = [
|
||||
[
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: int
|
||||
params:
|
||||
returns: int
|
||||
body:
|
||||
declare n1: int =1
|
||||
declare n2: int =2
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: boolean
|
||||
params:
|
||||
returns: boolean
|
||||
body:
|
||||
declare b1: boolean =true
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: int
|
||||
params:
|
||||
returns: int
|
||||
body:
|
||||
declare b1: boolean = true
|
||||
loop:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: int
|
||||
params:
|
||||
returns: int
|
||||
body:
|
||||
declare b1 :int = -1
|
||||
return b1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: boolean
|
||||
params:
|
||||
returns: boolean
|
||||
body:
|
||||
declare b1 :boolean = true
|
||||
return !b1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module: Main
|
||||
function: main
|
||||
parameter:
|
||||
return_type: long
|
||||
params:
|
||||
returns: long
|
||||
body:
|
||||
declare n: long
|
||||
n = 2147483647
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user