Commit Graph

16 Commits (45579b859f35a3998360e001ec0059bd2d8a859f)

Author SHA1 Message Date
Tristan B. V. Kildaire e5b0f4e0a1 Resolution
- Removed swear words
10 months ago
Tristan B. V. Kildaire 3e101ac5f8 Resolution
- Implemented `findContainerOfType(TypeInfo_Class, Statement)` which, given a type-of `Container` and a starting `Statement` (AST node) this will swim upwards to try and find the first matching parent of which is of the given type (exactly, not kind-of).
11 months ago
Tristan B. V. Kildaire a884bfe441 Packaging
- Fixed module naming; autocomplete now works

Typing

- Added a TODO/NOTE comment

Parser

- Implemented range-based literal type encoding for integer literals

Check

- Switched from directly calling `isNumeric(string)` to our own `isNumericLiteral(string)` to check if a token is a `SymbolType.NUMBER_LITERAL`

Test cases

- Added new test case `simple_literals3.t`
1 year ago
Tristan B. V. Kildaire c1ba609609 Resolution
- Fixed indentation
1 year ago
Tristan B. V. Kildaire 4f899c69e2 Lexer
- Fixed missing flushing for issue #65 (see "Flushing fix ")
- Added unit test for flushing fix

VariableDeclaration (Instruction)

- Added support for the embedding of a VariableAssignmentInstr inside (added a getter too) (a part of issue #66)
- Conditional support for if statements: Added two new instructions (IfStatementInstruction and BranchInstruction). See issue #64

DGen

- Added depth increment/decrement on enter/leave scope of `transform()`
- Correct tabbing for nested if-statements using new method `genTabs(ulong)` (which uses the above mechanism). Makes code emitted for if statements (issue #64) look nicer.
- Updated VariableDeclarations (with assignments) handling in `transform()` in the manner similar to BinOpInstr (see issue #66)
- Added a TODO for formatting BinOpInstr's `transform()` a little more aesthetically nicer
- Added code emitting support for if statements (the `IfStatementInstruction` instruction) (see issue #64)
- Updated `emitEntryPoint()` to only emit testing C code for the correct input test file

Parser

- `parseIf()` now returns an instance of IfStatement which couples multiple `Branch` objects consisting of `Statement[]` and `Expression`
- Ensured that each `Statement` of the generated `Statement[]` from `parseBody()` for a given `Branch` is parented to said Branch using `parentToContainer()`
- Ensured each generated `Branch` in `Branch[]` is parented to the generated `IfStatement` using `parentToContainer()`
- `parseBody()` now adds to its `Statement[]` build-up array the generated `IfStatement` from the call to `parseIf()`

Check

- Added support for back-mapping `SymbolType.EQUALS` to `getCharacter(SymbolType)`

Data

- Added `Branch` parser node which is a Container for body statements (`Statement[]`)
- Added `IfStatement` parser node which is a Container of `Statement[]` which are actually `Branch[]`

TypeChecker

- Moved import for `reverse` to top of module
- Implemented `tailPopInstr()` method which will pop from the back of the `codeQueue` "scratchpad"
- Fixes handling of `StaticVariableDeclaration` and `VariableAssignmentNode` (fixes issue #66)
- Added handling for IfStatement entities (if statement support #64)

Resolution

- Added a debug statement to `resolveUp(Container, string)` to print out the container to lookup from and the name being looked up

Dependency

- Added a default `toString()` to the DNode class which prints `[DNode: <entity toString()]`
- Added a TODO and debug print related to issues #9
- Disabled InitScope.STATIC check for now as it caused issues with if statement parsing (probably due to VIRTUAL being default and therefore skipping if statment processing) - issue #69
- Cleaned up handling of Entity type `Variable` (variable declarations) - removed repeated code
- Undid the VarAss->(depends on)->VarDec, reverted back to VarDec->(depends on)->VarAss, fixed by #66 (and closes it and #11)
- Added support for `IfStatement` (if statements) in `generalPass(Container, Context)`

Test cases

- Added new test case testing nested if statements (`nested_conditions.t`)
- Added another test case for if statements, `simple_conditions.t`
2 years ago
Tristan B. V. Kildaire ddea68a73d Dependency
- 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
2 years ago
Tristan B. V. Kildaire 5a22b184b7 DGen
- Don't write a blank line at the top of the header comment (see `emitHeaderComment()`)
2 years ago
Tristan B. V. Kildaire 114f0c5c39 Now Container is an interface and Clazz is a kind-of Type (class-hierachy) and kind-of Container (interface)
Added assertion checks when casting for sanity (all casts to Entity from Container should never break as so far we do not have an object with a kind-of typeID tree that is imp,ementing interface Container and NOT Entity (class)
3 years ago
Tristan B. V. Kildaire 9d1f0ee5e7 Fetch Module entity enabled 3 years ago
Tristan B. V. Kildaire 15f894b668 Everything works 3 years ago
Tristan B. V. Kildaire db98011197 Added TODO 3 years ago
Tristan B. V. Kildaire 4f32fb9619 Only use grand resolver here now that it is implemented 3 years ago
Tristan B. V. Kildaire c5f45e6a36 Added top down (using module name) resolution to the grand resolver 3 years ago
Tristan B. V. Kildaire ab5ee58055 Removed useless check 3 years ago
Tristan B. V. Kildaire 91231ddebd Removed redundant check 3 years ago
Tristan B. V. Kildaire 0e748f15c1 Refactored name resolution code 3 years ago