18 Commits

Author SHA1 Message Date
5af9845f93 Add command line arguments and make time printing nicer
This patch adds the following arguments:

1. `--dump-ast` or `-d`: This dumps the Abstract Syntax Tree
2. `--dont-emit-llvm` or `-L`: This skips the LLVM generation step only
   parsing and type checking. Useful for debugging.

Besides this, formatting of the time each compiler step took is also
improved and easier to read now.

Signed-off-by: Slendi <slendi@socopon.com>
2024-05-04 13:27:25 +02:00
ee979eb216 Add performance benchmarks
This patch shows the time it took to parse and type check a program
which can be great to know where to optimize.

Signed-off-by: Slendi <slendi@socopon.com>
2024-05-03 23:48:37 +02:00
2e38b9dabc Make the type checker recognize enum definitions
This patch makes it such that if you define an enum inside of a scope,
the type checker will remember it. There is currently no support for
field accesses.

Signed-off-by: Slendi <slendi@socopon.com>
2024-04-30 10:46:00 +03:00
95057fd359 Add support for enums in the parser
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-29 16:42:28 +03:00
24967b3eb7 Remove commented out code
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-17 13:18:08 +03:00
4782252f7e Add support for prefix increment/decrement ops
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-11 09:20:15 +03:00
f65507c5e1 Add support for assign stacking
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-10 19:26:20 +03:00
1caebf3295 Do stuff
I forgor

Signed-off-by: Slendi <slendi@socopon.com>
2024-04-10 11:34:43 +03:00
66faf71ec7 Add support for struct field accesses
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-09 02:24:45 +03:00
a966ff45a3 Improve messages, implement* field access
Compiler messages are now printed in color with their respective code,
field access support has been added in the type checker. However, field
access nodes that contain other field access nodes are not yet
supported.

Signed-off-by: Slendi <slendi@socopon.com>
2024-04-08 11:42:39 +03:00
64034e9086 Various improvements 2024-03-02 23:14:45 +02:00
3f2ee15302 Add support for while loops 2024-03-02 21:47:36 +02:00
5dc73ab5f2 Update gitignore, add support for arrays and pointers
Signed-off-by: Slendi <slendi@socopon.com>
2024-03-01 12:21:44 +02:00
def0e2b8e0 Remove binary
Signed-off-by: Slendi <slendi@socopon.com>
2024-02-29 14:23:13 +02:00
5455919d6e LLVM my beloved
Signed-off-by: Slendi <slendi@socopon.com>
2024-02-29 14:04:28 +02:00
484d1a6e2c Add support or extern function
Signed-off-by: Slendi <slendi@socopon.com>
2024-02-29 09:29:21 +02:00
ed1491d6dd Add LLVM
Signed-off-by: Slendi <slendi@socopon.com>
2024-02-28 17:24:40 +02:00
78c8e50bbf Move code to separate folder
Signed-off-by: Slendi <slendi@socopon.com>
2024-02-28 15:07:08 +02:00