refactor: 重构 Demo
This commit is contained in:
parent
62f58cd83a
commit
9f3b3ad860
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import:Math
|
import:Math
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.add(6,1)
|
Math.add(6,1)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: Math
|
module: Math
|
||||||
function: add
|
function: add
|
||||||
parameter:
|
params:
|
||||||
declare n1: int
|
declare n1: int
|
||||||
declare n2: int
|
declare n2: int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return n1 + n2
|
return n1 + n2
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare res: boolean = 8L > 7L
|
declare res: boolean = 8L > 7L
|
||||||
if res then
|
if res then
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return 65537
|
return 65537
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
foo()
|
foo()
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ module: Main
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function: foo
|
function: foo
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
if false then
|
if false then
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
5 == 7
|
5 == 7
|
||||||
5 == 7s
|
5 == 7s
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
os.print(222)
|
os.print(222)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -3,7 +3,7 @@ module: Main
|
|||||||
globals:
|
globals:
|
||||||
declare num2:int=10
|
declare num2:int=10
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
declare num1:int=11
|
declare num1:int=11
|
||||||
os.print(num1+num2+abc())
|
os.print(num1+num2+abc())
|
||||||
@ -11,7 +11,7 @@ module: Main
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function: abc
|
function: abc
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return 1
|
return 1
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
loop:
|
loop:
|
||||||
init:
|
init:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
loop:
|
loop:
|
||||||
init:
|
init:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
loop:
|
loop:
|
||||||
init:
|
init:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
declare n: int[][][][] = [
|
declare n: int[][][][] = [
|
||||||
[
|
[
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return (1+2) / 3 * 4 + 2 *2
|
return (1+2) / 3 * 4 + 2 *2
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import:os
|
import:os
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
declare arr: int[] = [1, 2, 3]
|
declare arr: int[] = [1, 2, 3]
|
||||||
arr[0] = 5
|
arr[0] = 5
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -3,8 +3,8 @@ module: Main
|
|||||||
globals:
|
globals:
|
||||||
declare sum: int = 123
|
declare sum: int = 123
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare arr: int[][][][][][][][][][][][][][][][][][][][][][] = [[[[[[[[[[[[[[[[[[[[[[1], [2], [3]]]]]]]]]]]]]]]]]]]]]]
|
declare arr: int[][][][][][][][][][][][][][][][][][][][][][] = [[[[[[[[[[[[[[[[[[[[[[1], [2], [3]]]]]]]]]]]]]]]]]]]]]]
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare n1: int =1
|
declare n1: int =1
|
||||||
declare n2: int =2
|
declare n2: int =2
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: boolean
|
returns: boolean
|
||||||
body:
|
body:
|
||||||
declare b1: boolean =true
|
declare b1: boolean =true
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare b1: boolean = true
|
declare b1: boolean = true
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare b1 :int = -1
|
declare b1 :int = -1
|
||||||
return b1
|
return b1
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: boolean
|
returns: boolean
|
||||||
body:
|
body:
|
||||||
declare b1 :boolean = true
|
declare b1 :boolean = true
|
||||||
return !b1
|
return !b1
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: long
|
returns: long
|
||||||
body:
|
body:
|
||||||
declare n: long
|
declare n: long
|
||||||
n = 2147483647
|
n = 2147483647
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
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
|
||||||
@ -9,9 +9,9 @@ module: Math
|
|||||||
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:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user