0.8.11 • Published 1 year ago

kusanagi v0.8.11

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Kusanagi

Build

The initial work on this project was funded by the Origyn Foundation.

CoffeeScript style syntax for the Motoko language. Try Kusanagi

import State "State"

module
  public class Grid(state : State.State)
    let grid = state

    let n = grid.size()

    public func size() : Nat
      n

    func nextCell(i : Nat, j : Nat) : State.Cell
      let l : Nat = living i, j
      if get i, j
        l == 2 or l == 3
      else
        l == 3

    func next(dst : Grid)
      for i in grid.keys()
        let cool = true

        for j in grid[i].keys()
          let yo = "wat"
          dst.set i, j, nextCell i, j

Get Started

npm install -g kusanagi
kusanagi < src.ku > out.mo

Features

  • Indentation based blocks
  • Let shorthand x = 5 -> let x = 5
  • Alternative with syntax
    let x = {
      ...a
      ...b
    }
    becomes
    let x = {
      a and
      b
    }
  • Chained comparisons
    x < y <= z
    Becomes
    x < y and y <= z
  • match
    match x, #nat(val), 0
    ---
    switch(x) {
      case(#nat(val)) { val };
      case(_){ 0 }
    };
  • take
    take x, 0
    ---
    switch(x) {
      case(null) { 0 };
      case(?val) { val }
    };
  • Null soaks
    student.classes?.get(classID)
    ---
    do?{student.classes!.get(classID)};
0.8.9

2 years ago

0.8.11

1 year ago

0.8.8

2 years ago

0.8.10

2 years ago

0.8.7

2 years ago

0.8.6

2 years ago

0.8.5

2 years ago

0.8.4

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.1.0

2 years ago