2312deec5b
Small refactoring for parser
2022-02-09 01:13:22 +01:00
948d41fb45
Update lexer tests
2022-02-09 00:20:56 +01:00
fdef796440
Update token macros
2022-02-08 23:26:23 +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
c723b1c2cb
Rename var in parser
2022-02-06 15:31:41 +01:00
e7b67d85a9
Add game of life example
2022-02-05 11:53:01 +01:00
cf2e5348bb
Implement arrays
2022-02-04 18:48:45 +01:00
8b67c4d59c
Implement block scopes (code inside braces)
...
- Putting code in between braces will create a new scope
2022-02-04 17:30:23 +01:00
cbf31fa513
Implement simple AST optimizer
...
- Precalculate operations only containing literals
2022-02-04 17:06:38 +01:00
56665af233
Update examples
2022-02-04 14:25:25 +01:00
22634af554
Precalculate stack positions for variables
...
- Parser calculates positions for the variables
- This removes the lookup time during runtime
- Consistent high performance
2022-02-04 14:25:25 +01:00
d4c6f3d5dc
Implement string interning
2022-02-04 14:25:23 +01:00
4dbc3adfd5
Refactor Ast to ScopedBlock
2022-02-04 14:24:03 +01:00
cbea567d65
Implement vec based scopes
...
- Replaced vartable hashmap with vec
- Use linear search in reverse to find the variables by name
- This is really fast with a small number of variables but tanks fast
with more vars due to O(n) lookup times
- Implemented scopes by dropping all elements from the vartable at the
end of a scope
2022-02-04 14:24:00 +01:00
e4977da546
Use euler examples as tests
2022-02-04 12:45:34 +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
c2b9ee71b8
Add project euler example 5
2022-02-03 16:16:38 +01:00
f8e5bd7423
Add comments to parser
2022-02-03 16:01:33 +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
264d8f92f4
Update README
2022-02-02 19:40:10 +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
8cf6177cbc
Update README
2022-02-02 19:15:20 +01:00
39bd4400b4
Implement logical not
2022-02-02 19:14:11 +01:00
75b99869d4
Rework README
...
- Add full language description
- Fix variable name inconsistency
2022-02-02 19:00:14 +01:00
de0bbb8171
Implement logical and / or
2022-02-02 18:56:45 +01:00
92f59cbf9a
Update README
2022-02-02 16:48:26 +01:00
dd9ca660cc
Move ast into separate file
2022-02-02 16:43:14 +01:00
7e2ef49481
Move token into separate file
2022-02-02 16:40:05 +01:00
86130984e2
Add example programs (project euler)
2022-02-02 16:26:37 +01:00
c4b146c325
Refactor interpreter to use borrowed Ast
...
- Should have been like this from the start
- About 9x performance increase
2022-02-02 16:24:42 +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
02993142df
Update README
2022-01-31 23:49:22 +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
3098dc7e0a
Implement simple CLI
...
- Implement running files
- Implement interactive mode
- Enable printing tokens & ast with flags
2022-01-31 16:24:25 +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
b7872da3ea
Move grammar def. to README
2022-01-29 21:54:05 +01:00
5cc89b855a
Update grammar
2022-01-29 21:52:31 +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
5ffa0ea2ec
Update README
2022-01-29 21:18:08 +01:00
2a59fe8c84
Implement unary negate
2022-01-29 21:12:01 +01:00
8f79440219
Update README
2022-01-29 20:52:30 +01:00