Commit Graph

941 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 9eeacdb3c4
Update d.yml 2023-03-26 13:21:30 +02:00
Tristan B. Velloza Kildaire 43677cbcfb
Added code emit tests 2023-03-26 13:18:50 +02:00
Tristan B. Velloza Kildaire 91e389c4ff
Finished typechecking tests 2023-03-26 13:15:43 +02:00
Tristan B. Velloza Kildaire 464d30b06c
Update d.yml 2023-03-26 13:12:12 +02:00
Tristan B. Velloza Kildaire 899f832b36
Added more tests 2023-03-26 13:09:49 +02:00
Tristan B. Velloza Kildaire 8d86f3618a
Update d.yml 2023-03-26 13:02:30 +02:00
Tristan B. Velloza Kildaire 46e963e98a
Update d.yml 2023-03-26 13:01:07 +02:00
Tristan B. Velloza Kildaire 3069878aa6
Update d.yml 2023-03-26 12:58:47 +02:00
Tristan B. Velloza Kildaire 713d491727
Update d.yml 2023-03-26 12:57:38 +02:00
Tristan B. Velloza Kildaire c90e25da4e
Update d.yml 2023-03-26 12:56:44 +02:00
Tristan B. Velloza Kildaire 8675cd0a1c
Update d.yml 2023-03-26 12:56:24 +02:00
Tristan B. Velloza Kildaire 14c18fd2b4
Update d.yml 2023-03-26 12:54:32 +02:00
Tristan B. Velloza Kildaire 01a3011c23
Update d.yml 2023-03-26 12:52:55 +02:00
Tristan B. Velloza Kildaire 6c219d87dd
Update d.yml 2023-03-26 12:47:56 +02:00
Tristan B. Velloza Kildaire c2d637d952
Update d.yml 2023-03-26 12:46:05 +02:00
Tristan B. Velloza Kildaire e158e448b5
Update d.yml 2023-03-26 12:44:35 +02:00
Tristan B. Velloza Kildaire d2ddf3084f
Update d.yml 2023-03-26 12:43:17 +02:00
Tristan B. Velloza Kildaire 34f937df10
Disable windows build
For now, disable any non-POSIX operating systems
2023-03-26 12:39:30 +02:00
Tristan B. Velloza Kildaire 40bc4470dc
Update d.yml 2023-03-25 23:01:02 +02:00
Tristan B. Velloza Kildaire 334eb60b4d
Update d.yml 2023-03-25 22:59:22 +02:00
Tristan B. Velloza Kildaire de2e6edfd5
Update README.md 2023-02-26 19:51:22 +02:00
Tristan B. Velloza Kildaire 3d2ea5a395
Create d.yml 2023-02-26 19:49:20 +02:00
Tristan B. Velloza Kildaire f0c1534fcd
Update README.md 2023-02-26 19:48:04 +02:00
Tristan B. Velloza Kildaire 38cfb6293c
Update d.yml 2023-02-26 19:46:38 +02:00
Tristan B. Velloza Kildaire 5f22ca65c0
Update d.yml 2023-02-26 19:46:02 +02:00
Tristan B. Velloza Kildaire 202db8cca4
Update d.yml 2023-02-26 19:43:28 +02:00
Tristan B. Velloza Kildaire cc8fcceab9
Create d.yml 2023-02-26 19:41:22 +02:00
Tristan B. Velloza Kildaire 3b4142f16b Parser
- Implemented `ulong getCursor()` which returns the parser's token pointer
2023-02-15 13:16:42 +02:00
Tristan B. Velloza Kildaire 37225c8484 Parser
- Added a TODO about a possible refactor to make things split out more
- Implemented `setCursor(ulong)` so that we can update the position of the token pointer
2023-02-15 13:13:42 +02:00
Tristan B. Velloza Kildaire 03a998bae8 Typechecker
- Removed `assert(false)` in code which handles a mismatched parameter type versus argument type, replaced with a throws `TypeMismatchException`
2023-02-11 12:19:44 +02:00
Tristan B. Velloza Kildaire ab66860e7b Typechecker
- See TODO
2023-02-11 12:16:11 +02:00
Tristan B. Velloza Kildaire dcdaa87c54 Typehecker
- Any attempt to dereference an entity of which is not a pointer type will now throw a `TypeCheckerException` instead of a failing assertion with a print-out
2023-02-11 12:13:08 +02:00
Tristan B. Velloza Kildaire 9332b955ff Typechecker
- On processing of binary operations, if there is a type mismatch now a `TypeMismatchException` will be thrown instead of a print0out followed by an `assert(false)`
2023-02-11 12:09:09 +02:00
Tristan B. Velloza Kildaire 59920286e2 Typechecker
- Removed TODO
- Added some TODO temporary checks that are no-ops for now regarding `-` handling in the `UnaryOpInstr` handler if-branch
2023-02-11 12:03:25 +02:00
Tristan B. Velloza Kildaire 561ce505a0 Test cases
- Added new test case `simple_literals6.t` for future test
2023-02-11 12:02:06 +02:00
Tristan B. Velloza Kildaire ede4db948b Typechecker
- Corrected casted variable, was `literalInstr` but is meant to be `operandInstr`
- Added support for coercing signed literals in ranges for `byte`, `short`, `int` and `long`
- Added initial support for signed-literal coercion (e.g. `-1`)
- Set type for `UnaryOpInstr` (when doing `ADD` or `SUB` to the type of the embedded instruction (of type `Value` - this is soon to change in certain cases

Test cases

- Updated test case `simple_literals4.t`
- Updated test case `simple_literals5.t`
2023-02-06 21:49:25 +02:00
Tristan B. Velloza Kildaire 4474561ee1 Test cases
- Updated test case `simple_literals3.t` to showcase more values
2023-02-06 16:08:54 +02:00
Tristan B. Velloza 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`
2023-02-05 20:21:26 +02:00
Tristan B. Velloza Kildaire 18b784f861 Parser
- Updated `ParserException` to have a sub-error type `ParserErrorType`
- Updated `SyntaxError` to overwrite the exception's `msg` field
- Added literal encoding for integer support to parser

Typechecker

- Removed exception check which is now redundant seeing as literal overflows would be checked within the parser (way before typechecking begins)
- Added conversion support (type transfers) for the `LiteralValue` instruction codegen
- Removed uneeded sub-error type in `TypeCheckerException`'s `TypecheckError` (rempved `TypecheckError.LITERAL_OVERFLOW`)
2023-02-05 14:13:15 +02:00
Tristan B. Velloza Kildaire f7a4091620 TypeChecker
- Corrected enum for error sub-type from `TypeheckError` to `TypecheckError`
- Added new sub-type error `TypecheckError.LITERAL_OVERFLOW`
- If the literal value is too big then throw a `TypeCheckerException`
2023-02-05 12:47:27 +02:00
Tristan B. Velloza Kildaire 185db68311 Coercion
- Added support for range checking `ubyte` type coercion
2023-02-05 12:27:47 +02:00
Tristan B. Velloza Kildaire 45eec9fb20 DUB configuration
- Added homepage to dub configuration
2023-02-05 12:27:14 +02:00
Tristan B. Velloza Kildaire 065c8d5816 Exceptions
- `TypeCheckerException` now inherits from `TError`
- `TypeCheckerException`  now produces a neat error message using an enum `TypecheckError`
- Added new sub-class `TypeMismatchException` to be used when two types do not match

TypeChecker

- Hoisted out the coercion code into two methods, `isCoercibleRange` and `attemptCoercion`
- Make both variabel declarations (with assignments) and standlaone variable assignments call the `attemptCoercion()` method when the call to `isSameType(Type t1, Type t2)` returns `false`

Test cases

- Added new test case `simple_literals2.t`
2023-02-04 14:37:40 +02:00
Tristan B. Velloza Kildaire c1ee7d06ba LiteralValue, LiteralValueFloat
- Made the `data` field `private` and now accessible through a call to `string getLiteralValue()`

UnaryOpInstr

- Use `Value` instead of `Instruction` for unary operator instructions

DGen

- Switched to using `getLiteralValue()` where required due to the aforementioned reasons
2023-02-04 14:25:39 +02:00
Tristan B. Velloza Kildaire de37eeec8c Merge branch 'compiler_object' into literal_encodings 2023-02-04 12:53:25 +02:00
Tristan B. Velloza Kildaire 00ac28c553 Commands
- Enable pretty code generation on the command-line by default
- Explicitly make the `SymbolMappingTechnique.HASHMAPPER` the default symbol translation technique
2023-02-04 12:52:18 +02:00
Tristan B. Velloza Kildaire e919dcc8e4 DGen
- Removed the `varDecWantsConsumeVarAss` as it is not used anymore
- The transformation of the `VariableAssignmentInstr` instruction (which is generated by a corresponding `VariableStdAloneAss` parser node) does not check for `varDecWantsConsumeVarAss` anymore and will directly `transform(varAss.data)` (the embedded `Value` instruction in the `VariableAssignmentInstr`
- If a `VariableDeclaration` instruction has an assignment then we extract the `Value` instruction from it and perform a `transform(Value)` - no longer do we have an intermediary `VariableAssignmentInstr`

Instruction

- `VariableDeclaration` now uses a `Value`-based instruction rather than a `VariableAssignmentInstr` as the embedded `varAssInstr`

Dependency

- The creation of a `StaticVariableDeclaration` DNode for `Variable`-declarations that happen to have assignments will now process such assignments by pooling the expression being assigned (via `expressionPass()` and then make the `VarDecNode` depend on it, therefore removing the intermediary `VariableAssignmentNode` dependency-node

Typechecker/Codegen

- When processing a variable declaration (a `StaticVariableDeclaration` dependency-node) we now pop an instruction which would be directly the `Value`-based instruction that we `need()`'d in the dependency generation (this links up with the changes made to the dependency generation for variable declarations)
2023-02-04 12:41:30 +02:00
Tristan B. Velloza Kildaire 4ed6b2a18b Test case
- Updated test case `simple_literals.t` to to perform a standalone variable assignment
2023-02-03 16:29:50 +02:00
Tristan B. Velloza Kildaire b7b0bb452a Instruction
- Set `context` field to `private` - enforcing usage of `setContext(Context)`/`getContext()`

CastedValueInstruction

- Removed field `castToType`, we may as well use the inherited field `type` for that seeing as the type we shall be after the cast is the `castToType`
- Ensured that the constructor copies over the parameter `castToType` to `this.type`
- Ensured that `getCastToType()` now returns `this.type`

TypeChecker

- Switched to using `setContext(Context)` in cases where `instr.context = <context...>` was being used
2023-02-03 16:13:40 +02:00
Tristan B. Velloza Kildaire ba3f6eee7b Instruction
- Removed unneeded constructor
2023-02-01 17:34:55 +02:00