October 2022
Week of 2022-10-31β
-
Revised
returnhandling so that a return statement with no expression is syntax sugar forreturn None. This enables early exits in functions that implicitly returnNoneto be cleaner:def just_return(): return -
Added support for parsing more expressions: if-else, bitwise operators, shift operators, comparisons, floor division, remainder, and matmul.
-
π’ The type of the
selfargument can now be omitted on member methods.
Week of 2022-10-24β
-
Added parser support for right-associativity and unary ops, like the power operator
a ** b ** cand negation operator-a. -
Add support for
&exprin Mojo, which allows denoting a by-ref argument in functions. This is required because theselftype of a struct method is implicitly a pointer. -
Implemented support for parametric function declarations, such as:
struct SIMD[dt: DType, width: index]: fn struct_method(self: &SIMD[dt, width]): pass def fancy_add[dt: DType, width: index]( lhs: SIMD[dt, width], rhs: SIMD[dt, width]) -> index: return width
Week of 2022-10-17β
-
Added explicit variable declarations with
var, for declaring variables both inside functions and structs, with support for type references. Addedindexas a temporary built-in type.def foo(lhs: index, rhs: index) -> index: var result: index = lhs + rhs return result -
Implemented support for parsing struct declarations and references to type declarations in functions! In
def, the type can be omitted to signal an object type.struct Foo: var member: index def bar(x: Foo, obj) -> index: return x.member -
Implemented parser support for
ifstatements andwhileloops!def if_stmt(c: index, a: index, b: index) -> index: var result: index = 0 if c: result = a else: result = b return result def while_stmt(init: index): while init > 1: init = init - 1 -
Significantly improved error emission and handling, allowing the parser to emit multiple errors while parsing a file.
Week of 2022-10-10β
-
Added support for parsing integer, float, and string literals.
-
Implemented parser support for function input parameters and results. You can now write parametric functions like,
def foo[param: Int](arg: Int) -> Int: result = param + arg return result
Week of 2022-10-03β
-
Added some basic parser scaffolding and initial parser productions, including trivial expressions and assignment parser productions.
-
Implemented basic scope handling and function IR generation, with support for forward declarations. Simple functions like,
def foo(x: Int):Now parse! But all argument types are hard-coded to the MLIR
indextype. -
Added IR emission for simple arithmetic expressions on builtin types, like
x + y.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!