- Added new instruction type `ReturnInstruction`
Data
- Adjusted return statement parser node weighting to 2 (makes it on the same level as normal body statements)
Dependency
- Added dependency generation for return statements
- Removed old commented-out code in the function-definition generation section of `generalPass()`
TypeChecker/Codegen
- Added code generation for return statements
DGen
- Added code emitting for return statements (`ReturnInstruction`)
Test cases
- Updated test case `simple_functions.t` to test return statements
- Cleaned up emit() method
- New test case hashes inserted for entryPoint test code
Test cases
- Updated `simple_function_decls.t` to be exactly that, ONLY declarations with basic bodies
- Migrated advanced function usage testing code to a new unit test: `simple_functions.t`
DGen
- Updated function parameter symbol lookup to use new `symbolLookup9Entity)` mechanism
Test cases
- Updated test case `simple_function_decls.t` to use arguments referencing for tests
- Bug fix (#57) - Undid hack (of #46) for Context setting of VariableStdAloneAssignments
- Bug fix (#54) in VariableExpression whereby global lookups failed because they used `resolveWithin()` and not `resolveBest()`
Resolution
- Implemented `generateNameBest(Entity)` which can generate the full absolute path of the given Entity
- Added debug statements to `isDescendant(Container, Entity)`
- Added a TODO for when isDescendant fails, the asserts should be removed and placed there
Mapper
- The `symbolLookup()` method now takes in only the Entity and provides a hash (by making use of `generateNameBest()`)
DGen
- Switched to using the new `symbolLookup(Entity)` in `transform()` wherever it was being used
Test cases
- Updated test case `simple_function_decls.t` to use a global variable reference in a VariableExpression to test the fix for #54
- Make the name of the function const and public for FuncCallInstr
CodeEmitter
- Added methods `getCursor()`, `getSelectedQueueLength()` and `getQueueLength()`
- Removed old queue-specific methods
DGen
- Added emitting for FuncCallInstr instruction (function call support)
- Now emit globals first BEFORE function definitions
- Added debug prints per instruction to know what instruction is currently being transform()'d
- After emitting sections add newlines between each to make for neater C code
- `emitEntryPoint()` now adds a test for `simple_function_decls.t` (This should be removed soon)
- Removed incorrect TODO in `finalize()`
Dependency
- Make the `nodePool` static, to ensure pooling carries over across multiple `DNodeGenerator` instances
- Fixed handling of function calls in `expressionPass()` - do NOT add a so-called `FunctionDefNode` (remember functions are defined by `addFuncDef()`)
- Set the Context of standalone variable assignments to the Context of the Variable entity representing the variable being assigned to
TypeChecker
- Assign the Context object stored in the `FunctionCall` statement to the `FuncCallInstr`
Test cases
- Updated test case `simple_function_decls.t`
- Added newline to release info print
- Fixed module docstring
Commands
- Added new command-line options: `syntaxcheck`, `typecheck`
- Added todo to `help` command
- Re-ordered commands for order of appearance in help text
Compiler
- Added docstring to `beginCompilation(string[])` function
Mapper
- Added debug print of the Container being used for the symbol lookup
CodeEmitter
- Re-worked CodeEmitter class to use a single so-called "selected queue"
- Added methods to move back and forth between said "selected queue", get the length, etc.
- Remove old queue-specific methods
DGen
- Use the new CodeEmitter "selected-queue" functionality
- Emit function definitions now supported
Exceptions
- Added this keyword
Check
- Added support for SymbolTYpe.OCURLY and SymbolType.CCURLY to `getCharacter(SymbolType)`
Data
- Added a `hasParams()` method to the Function entity type
TypeChecker
- Added support for emitting function definitions (required DNode.poes = [] (cleaning), codeQueue cleaning etc.)
- Added `getInitQueue()` method to make a copy of the current "scratchpad" `codeQueue`
- Build up a copy of the global queue now (make a copy similiar to what we did for `getInitQueue()` but inline)
- Added a debug print
Dependency
- Added a FIXME note for issue #46
- Added a TODO relating to `static DNode[] poes`
Test cases
- Added test case `simple_function_decls.t` to test function definition code emit
- Updated test case `simple_variables.t` to note that the T code generates invalid C code
README
- Build instructions now generate coverage files (`.lst`s)
- Updated link to documentation
- Added support for return statements
- Fixed up SyntaxError to display informative messages
- `expect(SymbolType, Token)` will now use the new SyntaxError constructor
Data
- Added `ReturnStmt` type for return statement support
- Implemented code emit for variable expressions (fetching their values)
----
Test cases
- Updated test case `simple_variables.t` to be able to test the newly implemented `FetchValueInstr` code emit
- Removed redundant imports
Dependency
- Set the context for the `VariableAssignmentStdAlone` entity
- Removed words that show I have the mental maturity of a 12 year old
----
Test cases
- Updated `simple_variables_decls_ass.t`
- Updated `simples_variables.t`
- Removed duplicate instance of `VariableAssignmentInstr`
- Set the context of the created `VariableAssignmentInstr` to be that of the `VariableAssignmentStdAlone` entity
- All operations regarding moving through (iterating over) instructions are now to be done via the instructions provided by CodeEmitter, moveback, moveforward etc.
DGen
- Re-worked the system to use new CodeEmitter semantics
- Variable assignments in declarations are oneshot now which makes it more compact, semantically better and also valid C
---
Tests
- Updated the `simple_variables.t` test case to have many binary operations chained
- Removed all `emit()` methods (this is now done in the language-specific emitter - DGen)
CoreEmitter
- Added docstrings
- Added required `transform(Instruction)` method which must transform each provided Instruction into a string (a.k.a. do the actual emit()-ting)
DGen
- Migrated C-emit code into the overrided `transform(Instruction)` method
- VariableAssignment entity now has its Context object set to the current Context (of the Variable being declared) (so this is a declare assignment case only (so far)) (fixes#36)
TypeChecker
- Extract the Context object from the VariableAssignment entity and then set it as the Context for the VariableAssigmnetInstr instruction (fixes#36)
VariableAssigmnentInstr
- The `emit()` method will now emit the assignment code
Check
- Added `getCharacter(SymbolType)` which maps a SymbolType to a maths operator (WIP)
- Implemented the correct emit for this instruction (just emits the string version of the ulong `data`
BinOpInstr
- Emit is almost correct, just missing a mapping from SymbolType to the maths operator required
- Added new SymbolMapper class with a static method which will take a Container and an entity name, resolve the Entity and then generate the hash of the absolute path to said entity and return this as the `symbol name`
TypeChecker
- Set the static field to refer to this instance of the TypeChecker (in the SymbolMapper class)
VariableDeclaration
- Use the `symbolLookup()` method to transform the name
- Added `finalize()` method, this is to be called whenever the emitting is done and a compiler is to be called on the code
DGen
- Implemented a gcc-based finalization method
- Added `emitEntryPoint()` to emit a main() function which is to be called in libc's `_start` symbol
VariableDeclaration
- Added note we may need a symbol table lookup system actually, rather than just a simple `symbolRename`
Compiler
- Call the `finalize()` method on the DGen code emitter
----
Test cases
- Added `simple_variables_only_decs.t` to test code generation
- Added a method which will replace the `.`s in a symbol with underscores
Instruction
- The symbol names need to be valid in C so let's just make it a rule they will only have _'s (underscores) to replace any characters like `.`s
- Pass in the type of the variable being declared to the `VariableDeclaration` instruction
VariableDeclaration
- Emitted code now contains the type of the variable being declared
- Added `getInitQueue()`
- Removed the `beginEmit(initQueue, codeQueue)` method (as this is done for us in compiler.d
CodeEmitter
- Extract init queue as well
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))
- 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
- 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)
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().
- Disabled seperate generate() calls to FuncDefs in core.d for typechecking
- Added `saveFunctionDefinitionNode()` and `retrieveFunctionDefinitionNode()` to core.d for dependency
- Added a generalPass() call (and fixed it to skip on things != STATIC for InitScope - temporary fix)
- Added test case to test with
- Ensure we set the parentOf all Statement's inside a Function (definition) whilst parsing - to prevent a runtime assertion (I believe, well all fixed now)
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.
- 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