feat: add ascii and newline prints

fix(Evaluator): issue over variable reducing priority
This commit is contained in:
Matthieu Bessat 2022-05-15 22:40:20 +02:00
parent 738d16f2fc
commit c3af6bd5ca
10 changed files with 114 additions and 21 deletions

View file

@ -1,9 +1,13 @@
set a to 1
# print the 20 first fibonacci numbers
set n to 20
set a to 0
set b to 1
print_number(a)
set i to 0
while i < 10 do
set c to a
while i < (n-1) do
set _a to a
set a to a+b
set b to c
print_number a
set b to _a
print_number(a)
set i to i+1
end

15
examples/hello_world.ltor Normal file
View file

@ -0,0 +1,15 @@
# print hello world using asci value (not very practical)
print_ascii(72)
print_ascii(101)
print_ascii(108)
print_ascii(108)
print_ascii(111)
print_ascii(44)
print_ascii(32)
print_ascii(119)
print_ascii(111)
print_ascii(114)
print_ascii(108)
print_ascii(100)
print_ascii(33)
print_newline()

7
examples/while_demo.ltor Normal file
View file

@ -0,0 +1,7 @@
set i to 0
while 1 do
if i > 10 then
break
end
set i to i+1
end