- Comments are written as
/followed by the comment text and ending with/ /This is a comment/will be ignored by the interpreter.
- Represented as nested brackets
- 0 -> [] (equivalent to group of no statements)
- 1 -> [()]
- 2 -> [()()]
- 3 -> [()()()]
- ...
&(equivalent to+1)*(equivalent to-1)
{x}()[y]- set value of variablextoy{x}[]- get value of variablex{x}(y)[z]- define functionxwith argumentsyto return valuez{x}[y]- call functionxwith argumentsy- statements can be grouped using
[](value of a group is the value of the last statement in it) - value of definition of variable is the value it is being set to.
- value of definition of function is 0.
[x] | [y] | [z]- ifx != 0thenyelsez
- Valid bracket nestings only, e.g.
(),(()),(()()),(()(())), etc.
<try_block|catch_block>- if error is encountered while executingtry_block, execute continues fromcatch_blockinstead.
<x>- print x as a number<x|>- print x as a character- Value of the statement is the value of
x
/Define a function named (()()) to add two numbers let's say add(x,y)/
{(()())}( () (()) ) [
[ {(())}[] ] | /if y is not 0/
[ {(()())} [ &{()}[] *{(())}[] ] ] /then return value of add(x+1, y-1)/
|
[ {()}[] ] /else if y is 0 return x/
]
/Calling the function on 5 and 6/
{(()())}[ [()()()()()] [()()()()()()] ]
/addition function/
{(()())}( () (()) ) [
[ {(())}[] ] |
[ {(()())} [ &{()}[] *{(())}[] ] ]
|
[ {()}[] ]
]
/Helper function say mul_help(x,y,acc)/
{(()()()())} ( () (()) ((())) ) [
[ {(())}[] ] | /if y is not 0/
[ {(()()()())} [ /call mul_help(x, y-1, acc+x)/
{()}[] /x/
*{(())}[] /y-1/
{(()())} [ /add(acc, x)/
{((()))}[]
{()}[]
]
]
]
| /if y is 0/
[ {((()))}[] ] /return acc/
]
/Multiplication function say mul(x,y)/
{(()()())} ( () (()) ) [
{(()()()())} [ {()}[] {(())}[] [] ] /mul_help(x, y, 0)/
]
{(()()())} [ [()()()()()()] [()()()()()()()()]] /mul(6,8)/
- Clone the repository
- Run
cargo build --release --target webin the root directory - Run
npm install ../pkgin thesitedirectory - Run
npm servein thesitedirectory - And Done! That's it, you can now run the interpreter in your browser at
http://localhost:8080/orhttp://localhost:3000/whichever is given by thenpm servecommand.