Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.7.0 #127

Merged
merged 11 commits into from
May 22, 2022
Merged

v0.7.0 #127

merged 11 commits into from
May 22, 2022

Conversation

Luna-Klatzer
Copy link
Member

What type of change does this PR perform?

  • Development or internal changes (These changes do not add new features or fixes bugs, but update the code in other ways)
  • Bug fix (Non-breaking change which fixes an issue)
  • New feature (Non-breaking change which adds functionality)

Summary

Merges the full v0.7.0 update into main.

Changes

  • Implementation and support for variable declarations, definitions and assignments.
  • Identifier references and improved type checking for arithmetic, assignments and function calls.
  • New class KipperTypeChecker responsible for handling type checking in Kipper code.
  • New class KipperSemanticChecker responsible for handling general semantic analysis, and integrity and cohesion checks.
  • New simplified single character flags for the CLI.
  • New flag -s/--stringCode for using the CLI.
  • Improved and updated logging for the core package and the CLI.
  • Many bug fixes.

Does this PR create new warnings?

No.

Changelog

Added

  • Implemented code generation for declarations, definitions and variable assignments
    (#26).
  • Implemented semantic analysis for AssignmentExpression and VariableDeclaration.
  • Implemented support for identifiers references, which means variables can now be used in the following contexts:
    • As a function call argument: call print(identifier)
    • As a value in an arithmetic expression: identifier + identifier or identifier + 5
  • Implemented CLI flag -s/--stringCode, which can be used as a replacement for the argument file.
    (#100). This flag is available for kipper analyse,
    kipper compile and kipper run)
  • Implemented single char flags for the CLI (#109).
  • Additional metadata and stack info when non-compiler errors are thrown during runtime in the CLI.
  • New fields:
    • VariableDeclarationSemantics.value, which represents the expression that was assigned in the definition.
      This field is undefined if VariableDeclarationSemantics.isDefined is false.
  • New functions:
    • CompileAssert.validAssignment(), which asserts that an assignment expression is valid.
    • abstract CompilableParseToken.semanticTypeChecking(), which must be implemented by every child and should serve
      as a separate semantic type checking step outside of primarySemanticAnalysis().
  • New classes:
    • KipperAsserter, which is an abstract base class that represents a class that can be used to assert certain truths
      and handle/throw compile errors.
    • KipperTypeChecker and KipperSemanticChecker, which perform specialised semantic checking and verify logical
      integrity and cohesion. These two classes replace CompileAssert.
  • New errors:
    • InvalidAssignmentError, which is thrown when an invalid assignment is used.
    • KipperInvalidInputError, which is thrown when passing invalid input to the Kipper cli.

Changed

  • Optimised Kipper parsing and lexing process by updating the parsing behaviour in Kipper.g4. Kipper should handle
    standard expressions a lot faster from no on.
  • Fixed bug #104, which caused an invalid evaluation of the return
    type of string additive expressions causing invalid type errors when used with other expressions.
  • Fixed CLI issues with unrecognisable non-printable unicode characters, which caused errors with the Antlr4 Parser and
    Lexer, when reading files using the utf16le encoding.
  • Fixed NULL character issue #114 when writing TypeScript code onto
    files using the utf16le encoding. From now on a buffer will be created using the proper encoding (also for
    ascii and utf8) that should be properly writable to a file.
  • Fixed incomplete translation bug #118 of chained arithmetic
    expressions with the same operator (N + N + N) resulting in incomplete TypeScript code.
  • Fixed bug #111, which caused an invalid evaluation of the
    return type of string expressions.
  • Updated logger messages.
  • Updated compiler folder structure of the core package:
    • compiler/parser from now on contains everything parser and lexer-related.
    • compiler/parser/antlr from now on contains the Antlr4 generated parser and lexer files.
    • compiler/semantics from now on contains everything semantics related, such as the file listener, the Kipper
      tokens, logical constants etc.
    • compiler/translation from now on contains the classes and tools used for translating Kipper code into another
      language.
    • compiler/targets from now on contains the existing targets for Kipper, such as typescript.
    • compiler/lib from now on contains the standard library and built-ins for Kipper.
    • compiler/lib/import from now on contains the default importable libraries for Kipper.
  • Renamed:
    • Error InvalidTypeError to TypeError.
    • Function KipperProgramContext.addNewGlobalScopeEntry to addGlobalVariable().
    • Function CompoundStatement.addNewLocalVariable to addLocalVariable().

Removed

  • Unnecessary traceback when encountering Kipper runtime errors as explained in
    #110.
  • Option to use unary expressions for the left-hand side of an assignment expression in Kipper.g4. (Only identifiers
    may be used.)
  • Option to redeclare variables. From on a variable declaration can only be done once and afterwards the variable may
    only be overwritten or modified, but not re-declared. This should help make Kipper have a similar behaviour to
    TypeScript.

Linked other issues or PRs

@Luna-Klatzer Luna-Klatzer added release New release of the Kipper module. skip changelog Do not include in the changelog when a new release is drafted labels May 22, 2022
@Luna-Klatzer Luna-Klatzer self-assigned this May 22, 2022
@Luna-Klatzer Luna-Klatzer added this to the Stable Kipper Release milestone May 22, 2022
@Luna-Klatzer Luna-Klatzer merged commit 2ad249b into main May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release New release of the Kipper module. skip changelog Do not include in the changelog when a new release is drafted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant