A Python-based, forest-themed programming language. Now in Alpha!
Aleks | Anna | James | Joe | Lucian |
- Ensure you have Python v3.7.4 installed.
- Clone or download this repository.
$ python3 forest.py
will open a little Forest REPL. You should see a =❱❯❭>
tree in your command line prompt.
Install code coverage tool:
$ pip3 install coverage
We've included a script to run all tests and code coverage (recommended):
$ bash test_script
Read the output on the console, and open the htmlcov/index.html file to view details of coverage.
run the command below specifiying the test file to be included.
$ python3 -m unittest interpreter_test.py
Run the code coverage report:
$ coverage interpreter_test.py
$ coverage html
- echo any text within
<<tree tops>>
withecho<<this message>>
- use the owl operators for comparison of integers:
4^OvO^5
should returnfalse
;5^XvX^6
should returntrue
- use the crow operator to calculate modulus of integers:
9^(*)>^2
should return1
- if statement: start your if statement with
WALK_PATH_IF_SEE
and end withCAMP
- TODO: create variables
BACKPACK:myvar^PACK_WITH^<<some text>>
- use
^
trees between operators and expressions (as you would with spaces in most programming languages) to avoid errors - but if you do end up with errors, we've added lots of unhelpful but entertaining bears to the error messages 🐻
$ WALK_PATH_IF_SEE^30^(*)>^15^OvO^0^echo^<<fizzbuzz>>^
$ WALK_PATH_IF_SEE^6^(*)>^3^OvO^0^echo^<<fizz>>^
$ WALK_PATH_IF_SEE^10^(*)>^5^OvO^0^echo^<<buzz>>^CAMP
Forest | Forest explicit | Human |
---|---|---|
<<>> | shovels/tree tops | string delimiters |
^ | tree operator | space/general delimiter |
OvO | Owl operator | == equals/comparison |
XvX | Dead owl operator | != not equal |
(*)> | Crow operator | % modulo |
^._.^ | Bat operator | (sadly unused but LOOK HOW COOL IT IS! TODO for version 2.0) |
WALK_PATH_IF_SEE | do this if | if statement start |
BACKPACK: | create backpack | variable instantiation |
PACK_WITH | store in backpack | = variable assignment |
CAMP | end statement | end of expression |
true/false | acceptable booleans |
The diagram below shows how our interpreter is built:
Take care, and don't start a fire. ʕ•ᴥ•ʔノ♡