A minimal programming language
honeyscript is a javascript based minimal programming language. It has features such as artihmetic functions, output, lambda functions etc.
this is the structure of execution:
.honey file -> parse.js -> .ast file -> generate.js -> .js file -> node -> result
git clone https://github.com/tanmayhinge/honeyscript.git
.. This will download all files necessary for you to start writing honeyscript.hello.honey
in the root of ./honeyscript/
foldernpm run honey hello.honey
hello.honey
out("Hello World!")
Below are some more honeyscript code-examples that cover all the features of honeyscript.
math.honey
// comments can also be written like this
a = 5
b = 3
out(add(3 5)) // note how the nesting of brackets is done:)
out(sub(3 5))
out(mul(3 5))
out(div(3 5))
if.honey
a = 3
b = 3
if(eq(a b)
()=>
out("a equals b")
()=>
out("a not equal to b")
)
lambda.honey
solve = (n) =>
if(eq(n 3)
() => 0
() =>
sub(n 3)
)
result = solve(10)
out("The answer is" result)
// call solve() function and pass n=10
// compares if n equals 3
// if yes, return 0
// else
// return n-3
//print result
feel free to fork and send a pull-request..
secret: checkout the library.js
file, that can be easily expanded