Turtle is a tiny little language. It has a lexer, (semi-working) parser and an 'evaluator' for parsing mathematical expressions.
Turtle has little to no functionality. It's a barebones interpreter for maths. That's it. It does support: addition, subtraction, multiplication and division. It does also support variables. Here's how it looks like:
1 + 1 // addition
10 - 5 // subtraction
10 / 2 // division
2 * 6 // multiplication
a = 5 // declare variables
b = 10 // can be any word letter etc.
5 + a // use variable
5 + a - b + 6 // complex expression
Basic Functionality
- Addition
- Subtraction
- Multiplication
- Division
- Basic Variables
- Variable Expressions
- Parentheses
Extended Functionality
- Variable Mutability
- Loops
There is a lot of issue with the interpreter at the moment. Such as:
Variable Mutability
This isn't implemented. You can't reassign variables.
Variable Expressions
Can't use mathematical expressions on just variables x + b
returns an error.
Any type of Parentheses Operations
They just don't work.
To install and build this you will need to install the latest version of Go. The repo has a build script for Windows PowerShell as it is my primary shell. I will add a build script for Linux and Mac in the future if I do anything with this.
- Firstly, clone the repo via:
git clone https://github.com/dxtrity/Turtle.git .
- Then run:
./build.ps1
- Finally, run this script:
./test.ps1
And if all goes well. You should be fine. I hope.
The build.ps1
script builds the executable inside of the build folder. Make sure that you have a test.tl
in that folder for running and testing expressions. The test.ps1
script just runs the executable with the correct file. Feel free to edit these to your liking.