parseManager/parsetest2.txt

74 lines
1.3 KiB
Plaintext

-- 감사합니다
ENTRY START
[START]{
a=10>1 -- bit shift
b=10<1
"test: $a$ $b$"
testfunc("hello",(5!),(2!)+2)
-- "Hello It is now time to do some tests!"
-- a=15
-- "a = $a$"
-- b=a@25
-- test2="Yo $a$ $b$" -- create a string with a and b vars
-- "$test2$"
-- "b = $b$"
-- c=5
-- "c = $c$"
-- cf=10+(5!)+10
-- test=(5~5)+5
-- "c! = $cf$ test = $test$"
-- "All done"
-- JUMP(NOVAR)
}
[@: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::
}
-- 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=ret<-env
return(ret)
}
[NOVAR]{
::go::
"I AM HERE!!!"
NOVAR="TEST"
JUMP(START)
}
[TEST]{
"We are now here"
}