Skip to main content

Tools

The kalem command​

kalem check --catalog catalog.json scripts/*.kalem # problems, with file:line:column
kalem build --catalog catalog.json --list script.kalem # bytecode, in readable form with --list
kalem run scenario.json # plays a world step by step and writes its trace

kalem fmt (one format) and kalem test (conformance tests) are coming.

The language server​

kalem-lsp works on unsaved text and tolerates errors; Sakin Editor carries it and starts one per project.

  • Errors as you type (syntax, types, effects), colouring, completion (catalog events, contract fields, natives), documentation on hover, go to definition, usages and an outline.
  • Positions are UTF-16 by default, UTF-8 when the client offers it.
  • Locals and functions can be renamed freely. For a property or memory it suggests a was for the migration; renaming a script is the editor's change of identity. It never edits files silently.

The debugger​

It works with the frames, locals and pending writes the VM keeps open, and serves every target through the same design; in Sakin Editor it is IntelliJ's own debugger (Play and Debug).

  • A breakpoint is a script's id and a line; a transaction stops when it enters that line (a line counts once; a line with only a jump or a return does not stop).
  • Steps: over (the next line of this function or of its caller), into, out; a step ends with the call.
  • A pause is in memory: the frames and the open transaction are kept, the world's clock stops, nothing is saved. It shows the transaction, its frames with their locals, the instance's state and memory, the fields it reads and writes with the writes not applied yet, and the properties.
  • Breakpoints can change during a pause and apply at once; one set before the start stops in on ready too.
  • Coming: conditional and log breakpoints, watch expressions (only pure or read), client effects, and a debug adapter (DAP) for other editors.

The profiler​

Every transaction's trace line carries its moment, what fired it (a timer, an event, the start, a migration), its cost, the bytes of strings it made, the fields it wrote and how long it took. The time is measured by the machine's clock and only observed: it changes no behaviour. The report also gives a transaction's budget. Play's Profile panel shows them; queue depth and timer counts are coming.