Add some code examples that I used as test cases during implementation

This commit is contained in:
Bananymous 2024-04-30 01:29:09 +03:00
parent 83c560b2a9
commit 0508bde07c
10 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,16 @@
print 1 + 1,
print 10 - 5,
print 5 - 10,
print -5 + 2,
print -5 - 5,
print -5 - -5,
print 2 * 3,
print 2 * -3,
print -2 * 3,
print -2 * -3,
print 10 / 2,
print 10 / -2,
print -10 / 2,
print -10 / -2,
print 2024-04-27 - 5,
print 2024-04-27 + 5

View File

@ -0,0 +1,19 @@
var date = Today()
print date,
print date'day,
print date'month,
print date'year,
print date'weekday,
print date'weeknum,
date.day = 2,
date.month = 3,
date.year = 2'000,
print date,
print date'day,
print date'month,
print date'year,
print date'weekday,
print date'weeknum

View File

@ -0,0 +1 @@
print 1+1+1+1+1+1+1+1+1+1

View File

@ -0,0 +1 @@
print 1 + 2 - 3 + 5 - 7 + 11 - 13 + 17 - 19

View File

@ -0,0 +1,18 @@
var nn = 1'000'000'000
var count = 0
var sum = 0
function Func{ second_number[int] } return int
is
(second_number + 3) * 5
end function
(% Calculate sum with a loop %)
do
do
sum = sum + Func(count),
count = count + 1
until nn < count
unless nn = 0 done,
print "Sum from 0 to" & nn & "is" & sum

View File

@ -0,0 +1,6 @@
var num = -10
do
print num,
num = num + 1
until num = 11

View File

@ -0,0 +1,4 @@
print "hello" & "world",
print 10,
print 2024-04-27,
print Today() - 365*100

View File

@ -0,0 +1,6 @@
procedure PROC{ arg1[int], arg2[int], arg3[int], arg4[int], arg5[int] }
is
print arg1 & arg2 & arg3 & arg4 & arg5
end procedure
PROC(1, 2, 3, 4, 5)

View File

@ -0,0 +1,11 @@
procedure PROC{ }
var var1 = 1
var var2 = 2
var var3 = 3
var var4 = 4
var var5 = 5
is
print var1 & var2 & var3 & var4 & var5
end procedure
PROC()

View File

@ -0,0 +1,9 @@
var foo = 20
var bar = 10
print foo + bar,
print foo - bar,
print foo * bar,
print foo / bar,
print (foo + (foo + (foo + (foo + bar))))