Commit Graph

153 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 3fccf2fa5a Removed debug print 2022-09-29 22:44:48 +02:00
Tristan B. Velloza Kildaire 3d54c4deee Removed assertions which are guaranteed to pass now (since the last fix of 449e878796) 2022-09-18 21:54:31 +02:00
Tristan B. Velloza Kildaire 449e878796 Fixed bug when processing the body of a class and a DNode was hit which was not one of the allowed types:
1. VariableDeclaration

Previously we added back the `varDecInstr` which is post-cast and if the cast failed (hence hitting this !varDecInstr branch) we didn't add back `instr` but rather added back `varDecInstr` which is 0 instead of being non-zero.

This later is incorrect.
2022-09-18 21:52:11 +02:00
Tristan B. Velloza Kildaire a8f93e5817 Cleaned up comments for number literal code gen and type checking handling 2022-08-19 11:42:19 +02:00
Tristan B. Velloza Kildaire 7e49cf1d0a Added float support
- Added float constant support to the lexer
- Added float support to the typechecker to build the correct Instruction type

Unit tests

- Added unit test for a bad example of a malformed encoded floating point to test out the lexer
2022-08-11 10:26:30 +02:00
Tristan B. Velloza Kildaire 4488678d3e Code cleanup 2022-07-26 10:10:43 +02:00
Tristan B. Velloza Kildaire 18411c48c4 Removed TODO 2022-07-26 10:07:03 +02:00
Tristan B. Velloza Kildaire d19512668a Pass StringLiteral instruction extracted string literal from StringExpression synmbol
Removed TODO
2022-07-26 09:59:27 +02:00
Tristan B. Velloza Kildaire 6cfca2cea2 Added `addInstr()` for StringExpression handling (String literals)
Bug fixed whenever a "" is encountered
2022-07-25 19:30:40 +02:00
Tristan B. Velloza Kildaire ca2fa84057 Added support for Pointer type resolution via `getType()`. Now `char**` -> Pointer("char*"), which before construction of such a Pointer is recursively resolved, so nested Pointer(Pointer(...)) 2022-07-25 19:15:27 +02:00
Tristan B. Velloza Kildaire f571115c23 Added some possible todos, might not need to do any of them but I also might 2022-04-13 09:50:24 +02:00
Tristan B. Velloza Kildaire 2ed6a4834d Cleaned up 2022-04-12 11:11:54 +02:00
Tristan B. Velloza Kildaire aff0da5116 Added codegen/typecheck support for unary operator expressions 2022-04-12 10:54:04 +02:00
Tristan B. Velloza Kildaire cd54753359 cleaned up 2022-04-08 01:18:12 +02:00
Tristan B. Velloza Kildaire d79b9eee5c Debugging things 2022-04-08 01:12:52 +02:00
Tristan B. Velloza Kildaire ba63f85df9 Binary operator expressions now work 2022-02-20 16:37:45 +02:00
Tristan B. Velloza Kildaire 6222aabc8b Pop types off for Binary Operator typechecking 2022-02-20 16:21:29 +02:00
Tristan B. Velloza Kildaire de31585bcc Cleaned up 2022-02-20 16:05:15 +02:00
Tristan B. Velloza Kildaire 475983dd95 Cleaned up 2022-02-20 16:04:53 +02:00
Tristan B. Velloza Kildaire 492074119d Added sub-instructions to FuncCallInstr being built 2022-02-20 15:35:34 +02:00
Tristan B. Velloza Kildaire 18eba51144 Remove uneeded reversal code 2022-02-20 14:28:31 +02:00
Tristan B. Velloza Kildaire 4677cacdf1 I think it works now as the types are in the same order as instructions
So I guess that works
2022-02-20 14:27:56 +02:00
Tristan B. Velloza Kildaire 76f0d6e1a9 Changed `addType(Type)` to add types to the front of the type queue
Added `addTypeB(Type)` to add Types to the end of the type queue
2022-02-20 14:24:05 +02:00
Tristan B. Velloza Kildaire 4b53823d9c Added `isTypesEmpty()` 2022-02-20 12:09:10 +02:00
Tristan B. Velloza Kildaire abe72f45a7 WIP 2022-02-19 11:54:00 +02:00
Tristan B. Velloza Kildaire a84e0dfe20 Some stuff, working on getting function calls working 2022-02-18 14:32:45 +02:00
Tristan B. Velloza Kildaire 71efb7ae8f Fixed dependency generation for function call paremeters (expressions) 2022-02-16 07:31:22 +02:00
Tristan B. Velloza Kildaire aa5e82fe09 Added stub funccallinstr add to sotp segmentation fault on funciton calls being processed 2022-02-15 15:04:16 +02:00
Tristan B. Velloza Kildaire b5488d5c92 Stuff 2022-01-20 10:43:12 +02:00
Tristan B. Velloza Kildaire 49de425e45 Static initialization for classes, including class memory allocation and then static variable (member) initialization has now been implemented for the code generator 2021-11-11 12:48:49 +02:00
Tristan B. Velloza Kildaire 3a32ecfea5 Or do it like that 2021-11-11 12:31:42 +02:00
Tristan B. Velloza Kildaire a45d2bc30b Variable's name is full path so resolve from the module 2021-11-11 12:30:40 +02:00
Tristan B. Velloza Kildaire 3da50e9eab Got some sort of class allocator node created, now to re-order it by using Context to be able to know when the StaticVariableDeclaration is within class.
This then generates code to allocate space for the class, once done we can be assured the declarations (placed after it now) will be assigning to properly allocated space (paged and maped for example)
2021-11-10 17:15:27 +02:00
Tristan B. Velloza Kildaire 6ed33a8051 Done with work for today, good refactoring, now to work on class static initoialization.
Instance initialization and unique-ness, and same for Functions with their "FunctionData" will come later
2021-11-10 17:00:56 +02:00
Tristan B. Velloza Kildaire 47edb41e17 Seems like generalised generalPass() is working 2021-11-10 16:42:15 +02:00
Tristan B. Velloza Kildaire 3eddf73b7b Added some stuff
FunctionData adding, some generation stuff, but reworking to make a general pass function
2021-11-10 16:17:42 +02:00
Tristan B. Velloza Kildaire 60f490d8e8 Refactored dependency tree generation code (and all related modules) to its own directory 2021-11-09 19:16:51 +02:00
Tristan B. Kildaire de261ec511 Copy Context information from the ParserNode across to the Instruction node (only so far for Module Variable Declaration DNodes' embedded PNode 2021-11-09 15:50:04 +02:00
Tristan B. Velloza Kildaire 3dba481260 Refactored code emitter sub-system 2021-11-02 10:41:03 +02:00
Tristan B. Kildaire ad5e26602f Removed unused method 2021-11-02 09:43:02 +02:00
Tristan B. Kildaire 7a78a4e5b1 Removed old cruft 2021-11-02 09:42:50 +02:00
Tristan B. Kildaire 12087b8fdf Removed old VTReeNode commented-out code 2021-11-02 09:42:21 +02:00
Tristan B. Kildaire 60b97f90aa Removed unused commented code 2021-11-02 09:41:30 +02:00
Tristan B. Kildaire 9987c46497 Re-enabled a unit test for the type checker 2021-11-02 09:36:15 +02:00
Tristan B. Kildaire 1731ae3299 Re-enabled a unit test for the type checker 2021-11-02 09:35:48 +02:00
Tristan B. Kildaire c8ccc71244 Re-enabled a unit test for the type checker 2021-11-02 09:35:27 +02:00
Tristan B. Kildaire bbd34a951a Re-enabled unit test for type checker 2021-11-02 09:34:57 +02:00
Tristan B. Kildaire 36f073fbff Re-enabled two unit tests for the type checker 2021-11-02 09:34:40 +02:00
Tristan B. Kildaire 71be300582 Disabled a lot of old typechecking code that we either don't need or I am not working with right now 2021-11-02 09:32:52 +02:00
Tristan B. Velloza Kildaire 0081277fb1 Cleaned up typechecking (codegen) 2021-10-27 21:12:00 +02:00