Commit Graph

1012 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 42fac8020a Context
- Added static field for a TypeChecker instance

TypeChecker

- Set the static field of `Context` class to hold a reference to the TypeChecker instance
2022-12-11 18:18:50 +02:00
Tristan B. Velloza Kildaire d19edef8f4 DGen
- Emit code by calling `emit()` on each Instruction object
2022-12-11 18:13:10 +02:00
Tristan B. Velloza Kildaire 1e2ef795d6 Instruction
- Added `emit()` method to base Instruction class
- Fixed typo in name of `StorageDeclaration` class
- WIP: `VariableDeclaration` emit()
2022-12-11 18:12:46 +02:00
Tristan B. Velloza Kildaire 5a22b184b7 DGen
- Don't write a blank line at the top of the header comment (see `emitHeaderComment()`)
2022-12-11 18:09:56 +02:00
Tristan B. Velloza Kildaire 15617e7ced DGen
- Added note to `emitCodeQueue()` that instructions will need recursive `emit()` methods
2022-12-11 18:08:52 +02:00
Tristan B. Velloza Kildaire f4797b79e2 DGenregs
- This file has been removed

DGen

- Removed unused import for `dgenregs.d`
2022-12-11 18:06:10 +02:00
Tristan B. Velloza Kildaire b8c99329aa DGen
- Added trailing newline to the comment emitted by `emitHeaderComment()`
2022-12-11 18:04:53 +02:00
Tristan B. Velloza Kildaire c91d72d0b9 DGen
- Added some NOTEs for potential TODOs
2022-12-11 18:01:54 +02:00
Tristan B. Velloza Kildaire e6b1de47f1 DGen
- Added docstring to `emitHeaderComment()`
2022-12-11 17:58:33 +02:00
Tristan B. Velloza Kildaire fe7390caa0 DGen
- The module name of the source file is now correctly added to the header comment (see `emitHeaderComment()`)
2022-12-11 17:57:16 +02:00
Tristan B. Velloza Kildaire 1f3bdd3279 DGen
- Added support for an additional string comment to be added to the emitted header comment via the `emitHeaderComment()` method
2022-12-11 17:55:18 +02:00
Tristan B. Velloza Kildaire c37b85b781 DGen
- Emit a header comment to the output C file containing information about the generated code (source file and destination file)
2022-12-11 17:52:36 +02:00
Tristan B. Velloza Kildaire b43e8de0ef Compiler
- Make output file `tlangout.c`
2022-12-11 17:43:24 +02:00
Tristan B. Velloza Kildaire 566a916a5a DCodeEmitter
- Removed old code generation code - starting anew
2022-12-11 17:38:58 +02:00
Tristan B. Velloza Kildaire 99224cbb80 Type checker
- Added `getInitQueue()`
- Removed the `beginEmit(initQueue, codeQueue)` method (as this is done for us in compiler.d

CodeEmitter

- Extract init queue as well
2022-12-11 17:37:27 +02:00
Tristan B. Velloza Kildaire 6253281f6f Typechecking
- Cleaned up imports
- Added TODOs and a stub `beginEmit(InitQueue, CodeQueue)` method to be used for the beginning of the code emit process
2022-12-11 17:33:18 +02:00
Tristan B. Velloza Kildaire 466b722bcc Removed junk file 2022-11-26 16:31:46 +02:00
Tristan B. Velloza Kildaire ff20c28458 Added debug statements at each stage of DNode processing in the `doTypeCheck(DNode[])` method along with seperators for the final stage's InitQueue and CodeQueue print out 2022-11-26 16:31:33 +02:00
Tristan B. Velloza Kildaire b58c23bd9c Fixed typo 2022-11-26 16:28:27 +02:00
Tristan B. Velloza Kildaire ff51b2ded0 Cleaned up the `doTypeCheck(DNode[])` method 2022-11-26 16:26:51 +02:00
Tristan B. Velloza Kildaire 13a0a5057f Removed unused commented block of code 2022-11-26 16:25:23 +02:00
Tristan B. Velloza Kildaire af9cd544fe Update .gitignore 2022-11-26 16:20:29 +02:00
Tristan B. Velloza Kildaire 9151a46888 Cleaned up 2022-10-15 23:46:10 +02:00
Tristan B. Velloza Kildaire a122b674e2 Cleaned up ClassStaticNode handling code in the type checker. 2022-10-15 23:43:02 +02:00
Tristan B. Velloza Kildaire cac86d604e Added method documentation 2022-10-15 22:03:50 +02:00
Tristan B. Velloza Kildaire b09a247413 Removed unused SList 2022-10-15 22:01:41 +02:00
Tristan B. Velloza Kildaire 268f4bb48f Added `printInitQueue()` method to print all elements in the initialization queue
Print both the initialixation queue (and then) and the code queue at the end of typechecking the linearized list
2022-10-15 21:57:03 +02:00
Tristan B. Velloza Kildaire ae789c9114 Increased complexity of test case 2022-10-15 21:00:59 +02:00
Tristan B. Velloza Kildaire 0c94ece070 Initialization queue
This is a queue where all things such as:

- Class static initializations
- Module initializations (maybe)
- Struct static initializations

will go.

Added `addInit()` along `SList initQueue` to support such a queue.

- Whenever a ClassStaticNode is come across it is added to this queue (at the back - so as to maintain allocation order, not that allocation would matter - only initialization (which is already working))
2022-10-15 20:36:18 +02:00
Tristan B. Velloza Kildaire 47d1974f93 Just create a ClassStaticInitAllocate instruction but don't do anything with it 2022-10-15 20:25:38 +02:00
Tristan B. Velloza Kildaire 1b7cf42aa5 Disabled ClassStaticAllocate processing code in typechecker for now
Updated test case
2022-10-15 20:24:23 +02:00
Tristan B. Velloza Kildaire c9dcf58911 Updated test case to double check that complex examples would be correctly processed 2022-10-15 17:18:27 +02:00
Tristan B. Velloza Kildaire 31c52c0beb Potential fix for variable declarations and assignments (to them)
- The VarAssDNode processor on typechecker now adds to the back orf the code queue
- We removed all weird swapping code in typechecker
- Dependency wise, a variable declaration is depended-UPON its variable assignment which in turn a module depends ON.
- In the case of no assignments we simpyl make the module depend on the variable declaration dnode directly
- Added new test case to show this all
2022-10-15 17:15:03 +02:00
Tristan B. Velloza Kildaire cbe40e7184 Formatted code 2022-10-15 16:55:10 +02:00
Tristan B. Velloza Kildaire 2d9cf1f333 Added gitignore 2022-10-15 16:53:39 +02:00
Tristan B. Velloza Kildaire f4311b8e67 Added note for something to work on 2022-10-15 16:48:57 +02:00
Tristan B. Velloza Kildaire cd02bc2b66 Updated toString() for ClassStaticNode 2022-10-15 13:28:30 +02:00
Tristan B. Velloza Kildaire 3c65af06a0 Added note 2022-10-14 21:16:33 +02:00
Tristan B. Velloza Kildaire 3536e39f6f Found why we are crashing (dependency generation is ordered right but we need to maybe make different objects or add checks of a different sort) 2022-10-14 20:44:33 +02:00
Tristan B. Velloza Kildaire b30b6e0fe0 Disabled generation of unused Context object 2022-10-14 20:13:10 +02:00
Tristan B. Velloza Kildaire 2f586a10cd Updated test case 2022-10-14 20:12:33 +02:00
Tristan B. Velloza Kildaire 86905da623 Added TODO 2022-10-14 20:12:28 +02:00
Tristan B. Velloza Kildaire 2031a4645c Context should just be the same one passed in as we are not changing really. 2022-10-14 20:10:57 +02:00
Tristan B. Velloza Kildaire c85aba1f56 WIP 2022-10-14 19:58:33 +02:00
Tristan B. Velloza Kildaire e46950778b Fixes:
- The test case was broken -_-
- Full-path traversal now implemented somewhat, along with checks on the container if they require static initialization (such as for Classes)
2022-10-14 18:45:44 +02:00
Tristan B. Velloza Kildaire 0c104440ae Freeze for now 2022-10-14 18:01:35 +02:00
Tristan B. Velloza Kildaire 05d00ff58b WIP: Seems wrong the order we get back, might need to take some time to think about how to get about implementing this 2022-10-13 18:35:25 +02:00
Tristan B. Velloza Kildaire 15d2bf6b68 Dependency generation
Full path evaluation update

If the local segment is a Class-type-of Container then run
a class static allocation on it and make the current dnode
dependent on that ClassStaticAllocation dnode returned from
classStaticAllocate().
2022-10-13 18:32:33 +02:00
Tristan B. Velloza Kildaire 2d58d5f0d7 WIP: Full path dependency evaluation 2022-10-13 18:29:30 +02:00
Tristan B. Velloza Kildaire 8a82751a18 Added Gitea issue number #8 for ClassStaticAllocate node 2022-10-13 14:34:47 +02:00