JSAbrahams Mamba Versions Save

🐍 The Mamba programming language, because we care about safety

v0.3.6

1 year ago

Language Features

  • Add parsing and checking of dictionary (builders) (#438 )
  • Index uses __getitem__ magic method (#438)
  • Annotate collections with their type (#437)
  • Change String to Str (#435)
  • Allow arm conditions without identifier in handle (#423)

Bug Fixes

  • Verify that types actually exist (#429)
  • Can again infer type of an if expression (#367)
  • Don't generate ternary expression if it contains raises (#420)

Internal

  • Improve shadowing and branching logic in generate stage (#430)
  • Implement fully generics in checker internally (#439)
    • Not fully supported yet in definitions, however (#443)

v0.3.5

1 year ago
  • Exceptions in handle arms used when checking #382
  • Variables declared in match arm conditions usable in match arm bodies #382
  • Create dummy classes in Context for import statements #379
  • Allow comments in source without issue by filtering them out in parse stage #381
  • Don't allow return outside functions #390
  • isa now properly expects an identifier, which identifies a class #391
  • Expression type of match propagated to arms #397
  • Types of equality don't need to be the same #399

v0.3.4

1 year ago
  • Add if expressions, which are converted to Python ternary expressions
  • Allow match expressions (i.e. match to be treated as an expression)
  • For both if and match expressions:
    • Convert expressions in if and match arms to return in function if necessary
    • Propagate assign to variable inwards into arms if necessary
  • Check stage checks if body of function was empty
  • Interfaces specify that they are ABC in Python (Abstract Base Class)
  • None is treated as a special class, not as a special keyword

v0.3.3

1 year ago
  • Make use of match statements in output source from Python 3.10.
  • Use new assign tokens: +=, -=, *=, /=, ^=, <<=, >>=
  • Change not equal token: /= -> !=
  • Add check that self fields can only be used if assigned to first.
  • Improve readability of some error messages.
  • Start annotating output, though currently annotations are inconsistent.
  • Checker can deal with chains of calls a.b.c....
  • Simplify grammar such that classes, type definitions, and imports can be placed in any block. The checker does not yet have logic to deal with such situations, however.

v0.3.2

2 years ago
  • Add Range and Slice to the language
    • A range is an expression, may be iterated over, and has the following notation: expression ( .. | ..= ) expression [ .. expression]
    • A slice is an expression, and has the following notation: expression ( :: | ::= ) expression [ :: expression ] Note that unlike Python, we use :: instead of : to separate single arguments to the slice.
  • Can iterate over all types which implement an iterator
  • Fix several bugs associated with constraining function call arguments with expressions and property calls

v0.3.1

2 years ago

v0.3.1 has been been published as a crate.

Changes

  • Assign to tuples
  • Allow tuple as top-level class construct
  • Type check tuples
  • Remove private token from language

v0.3.0

4 years ago
  • Use new constraint substitution and unification algorithm for type inference
  • Check that statement raises exception that it mentions

A few language features have been removed, these will be re-added as time goes along:

  • Iterating over Tuples
  • Mutable fields within tuples
  • Nested function calls
  • Mutability checks

v0.2.2

4 years ago
  • Parse docstrings (without checking if they are in the correct location)
  • Remove retry keyword from the language
  • Allow passing of default arguments to functions
  • Identify constructors in AST and desugar function call identifier as a class name if indeed constructor

v0.2.1

4 years ago
  • Type check expressions within f-strings
  • Fix parsing of tuples
    • Allow mutable fields within tuples
    • Fields within tuples are class fields if the tuple is a top-level declaration in a class
  • Disallow access to private fields and functions from outside a class

v0.2.0

4 years ago

We have a first basic version of the type checker:

  • Remove ?or from language, which is almost identical to ?
  • Build Contexts and Environments
  • Add simple analysis of project Python files and add these to the typing context
  • Check mutability of variables
  • Do very simple type checking (in future we should use constraint type checking)
  • Add desugaring of inline calls to super and inline constructor arguments
  • Add types to variables and functions where necessary
  • Check whether a type is iterable by checking that it defines an __iter()__ method
  • Implement null safety, with undefined representing null, or None in Python. This is done in a similar fashion to Kotlin, and is baked into the type checker. We opted to not use an Optional type solution, as this makes code slightly too verbose for our purposes

Note we have used the nightly TryFrom feature of Rust. So to build the project, you need the nightly version of Rustc.