Java Interpreter for reCall, a Programming Language

Around 2-3 weeks ago, I decided to create my own programming language and to write an interpreter for it in Java. Now, after fixing many bugs, the interpreter and the language documentation is finally finished. The whole project, called reCall, is available here, on GitHub. The whole experience was very interesting because I looked at many other programming language (even esoteric ones) and examined their syntax.

The interpreter uses two levels of recursion, one to handle recursion in reCall, and another to recursively parse each expression. The whole thing uses a stack based memory system for defined variables and functions. That allows reCall to handle different scopes in user defined functions and if/else statements. For/while loops are not explicitly present because who needs loops when you have recursion? (just kidding) There are many “functional” functions like map, filter, and reduce that have implicit loops.

Math is almost arbitrary precision, where there can be 100 digits of precision, but the exponent can be very large or very small. I got kind of lazy, so some mathematical functions like log and sin only produces around 14-15 digits of precision… But hey, 100 digits of PI and E are built-in for fun!

There is also an eval function just in case security is not an issue. (just kidding again)

Since I was bored a few days ago, I also added support for simple object oriented programs. Classes that contains variables and functions can be created and initialized. Those variables can also be static or non-static. That allows reCall to be pretty flexible! Unfortunately, the code is quite a mess now…

Thanks for reading and be sure to check out the GitHub repo!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s