parseManager/parsetest2.txt
Ryan Ward f180fef6fb Massive changes to this.
Now compiles code then runs it! Total engine overhaul
2018-06-09 15:04:21 -04:00

66 lines
1.1 KiB
Plaintext

ENTRY START
[START]{
a=10>1
b=10<1
"test: $a$ $b$"
test["name"]="Ryan"
name=test["name"]
"Hi $test[name]$! $name$"
testfunc("hello",(5!),15@1)
test("hello",sqrt(5!),(15@1)/2)
}
[@:construct]{ -- get % out of 100
ret=l/(r/100)
return(ret)
}
[>:construct]{ -- get % out of 100
ret=rshift(l,r)
return(ret)
}
[<:construct]{ -- get % out of 100
ret=lshift(l,r)
return(ret)
}
[~:construct]{ -- negate variable
if r~=NONE then GOTO(sub)|GOTO(neg)
::sub::
ret=l-r
return(ret)
GOTO(end)
::neg::
ret=0-r
return(ret)
::end::
}
[test:function(a,b,c)]{
"$a$ $b$ $c$"
}
-- You dont have too many symbols left to use though. For now a symbol is only 1 char long so you are limited
[fact:function(n)]{
count=1
stop=n
::loop:: -- for loop kinda, can become a stateloop as well
n=n*count
count=count+1
if count==stop then GOTO(end)|GOTO(loop)
::end::
ret=n
}
[neg:function(n)]{
ret=n*(0-1)
}
--Bind the fact function to the symbol '!'
[!:construct]{
env=fact(l)
ret=env["ret"]
return(ret)
}
[NOVAR]{
::go::
"I AM HERE!!!"
NOVAR="TEST"
JUMP(START)
}
[TEST]{
"We are now here"
}