2880ba81ab
Implement break & continue
...
- Fix return propagation inside loops
2022-02-10 13:13:15 +01:00
aeedfb4ef2
Implement functions
...
- Implement function declaration and call
- Change the precalculated variable stack positions to contain the
offset from the end instead of the absolute position. This is
important for passing fun args on the stack
- Add the ability to offset the stackframes. This is used to delete the
stack where the fun args have been stored before the block executes
- Implement exit type for blocks in interpreter. This is used to get the
return values and propagate them where needed
- Add recursive fibonacci examples
2022-02-10 01:26:11 +01:00
948d41fb45
Update lexer tests
2022-02-09 00:20:56 +01:00
926bdeb2dc
Refactor lexer match loop
2022-02-08 22:54:41 +01:00
726dd62794
Big token refactoring
...
- Extract keywords, literals and combo tokens into separate sub-enums
- Add a macro for quickly generating all tokens including the sub-enum
tokens. This also takes less chars to write
2022-02-08 18:56:17 +01:00
cf2e5348bb
Implement arrays
2022-02-04 18:48:45 +01:00
588b3b5b2c
Autoformat
2022-02-03 17:38:25 +01:00
f6152670aa
Small refactor for lexer
2022-02-03 17:25:55 +01:00
d7001a5c52
Refactor, Comments, Bugfix for lexer
...
- Small refactoring in the lexer
- Added some more comments to the lexer
- Fixed endless loop when encountering comment in last line
2022-02-03 00:44:48 +01:00
bc68d9fa49
Add Result + Err to lexer
2022-02-02 21:59:46 +01:00
d8f5b876ac
Implement String Literals
...
- String literals can be stored in variables, but are fully immutable
and are not compatible with any operators
2022-02-02 19:38:28 +01:00
39bd4400b4
Implement logical not
2022-02-02 19:14:11 +01:00
de0bbb8171
Implement logical and / or
2022-02-02 18:56:45 +01:00
7e2ef49481
Move token into separate file
2022-02-02 16:40:05 +01:00
7b6fc89fb7
Implement if
2022-02-02 16:19:46 +01:00
8c9756b6d2
Implement print keyword
2022-02-02 14:05:58 +01:00
3348b7cf6d
Implement loop keyword
...
- Loop is a combination of `while` and `for`
- `loop cond { }` acts exactly like `while`
- `loop cond; advance { }` acts like `for` without init
2022-01-31 16:58:46 +01:00
e0c00019ff
Implement line comments
2022-01-29 23:29:09 +01:00
35fbae8ab9
Implement multi statement code
...
- Add statements
- Add mandatory semicolons after statements
2022-01-29 23:18:15 +01:00
23d336d63e
Implement variables
...
- Assignment
- Declaration
- Identifier lexing
2022-01-29 22:49:15 +01:00
39351e1131
Slightly refactor lexer
2022-01-29 21:59:48 +01:00
32e4f1ea4f
Implement relational binops
2022-01-29 21:48:55 +01:00
b664297c73
Implement comparison binops
2022-01-29 21:37:44 +01:00
ea60f17647
Implement bitwise not
2022-01-29 21:26:14 +01:00
128b05b8a8
Implement parenthesis grouping
2022-01-29 20:51:55 +01:00
a569781691
Implement more operators
...
- Mod
- Bitwise Or
- Bitwise And
- Bitwise Xor
- Shift Left
- Shift Right
2022-01-27 23:15:16 +01:00
0b75c30784
Implement div & sub
2022-01-27 22:29:06 +01:00
ed2ae144dd
Number separator _
2022-01-27 21:38:58 +01:00
ef4dee98dc
Add test for parser
2022-01-02 21:28:36 +01:00
541d905551
Start implementing Parser
...
- Implemented pratt parser for expressions
- Implemented BinOps Add, Mul
2022-01-02 21:03:14 +01:00
02f63ad9ad
Add test for lexer
2022-01-02 18:49:18 +01:00
01729beb5f
Start implementing lexer
2022-01-02 18:44:05 +01:00