Skip to content

twill 1.3.0 — the systems-mode front end

Choose a tag to compare

@martin-k-m martin-k-m released this 10 Aug 15:12
· 30 commits to main since this release

twill 1.3.0 — the systems-mode front end

mode systems is the dialect twill is being rewritten in, on the way to a self-hosted compiler. In 1.3.0 the Go bootstrap parses, type-checks and formats all of it: every file in src/, std/, examples/ and testdata/ — the whole self-hosted compiler and standard library included — now goes through the front end cleanly.

Language features (each mirrored into the self-hosted compiler in lockstep)

  • enum declarations and match expressions — sum types and pattern matching, with wildcard and payload-binding patterns and statement arm bodies.
  • struct declarationsstruct Name { field: Type, ... }, the way the compiler declares its own types.
  • Generics in annotationsArr[I64], Dict[Str, V], Res[T, E], nested and qualified.
  • Res/Opt with postfix ? — built-in Ok/Err/Some/None and error propagation.
  • Typed record literalsPoint { x: 1.0, y: 2.0 }.
  • Field and index assignmentobj.f = v, arr[i] = v, composing.
  • Bitwise operators on I64and, or, xor, shl, shr, bnot.
  • mode systems, qualified type names, contextual unit/type, and grouped multi-line continuation.

Notes

  • Running the self-hosted compiler on the bootstrap is the next step and is not yet done; what remains is the systems-mode runtime primitive library.
  • The array/ML language the bootstrap has always been — tensors, autodiff (forward and reverse mode), the shape checker, the formatter, the CLI — is unchanged and fully backward compatible. Files written by earlier versions still load.

See CHANGELOG.md for the full list.