- Fully integrated new `LexerException` system into `performLex()`
COmmand-line
- Updated `commands.d` to catch any `TError` and report the error back
Parser
- Updated unittests to use `LexerException`
Compiler
- Disabled unit tests for now as they cause errors
- `getLinearizedNodes()` returns the `DNode[]` of the linearization results
` `getTree()` returns the string representation of the dependency tree
- New linearization method which requires calling `performLinearization()` before `getLinearizedNodes()` or `getTree()`, if not then an exception is thrown
- Made `tree()` private
- `tree()` now takes in argument `ref DNode[]` of which it will read the linerization into instead of `static DNode[] poes`
- Added comment regarding Problem 5 of issue #41
- Removed `static DNode[] poes`
TypeCheck
- Added better comments
- Switched to new linearization methods for both module-level processing and function definition (`FuncData`) processing
- Removed any reference to `DNode.poes`
- Moved configuration sub-system to its own class `CompilerConfiguration`
- `getConfig()` and `setConfig()` are now templatised to generate, at compile-time, type-specific versions which will fetch and convert using the requested type
- Added some more default configuration parameters for DGen
DGen
- Implemented configuration checking for `genTabs()` and `emitEntryPoint()` (both which have the default config value of `true`)
- Added commented-out testing code (see issue #88)
- Added missing `typeChecker.beginCheck()` call to the TypChecker in `compile()`
- Print error on lexing error
- Removed old compilation code and replaced with an instantiation of a `Compiler` object and a corresponding call to `.compile()`
- Added comments and removed TODO for now complete feature on `parseTypedDeclaration()`
Dependency
- Added support for external variable symbols to `transform()` for declarations, assignments and variable expressions
Test cases
- Updated extern evar test case to new symbol name that wouldn't clash
- Added assignment usage and expression usage
- `parseTypedDeclaration()` will no longer consume the SEMICOLON after a vardec
- `parseTypedDeclaration()` will no longer consume theSEMICOLON after an assignment
- `parseName()` will expect a semicolon if the returned object from `parseTypedDeclaration()` is of type `Variable`. If of type `Function` then nothing will be expected
- Added `allowVarDec` and `allwFuncDef` to `parseTypedDeclaration()` as default arguments with `true` as their default values
- If `allowFuncDef` is true then parse a function
- If `allowVarDec` is `true` then allow a variable definition
- If `allowVarDec` is true but we have an assignment and `wantsBody` is false then throw an error
- NOTE: A fix for `parseTypedDeclaration()` is needed for this to work
Tests
- Updated `simple_extern.t` to include an `extern evar`
- Implemented type `Compiler` which wraps compilation all into one object which can have `compile()` called on it to perform the full sequence of tests
- Added new symbol types `EXTERN`, `EXTERN_EFUNC` and `EXTERN_EVAR` and related back-mappings
Parser
- `parseFuncDef()` now accepts a default argument (set to `true`) on whether to expect a body for a function or not, in the not case expect a semi-colon - this helps with extern support
- Likewise because `parseFuncDef(bool wantsBody = true)` is called by `parseTypedDeclaration()` we have added same argument to `parseTypedDeclaration(bool wantsBody = true)`
- Ensure we pass the parameter from `parseTypedDeclaration()` into `parseFuncDef(bool)` in function definition case
- Implemented `parseExtern()` for extern support
- `parse()` supports `SymbolType.EXTERN` now
Data
- Added `ExternStmt` to represent the parser node derived from a call to `parseExtern()`
- The `Entity` parser node type now has an `isExternal()` flag to know if the entity is marked for `extern` link time or TLang internal time (default)
Typechecker
- Implemented `processPseudoEntities(Container)` which loops through the given container and finds all extern statements and then extracts those nodes, parents them to the given container and marks them as external (pseudo-handling support)
- Added first call inside `beginCheck()` to be a call to `processPseudoEntities(modulle)`
Dependency
- Added useless no-op check for `ExternStmt` - it does nothing
DGen
- In `emitFunctionSignature()`, prepend the string `extern ` to the signatur if the given `Function` entity is marked as external (`isExternal()` is true)
- In `emitFunctionDefinitions()` do not emit a function body at all (or anything, no signature) if the `Function` is marked as external (`isExternal()` is true)
- Added entry point test for `simple_extern.t`
- Added `getReferType()` to `Pointer` type to refer the `Type` instance of the data being pointed to
DGen
- Fixed bug whereby pointer types were not being transformed correctly in typeTransform()`
- VariableParameter's now have their `Type` object extracted and type transformed as part of function definitions.
Tests cases
- Updated `simple_cast.t` to test new typeTransform() usage on VariableParameter (as stated above)
- Extract the `Variable`'s `Type` object and pass it into the instruction constructor
Instruction
- `VariableDeclaration` instruction now takes in an instance of `Type` upon construction
Dependency
- Fixed null pointer exception where Function did not have its `context` set
DGen
- Added `typeTransform(Type)` to transform the given types into the C equivalent
- Variable declarations use `typeTransform()` now
- Casting instructions use `typeTransform()` now
- Added `emitStdint()` to emit `#include<stdint.h>` as part of header in generated C code
- `generateSignature(Function)` now uses `typeTransform()` for the return type emit
- Implemented new instruction `CastedValueInstruction`
- Added import for `Type`
DGen
- Implemented primitive type casting code generation in `transform()`
- Added import for `Type` and `Primitive`
Parser
- Implemented `parseCast()` which is called by `parseExpression()`
Check
- Added new symbol type `SymbolType.CAST`
Expressions
- Implemented new expression type `CastedExpression`
Typechecker
- Implemented processing of `CastedExpression` in the expression section, along with correct type/instruction pushes and pops
Dependency
- Implemented dependency generation of `CastedExpression` in `expressionPass()`
Test cases
- Added test file `simple_cast.t`
- Added `getReferredType()` to `Pointer` to fetch the type of the data being referred to
Typechecker
- Unary operator `STAR` now will check popped type, ensure it is a pointer, then push the type of the referred-to data
Test cases
- Updated the `simple_pointer.t` test case to do pointer dereferencing
DGen
- Updated entry point testing code for the pointer test `simple_pointer.t`
- Added new instruction `DiscardInstruction`
DGen
- Added ability to transform `DiscardInstruction`
Parser
- Implemented `parseDiscard()`
- Removed a TODO
- Added a unittest testing the new `parseDiscard()`
- Typo fixes here and there in unittests
Data
- Added new parser node `DiscardStatement`
Typechecker
- Added codegen for `DiscardStatement` type
Dependency
- Added dependency processing for `DiscardStatement` type
Tests
- Added new test case `simple_discard.t`
- Added support for n-ary pointer types in function parameters
- Added a test case for the above
- Updated current pointer test to test function type n-ary as well (return type)
- Added `getOperator()` and `getOperand()` methods to `UnaryOpInstr`
- Added new instruction `PointerDereferenceAssignmentInstruction` for pointer support
DGen
- Updated `transform()` to emit code for instruction type `UnaryOpInstr`
- Updated `transform()` to emit code for instruction type `PointerDereferenceAssignmentInstruction`
- Added testing emit code in `emitEntryPoint()` for pointer testing
Parser
- Updated `parseName()` to trigger `parseTypedDeclaration()` on occurene of `SymbolType.STAR` (for pointer type declarations)
- Added pointer-type support for function parameters (so far only single) in `parseFuncDef()`
- `parseExpression()` terminates on occurence of a single `=` (ASSIGN) operator
- Declaring of pointers of any depth implemented in `parseTypedDeclaration()`
- Added support for pointer dereferncing assignments with the addition of `parseDerefAssignment()`
- `parseStatement()` will now call `parseDerefAssignment()` on occurence of a `SymbolType.STAR`
- Added a unittest for testing pointers
- Finished unittest for for loops
Check
- Added backmapping for `SymbolType.ASSIGN` -> `&`
Data
- Added new parser node type `PointerDereferenceAssignment` for pointer support in the parser
TypeChecker
- Because function parameters are type che cked upon function call I had to add typechecking code for pointer support in the `UnaryOperatorExpression` case
- Added code generation support for `PointerDereferenceAssignment` type
Dependency
- Added support for `PointerDereferenceAssignment` type (pointer support) to `generalStatement()`
Tests
- Added pointer test `simple_pointer.t`