Skip to content

Commit

Permalink
Merge branch 'dev-next' into 654-feature-implement-trycatch-statement…
Browse files Browse the repository at this point in the history
…-to-handle-exceptions
  • Loading branch information
Luna-Klatzer committed Sep 27, 2024
2 parents af1f8d0 + 393c994 commit 4982c82
Show file tree
Hide file tree
Showing 149 changed files with 5,083 additions and 3,333 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ indent_size = 4
[CHANGELOG.md]
indent_size = 2
max_line_length = 120

[CITATION.cff]
indent_style = space
ident_size = 2
5 changes: 5 additions & 0 deletions .run/kipper compile (js).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="kipper compile (js)" type="NodeJSConfigurationType" application-parameters="compile -s &quot;&quot; -t js" path-to-js-file="./kipper/cli/bin/run" working-dir="$PROJECT_DIR$/">
<method v="2" />
</configuration>
</component>
5 changes: 5 additions & 0 deletions .run/kipper compile (ts).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="kipper compile (ts)" type="NodeJSConfigurationType" application-parameters="compile -s &quot;&quot; -t ts" path-to-js-file="./kipper/cli/bin/run" working-dir="$PROJECT_DIR$/">
<method v="2" />
</configuration>
</component>
5 changes: 0 additions & 5 deletions .run/kipper compile.run.xml

This file was deleted.

5 changes: 5 additions & 0 deletions .run/kipper run (js).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="kipper run (js)" type="NodeJSConfigurationType" application-parameters="run -s &quot;&quot; -t js" path-to-js-file="./kipper/cli/bin/run" working-dir="$PROJECT_DIR$/">
<method v="2" />
</configuration>
</component>
5 changes: 5 additions & 0 deletions .run/kipper run (ts).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="kipper run (ts)" type="NodeJSConfigurationType" application-parameters="run -s &quot;&quot; -t ts" path-to-js-file="./kipper/cli/bin/run" working-dir="$PROJECT_DIR$/">
<method v="2" />
</configuration>
</component>
5 changes: 0 additions & 5 deletions .run/kipper run.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="kipper run" type="NodeJSConfigurationType" application-parameters="run -s &quot;&quot;" path-to-js-file="./kipper/cli/bin/run" working-dir="$PROJECT_DIR$/">
<method v="2" />
</configuration>
</component>
102 changes: 85 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,37 @@ To use development versions of Kipper download the

### Added

