test: 添加 Demo22 演示项目
This commit is contained in:
parent
b454d65962
commit
5f42beaf2a
12
playground/Demo/Demo22/Main.snow
Normal file
12
playground/Demo/Demo22/Main.snow
Normal file
@ -0,0 +1,12 @@
|
||||
module: Main
|
||||
import: os,ModuleA
|
||||
globals:
|
||||
declare sum: int = 3
|
||||
function: main
|
||||
returns: void
|
||||
body:
|
||||
sum = sum + ModuleA._sum(1, 2)
|
||||
os.print(sum)
|
||||
end body
|
||||
end function
|
||||
end module
|
||||
11
playground/Demo/Demo22/ModuleA.snow
Normal file
11
playground/Demo/Demo22/ModuleA.snow
Normal file
@ -0,0 +1,11 @@
|
||||
module: ModuleA
|
||||
function: _sum
|
||||
params:
|
||||
declare a: int
|
||||
declare b: int
|
||||
returns: int
|
||||
body:
|
||||
return a + b
|
||||
end body
|
||||
end function
|
||||
end module
|
||||
11
playground/Demo/Demo22/OS.snow
Normal file
11
playground/Demo/Demo22/OS.snow
Normal file
@ -0,0 +1,11 @@
|
||||
module: os
|
||||
import: os
|
||||
function: print
|
||||
params:
|
||||
declare i1: int
|
||||
returns: void
|
||||
body:
|
||||
syscall("PRINT",i1)
|
||||
end body
|
||||
end function
|
||||
end module
|
||||
Loading…
x
Reference in New Issue
Block a user