A simple, compiled language for the ti83+/ti84+.
This program compiles a program in a small language to assembly, which needs to be compiled using spasm-ng.
Requirements:
- OCaml
- spasm-ng, modify run.sh to use the location where you placed spasm-ng
- the ti83+ include header (place it in
out/ti83plus.inc), this is also included by default in theincfolder of spasm-ng- on ticalc.org (download
ti83plus.zip) - on AsmPrgm in 28 days (download
ti83plus.inc) - on github/konaboy32/ti-asm (download the file)
- on ticalc.org (download
To build: dune build
To run: dune exec tila [program] [output.s], test.tp is a small reference program you can use. You need to use spasm-ng to compile the generated assembly to a 8xp file (example: spasm out.s out.8xp).
The language is still in relatively early stages, you can see the things I want to implement in reference.tl. The currently existing features are outlined below. Keep in mind that this language has no semicolons.
You can use comments using //.
You can create a global variable using global [type] [name] = [value]. The types are string, u8, and u16. For example: global u16 x = 140.
You can create a function using fn [name]() { ... code ... }. Arguments aren't supported yet, so you will need to use global variables for now. The main function is the starting point for the program.
You can call a function using [name]().
You can use conditionals using if [expression] { ... code ... } with an optional else { ... code ... }. For now you can check for equality.
There are a few built in functions:
print([string variable])go_home()put the cursor for text printing on 0, 0clear_lcd()clear the lcd
Short term:
- parse the program
- build an ast
- generate the assembly
- output the assembly
- write a script to compile the assembly
- test it!
- add more features
- mutating variables
- if/else statements
- ==
- fix variables: they are 8bit instead of 16bit
- >, <, >=, <=
- for/while loops
- math (+, -, >, <, ==, ...)
- stack allocated sprites
- variables
- more default functions: getkey, ...
- advanced math (*, /, ...; this is more difficult to implement on the ti84)
Long term:
- output an executable instead of assembly
- better error messages
- arguments for functions
- asyncio multithreading