- Support for the typeof operator, which returns the runtime type of a value.
([#663](https://github.com/Kipper-Lang/Kipper/issues/663))
- Support for Nix Flakes and direnv, which allows for a more reproducible and consistent development environment.
### Changed

### Fixed

### Deprecated

### Removed

</details>

## [0.12.0] - 2024-09-25

### Added

- Support for dot notation for accessing properties of objects. ([#67](https://github.com/Kipper-Lang/Kipper/issues/67))
- Support for classes, class methods, class properties and class constructors.
([#665](https://github.com/Kipper-Lang/Kipper/issues/665))
- Support for object literals and object properties.
([#526](https://github.com/Kipper-Lang/Kipper/issues/526))
- Support for calling lambdas and functions stored in variables or expressions.
([#674](https://github.com/Kipper-Lang/Kipper/issues/674))
- Implemented internal representation for custom types such as objects, interfaces and classes. This change means that
the entire core type system has been reworked and adjusted to also support custom types as well as complex types
(objects, arrays etc.). This does not inherently add functionality but serves as the stepping stone for the
implementation of all custom types in the future. ([#524](https://github.com/Kipper-Lang/Kipper/issues/524))
- Semantic checking and code generation for the `new` keyword expression to be able to create new instances of
classes. ([#679](https://github.com/Kipper-Lang/Kipper/issues/679))
- Support for the `this` keyword inside a class method to access the current instance of the class.
([#697](https://github.com/Kipper-Lang/Kipper/issues/697))
- Support for the typeof operator, which returns the runtime type of a value.
([#663](https://github.com/Kipper-Lang/Kipper/issues/663))
- Implemented `instanceof` operator expression, which checks if an object is an instance of a class.
([#686](https://github.com/Kipper-Lang/Kipper/issues/686))
- Implemented `matches` operator expression, which checks if an object matches an interface.
([#672](https://github.com/Kipper-Lang/Kipper/issues/672))
- Implemented the generic `Array<T>` type and single-type array initializers.
([#499](https://github.com/Kipper-Lang/Kipper/issues/499))
- Support for index-based array assignments. ([#669](https://github.com/Kipper-Lang/Kipper/issues/669))
Expand All @@ -41,13 +58,22 @@ To use development versions of Kipper download the
parameter inside a generic type specifier.
- Implemented constant `NaN`, which represents the `NaN` value in JavaScript (Not a Number).
([#671](https://github.com/Kipper-Lang/Kipper/issues/671))
- Support for Nix Flakes and direnv, which allows for a more reproducible and consistent development environment.
- Support for internal type unions in built-in and internal functions.
([#496](https://github.com/Kipper-Lang/Kipper/issues/496))
- Support for the `obj` type translation to TypeScript.
- Implemented internal representation for custom types such as objects, interfaces and classes. This change means that
the entire core type system has been reworked and adjusted to also support custom types as well as complex types
(objects, arrays etc.). This does not inherently add functionality but serves as the stepping stone for the
implementation of all custom types in the future. ([#524](https://github.com/Kipper-Lang/Kipper/issues/524))
- Implemented internal preliminary type checking and "ahead of time" type evaluation to allow for self-referential
types and type checking of recursive types.
- New module:
- `semantics/runtime-built-ins`, which contains runtime built-in functions, variables and types.
- `semantics/runtime-internals`, which contains the runtime internal functions.
- `semantics/types`, which contains the runtime types.
- New classes:
- `NewInstantiationExpression`, which represents an AST new instantiation expression.
- `TypeofExpression`, which represents an AST typeof expression that returns the runtime type of an object.
- `TypeofTypeSpecifierExpression`, which represents an AST typeof type specifier that lets one define a type by using an object as reference
- `BuiltInTypeObject`, which is the base class for the compilers representation of runtime objects
Expand All @@ -72,7 +98,11 @@ To use development versions of Kipper download the
- `BuiltInTypeFunc`, which represents the `Func<T..., R>` type.
- `BuiltInTypeObj`, which represents the `obj` type.
- `ScopeTypeDeclaration`, which represents a scope type declaration.
- `CustomType`, which is a class extending from `ProcessedType` and implementing the functionality for a custom type such as a interface or class.
- `CustomType`, which is a class extending from `ProcessedType` and implementing the functionality for a custom type such as an interface or class.
- `UserScope`, which represents a user scope i.e. any scope except the universe scope.
- `ClassScopeThisDeclaration`, which represents the `this` declaration of a class.
- `InstanceOfExpression`, which represents the `instanceof` operator expression.
- `MatchesExpression`, which represents the `matches` operator expression.
- New errors:
- `TypeCanNotBeUsedForTypeCheckingError`, which is thrown when a type is used for type checking, but is not a valid
type. This is an error indicating an invalid logic that should be fixed.
Expand All @@ -90,6 +120,10 @@ To use development versions of Kipper download the
- `ValueTypeNotIndexableWithGivenAccessor`, which is thrown when a value type is not indexable with the given
accessor.
- `PropertyDoesNotExistError`, which is thrown when a property does not exist on a type.
- `DuplicateUniverseKeyError`, which is thrown when a key is duplicated in the universe scope.
- `IdentifierAlreadyUsedByMemberError`, which is thrown when an identifier is already used by another property.
- `InvalidInstanceOfTypeError`, which is thrown when the `instanceof` operator is used with a type other than a class.
- `InvalidMatchesTypeError`, which is thrown when the `matches` operator is used with a type other than an interface.
- New interfaces and types:
- `InterfaceDeclarationSemantics`, which represents the semantics of an interface declaration.
- `InterfaceDeclarationTypeSemantics`, which represents the type semantics of an interface declaration.
Expand All @@ -107,17 +141,45 @@ To use development versions of Kipper download the
- `CompilableType`, which represents a type that can be compiled.
- `BuiltInReference`, which replaces the now removed type `Reference` in the `KipperProgramContext` for reference
tracking of built-in types.
- `NewInstantiationExpressionSemantics`, which represents the semantics of a new instantiation expression.
- `NewInstantiationExpressionTypeSemantics`, which represents the type semantics of a new instantiation expression.
- `TypeofExpressionSemantics`, which represents the semantics of a typeof expression.
- `TypeofExpressionTypeSemantics`, which represents the type semantics of a typeof expression.
- `KipperCallable`, which is an alias for `FunctionDeclaration`, `LambdaPrimaryExpression` and
`ClassMethodDeclaration`.
- `TypeDeclarationPropertyTypeSemantics`, which represents the type semantics of a type declaration property.
- `InstanceOfExpressionSemantics`, which represents the semantics of an instanceof expression.
- `InstanceOfExpressionTypeSemantics`, which represents the type semantics of an instanceof expression.
- `MatchesExpressionSemantics`, which represents the semantics of a matches expression.
- `MatchesExpressionTypeSemantics`, which represents the type semantics of a matches expression.
- New functions:
- `KipperTypeChecker.validArrayExpression`, which ensures that an array expression is valid.
- `generateInterfaceRuntimeTypeChecks` which generates runtime type checks for an interface.
- `getRuntimeType`, which gets the corresponding runtime representation of a built-in type.
- `KipperTypeChecker.validArrayExpression()`, which ensures that an array expression is valid.
- `KipperTypeChecker.validInstanceofClassType()`, which ensures that an `instanceof` expression is valid for a class.
- `KipperTypeChecker.validMatchesInterfaceType()`, which ensures that a `matches` expression is valid for an
interface.
- `ClassDeclaration.getThis()`, which returns the `this` type of the class.
- `ClassScope.getThis()`, which returns the `this` type of the class. This is a simple alias for the method in the
`ClassDeclaration` class.
- `JavaScriptTargetCodeGenerator.generateInterfaceRuntimeTypeChecks()` which generates runtime type checks for an interface.
- `getRuntimeType()`, which gets the corresponding runtime representation of a built-in type.
- New properties:
- `BuiltInFunction.funcType`, which returns a function type for the built-in function.
- `FunctionDeclarationTypeSemantics.type`, which returns the type of the function declaration i.e. the function type.
- `LambdaPrimaryExpressionTypeSemantics.type`, which returns the type of the lambda primary expression i.e. the
function type.
- `FunctionCallExpressionTypeSemantics.funcOrExp`, which returns the function or expression that is called. This
always stores some sort of value that extends `BuiltInTypeFunc`.
- `CustomType.clsExtends`, which returns the class that the custom type extends. This is only applicable for classes.
- `CustomType.clsImplements`, which returns the interfaces that the custom type implements. This is only applicable
for classes.
- `CustomType.intfExtends`, which returns the interfaces that the custom type extends. This is only applicable for
interfaces.
- `CustomType._clsStaticFields`, which returns the static fields of the custom type. This is only applicable for
classes.
- `ASTNode.preliminaryTypeSemantics`, which runs the preliminary type semantics of the node as well as the preliminary
type semantics of all its children. This is a recursive function.
- `ASTNode.primaryPreliminaryTypeSemantics`, which returns the primary preliminary type semantics of the node. May be
undefined if there is no primary preliminary type semantics for the given node.
- New runtime error `KipperError`, which serves as the base for `TypeError` and `IndexError`.

### Changed
Expand All @@ -136,22 +198,27 @@ To use development versions of Kipper download the
- Class `UncheckedType` to `RawType`.
- Class `CheckedType` to `ProcessedType`.
- Class `UndefinedCustomType` to `UndefinedType`.
- Method `KipperProgramContext._initUniversalReferencables()` to `_initUniversalReferenceables()`.

### Fixed

- All functions and lambdas simply resolving to `Func` instead of the appropriate filled-up `Func<T..., R>` type. This
now enables proper type checking for function references.
- CLI command `run` not properly reporting internal or unexpected errors, as they were already prettified in the
internally called up command `compile`.

### Deprecated
- Previously invalid parent type checking and evaluation performed in `ReturnStatement`. This was now made absolute by
the introduction of the preliminary type checking and "ahead of time" type evaluation, as that now allows for
self-referential types and type checking of recursive types i.e. the return statement now knows the type of its
function even though it is not yet fully processed.
- Duplicate universe entry registration in the `KipperProgramContext` for built-in types, functions and variables.
- Bug where lambda compound bodies would cause a syntax error, despite being a valid lambda body.

### Removed

- Type `Reference` as it is no longer needed and has been replaced by `KipperReferenceable`.
- `FunctionCallExpressionTypeSemantics.func`, which is now has been replaced by `funcOrExp`.

</details>
- Function `FunctionCallExpressionTypeSemantics.func`, which is now has been replaced by `funcOrExp`.
- Function `KipperProgramContext.setUpBuiltInsInGlobalScope()`, which is no longer needed as the universe scope now
handles all built-in types, functions and variables.

## [0.11.0] - 2024-07-10

Expand Down Expand Up @@ -1539,7 +1606,8 @@ To use development versions of Kipper download the

- Updated file structure to separate `commands` (for `oclif`) and `compiler` (for the compiler source-code)

[unreleased]: https://github.com/Kipper-Lang/Kipper/compare/v0.11.0...HEAD
[unreleased]: https://github.com/Kipper-Lang/Kipper/compare/v0.12.0...HEAD
[0.12.0]: https://github.com/Kipper-Lang/Kipper/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/Kipper-Lang/Kipper/compare/v0.10.4...v0.11.0
[0.10.4]: https://github.com/Kipper-Lang/Kipper/compare/v0.10.3...v0.10.4
[0.10.3]: https://github.com/Kipper-Lang/Kipper/compare/v0.10.2...v0.10.3
Expand Down
20 changes: 14 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ type: software
authors:
- given-names: Luna
family-names: Klatzer
email: luna.klatzer@gmail.com
email: edu@lklatzer.com
affiliation: HTL Leonding
orcid: 'https://orcid.org/0009-0001-5332-8988'
- given-names: Lorenz
family-names: Holzbauer
email: [email protected]
affiliation: HTL Leonding
- given-names: Fabian
family-names: Baitura
email: [email protected]
affiliation: HTL Leonding
identifiers:
- type: url
value: >-
https://github.com/Kipper-Lang/Kipper/releases/tag/v0.12.0-alpha.1
description: The GitHub release URL of tag 0.12.0-alpha.0
https://github.com/Kipper-Lang/Kipper/releases/tag/v0.12.0
description: The GitHub release URL of tag 0.12.0
repository-code: 'https://github.com/Kipper-Lang/Kipper/'
url: 'https://kipper-lang.org'
abstract: >-
Expand All @@ -31,6 +39,6 @@ keywords:
- oop-programming
- type-safety
license: GPL-3.0-or-later
license-url: 'https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/LICENSE'
version: 0.12.0-alpha.0
date-released: '2024-07-01'
license-url: 'https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/LICENSE'
version: 0.12.0
date-released: '2024-09-25'
1 change: 1 addition & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ which can be included and used inside a browser without any dependencies.
- `identifiers.description`
- `license-url`
- `version`
- `date-released`

These changes must be committed yourself with a commit message preferably similar to this:

Expand Down
2 changes: 2 additions & 0 deletions kipper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
./kipper/cli/bin/run
12 changes: 6 additions & 6 deletions kipper/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ npm install -g @kipper/cli
$ kipper COMMAND
running command...
$ kipper (--version)
@kipper/cli/0.12.0-alpha.1 linux-x64 node-v18.18.2
@kipper/cli/0.12.0 linux-x64 node-v20.15.0
$ kipper --help [COMMAND]
USAGE
$ kipper COMMAND
Expand Down Expand Up @@ -115,7 +115,7 @@ EXAMPLES
kipper compile -t ts ./path/to/file.kip -o build/ -e utf16le --warnings --log-timestamp
```

_See code: [src/commands/compile.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/kipper/cli/src/commands/compile.ts)_
_See code: [src/commands/compile.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/kipper/cli/src/commands/compile.ts)_

## `kipper help [COMMAND]`

Expand All @@ -132,7 +132,7 @@ OPTIONS
--all see all commands in CLI
```

_See code: [src/commands/help.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/kipper/cli/src/commands/help.ts)_
_See code: [src/commands/help.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/kipper/cli/src/commands/help.ts)_

## `kipper new [LOCATION]`

Expand All @@ -149,7 +149,7 @@ OPTIONS
-d, --default Use the default settings for the new project. Skips the setup wizard.
```

_See code: [src/commands/new.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/kipper/cli/src/commands/new.ts)_
_See code: [src/commands/new.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/kipper/cli/src/commands/new.ts)_

## `kipper run [FILE]`

Expand Down Expand Up @@ -194,7 +194,7 @@ EXAMPLES
kipper run -t ts -o build/ -e utf8 -s "print('Hello, World!');" --warnings --log-timestamp
```

_See code: [src/commands/run.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/kipper/cli/src/commands/run.ts)_
_See code: [src/commands/run.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/kipper/cli/src/commands/run.ts)_

## `kipper version`

Expand All @@ -205,7 +205,7 @@ USAGE
$ kipper version
```

_See code: [src/commands/version.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0-alpha.1/kipper/cli/src/commands/version.ts)_
_See code: [src/commands/version.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.12.0/kipper/cli/src/commands/version.ts)_

<!-- commandsstop -->

Expand Down
6 changes: 3 additions & 3 deletions kipper/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kipper/cli",
"description": "The Kipper Command Line Interface (CLI).",
"version": "0.12.0-alpha.1",
"version": "0.12.0",
"author": "Luna-Klatzer @Luna-Klatzer",
"bin": {
"kipper": "./bin/run",
Expand All @@ -25,7 +25,7 @@
"inquirer": "7.3.3"
},
"devDependencies": {
"@types/node": "20.14.9",
"@types/node": "20.16.5",
"@types/sinon": "17.0.3",
"@types/inquirer": "7.3.3",
"@sinonjs/fake-timers": "11.2.2",
Expand All @@ -39,7 +39,7 @@
"typescript": "5.1.3",
"@oclif/core": "1.26.2",
"oclif": "3.4.6",
"semver": "7.6.2",
"semver": "7.6.3",
"prettier": "3.3.3"
},
"overrides": {
Expand Down
Loading

0 comments on commit 4982c82

Please sign in to comment.