summaryrefslogtreecommitdiff
path: root/README.md
blob: a9d8876c52b2898ca9afafcc593694c9ac0ee00f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# tnsl-parse

The tokenizer for the [TNSL Language](https://github.com/CircleShift/tnsl-lang).  Written in Go for the moment.

The goal is to get this part written, and then write a backend for any arch (x86, arm, risc-v, etc.).
After that, work can begin on the real parser/compiler which will be written in native TNSL

## interpreter

This project was originally supposed to form a go based compiler for the language, but in the interest of time, it seems more efficient to build an interpreter instead so we can work on the TNSL based compiler sooner.

To build the parser:

    ./gobuild.sh parse

To build the interpreter:

    ./gobuild.sh tint

Binaries will be dumped in the "build" folder.

## Status

    Parser: sorta works sometimes (subtext: AST generater is at least a little broken, but works for at least some use cases)
    Interpreter: broken

## TODO

What works
- Variable definition
- Array definition
- Struct definition
- Control flow blocks (`if` and `loop` specifically)

What does'nt work
- `else`
- Function Calls
- Getting struct members
- Array indexing
- Appending to arrays

## Usage

Once you have built the parser, it can be invoked in the build folder with `./parse`.  The cli options are as follows:

- `-writelevel <0, 1, or 2>` tells the parser at what stage it should stop parsing and output a file.
	- `0` will output the list of tokens generated by the tokenizer.
	- `1` will output the Abstract Syntax Tree as generated by the parser.
	- `2` will output a "virtual program".  This is what the interpreter acts on.
	- The default value is `1`

- `-in <file>` tells the parser what file to parse. This is the only manditory option.

- `-out <file>` tells the parser where to write the data.  The default is `out.tnt`.

### Other notes

With some of the code I've written, I'm kinda supprised that this even compiles.

tint is short for Tnsl INTerpreter