test: 添加 Demo18 项目
This commit is contained in:
parent
7395256b5a
commit
2f16dd2749
43
playground/Demo/Demo18/Main.snow
Normal file
43
playground/Demo/Demo18/Main.snow
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
return_type: int
|
||||||
|
body:
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i:int = 1
|
||||||
|
cond:
|
||||||
|
i <= 5
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
if i % 2 == 0 then
|
||||||
|
continue
|
||||||
|
end if
|
||||||
|
if i > 3 then
|
||||||
|
break
|
||||||
|
end if
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare j:int = 1
|
||||||
|
cond:
|
||||||
|
j <= 5
|
||||||
|
step:
|
||||||
|
j = j + 1
|
||||||
|
body:
|
||||||
|
if j == 4 then
|
||||||
|
break
|
||||||
|
end if
|
||||||
|
if j % 2 == 0 then
|
||||||
|
continue
|
||||||
|
end if
|
||||||
|
print(i)
|
||||||
|
print(j)
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo18/OS.snow
Normal file
11
playground/Demo/Demo18/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
parameter:
|
||||||
|
declare i1: int
|
||||||
|
return_type: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
Loading…
x
Reference in New Issue
Block a user