Commit Graph

526 Commits (7f29828081691f6272061928d3ec35fb1f3398c5)

Author SHA1 Message Date
Tristan B. V. Kildaire 7f29828081 Added negative test case 2021-10-27 21:30:22 +02:00
Tristan B. V. Kildaire 0081277fb1 Cleaned up typechecking (codegen) 2021-10-27 21:12:00 +02:00
Tristan B. V. Kildaire bbf174b757 Added weighting such that `getStatements()` can be ordered more easily. Many weights are still missing but the things I am testing with now are atleast here.
Added check for standalone variable assignments to error (crash) the compiler when the variable has not yet been declared.

I still need to clean up the codegen and add back in typechecking, the thing has become weird with many weird function calls, but I can do it in one function call to be honest (and that makes most sense)

Standalone variable assignments are now in the dependency tree and therefore make it into the typechecking/codegen phase (of which code to handle them has also been added)
2021-10-27 20:57:30 +02:00
Tristan B. V. Kildaire 47375cbec4 Beginning to work on weighting system 2021-10-27 15:52:43 +02:00
Tristan B. V. Kildaire 0bceb16373 Added toString for VariableAssignment 2021-10-27 15:33:24 +02:00
Tristan B. V. Kildaire a14f2a682d Added `getCodeQueue()` which will be used when code generation is complete (after typechecking) and we can then emit code from it 2021-10-27 09:51:13 +02:00
Tristan B. V. Kildaire 7ffbd6f50e Corrected instruction counter for printCodeQueue() 2021-10-27 09:25:11 +02:00
Tristan B. V. Kildaire 9613fcf81d Set the Operator type 2021-10-26 22:03:48 +02:00
Tristan B. V. Kildaire 975acc05a2 Added the following new SymbolTypes
SymbolType.ADD, SymbolType.MINUS, SymbolType.DIVIDE, SymbolType.STAR
2021-10-26 21:35:39 +02:00
Tristan B. V. Kildaire fcfde58b98 Fixed order of execution for AddInstr construction 2021-10-26 21:15:26 +02:00
Tristan B. V. Kildaire 5b70175de4 Added note TODO 2021-10-26 21:04:47 +02:00
Tristan B. V. Kildaire 6ac0f5fed7 AddInstr now shows both toString()'s of its LHS Value Instruction and its RHS Value Instruction 2021-10-26 20:58:42 +02:00
Tristan B. V. Kildaire 2b29a18328 FetchValueVar now shows information (in its toString) about what variable is being fetched and the length of it to read 2021-10-26 20:44:10 +02:00
Tristan B. V. Kildaire 86ee064af5 VariableAssignmentInstr now prints out the nested Instruction for obtaining its value of which will be assigned to the variable it specifies 2021-10-26 20:36:39 +02:00
Tristan B. V. Kildaire 569e53f803 This seems to work 2021-10-26 20:32:47 +02:00
Tristan B. V. Kildaire 129860fc37 WIP 2021-10-26 17:17:53 +02:00
Tristan B. V. Kildaire b9adbc6663 Yo, so I think I got this down 2021-10-25 22:31:07 +02:00
Tristan B. V. Kildaire 8bf3270de7 NumberLiteral now has its own custom toString 2021-10-25 20:49:58 +02:00
Tristan B. V. Kildaire a58c90d6cb Added some ideas for typechecking the action-list and then furthermore emitting code from it 2021-10-25 17:03:36 +02:00
Tristan B. V. Kildaire ceac4f0eaa Print out action-list items in initialization order 2021-10-25 16:55:43 +02:00
Tristan B. V. Kildaire 8833a14da9 Generate linearized action-list for code generation (and type-checking) 2021-10-25 16:54:06 +02:00
Tristan B. V. Kildaire d4ec91dc94 Added TODO to make the graph acyclic and THEN print it 2021-08-15 22:33:22 +02:00
Tristan B. V. Kildaire 0cd1812fa6 Removed comment 2021-08-15 22:23:31 +02:00
Tristan B. V. Kildaire 6e7bb365ed The generation of the tree is now called externally along with printing of the acyclic tree 2021-08-15 22:23:17 +02:00
Tristan B. Kildaire 6ceff9e54a Removed comment as it no longer applies (I have a working method for what I want to do already, just using visitations :)) 2021-08-12 15:45:42 +02:00
Tristan B. Kildaire 19119bbff6 Removed uneeded variables 2021-08-12 15:42:39 +02:00
Tristan B. Kildaire 2606764f84 Updated ExpressionDNode (dependency node) to use the Expression's toString to make indicating the TYPE of Expressionit contains 2021-08-12 15:42:22 +02:00
Tristan B. Kildaire 67b9fd1504 Added override for VariableExpression's toString method 2021-08-12 15:41:56 +02:00
Tristan B. Kildaire 1fb2b05826 Confirmed more intricate ones work 2021-08-12 15:32:09 +02:00
Tristan B. Kildaire b264ad2371 Fixed cast, which caused segfault later 2021-08-12 15:26:26 +02:00
Tristan B. Kildaire 7729ae6f94 Or not 2021-08-12 15:23:05 +02:00
Tristan B. Kildaire f71ad99b9c Seems to work 2021-08-12 15:22:50 +02:00
Tristan B. Kildaire 0cfcf2a5e6 Pretty sure that needs to be there 2021-08-12 15:21:59 +02:00
Tristan B. Kildaire 51b62fe89f Made error message specific such that whena variable is refercned that EXISTS but has not yet been declared and we can tell the clear difference between that and an entity completely not existing in the program (regardless of declaration order) 2021-08-12 15:18:52 +02:00
Tristan B. Kildaire 4d03416383 Updated error message on reference to variable that is yet to be declared 2021-08-12 15:17:42 +02:00
Tristan B. Kildaire de3ed93908 I guess 2021-08-12 15:16:52 +02:00
Tristan B. Kildaire 29e2f146af Added failing unit test
Added working unit test
2021-08-12 15:15:34 +02:00
Tristan B. Kildaire 88114f2ae0 Can confirm it orders variable declarations correctly 2021-08-12 15:14:25 +02:00
Tristan B. Kildaire dbf4667516 Removed comment
Added dependency addition
2021-08-12 15:13:36 +02:00
Tristan B. Kildaire eeba21edd9 Added note, I may want to move this 2021-08-12 15:12:26 +02:00
Tristan B. Kildaire 5a805b699b Hit a bit of a roadblock 2021-08-12 15:03:56 +02:00
Tristan B. Kildaire 1596bedc35 Bruh 2021-08-12 14:19:53 +02:00
Tristan B. Kildaire b1219c20d5 Working on variable declarations (simple) dependency generation (with assignments) 2021-08-12 14:16:32 +02:00
Tristan B. V. Kildaire c60e83832e All for today 2021-08-11 23:33:53 +02:00
Tristan B. Kildaire c721ca1d65 All for now, will clarify and think on it a little more later 2021-08-11 18:46:25 +02:00
Tristan B. Kildaire 8da430475b Will work on this a bit later, probably the weekend 2021-08-11 18:44:32 +02:00
Tristan B. Kildaire 59d325d691 WIP: Will work on more later, I know what must be done 2021-08-11 18:27:34 +02:00
Tristan B. Kildaire 8fc53fb837 Added mechanism that can be used in the future to indicate, given the Context, whether one can resolve upwards or only within (and hence down too) 2021-08-11 18:24:18 +02:00
Tristan B. Kildaire ab70e5ea3a WIP: Working on accessor dependeny generation for `new A().thing.thing` 2021-08-11 18:19:28 +02:00
Tristan B. Kildaire ff5f39c752 WIP 2021-08-11 17:33:16 +02:00