#scripting #language #koto


A Koto library for working with temporary files

13 releases (breaking)

0.11.0 Jul 14, 2022
0.10.0 Dec 2, 2021
0.9.1 Nov 1, 2021
0.7.0 Mar 27, 2021
0.5.0 Dec 17, 2020

#219 in Filesystem

Download history 1/week @ 2022-11-24 2/week @ 2022-12-01 9/week @ 2022-12-08 4/week @ 2022-12-15 18/week @ 2022-12-22 3/week @ 2022-12-29 5/week @ 2023-01-05 1/week @ 2023-01-12 6/week @ 2023-01-19 8/week @ 2023-01-26 13/week @ 2023-02-02 27/week @ 2023-02-09 70/week @ 2023-02-16 15/week @ 2023-02-23 3/week @ 2023-03-02 4/week @ 2023-03-09

101 downloads per month
Used in koto_cli

MIT license

11K SLoC


Docs Crates.io rustc CI Discord

Koto is an embeddable scripting language, written in Rust. It has been designed for ease of use and built for speed, with the goal of it being an ideal choice for adding scripting to Rust applications.

Koto is versatile enough to be useful in a variety of applications, although there has been a focus during development on interactive systems, such as rapid iteration during game development, or experimentation in creative coding.

Current State

The language itself is far enough along that I'm happy to share it with the wider world, although you should be warned that it's at a very early stage of development, and you can expect to find missing features, usability quirks, and bugs. Parts of the language are likely to change in response to it being used in more real-world contexts. We're some distance away from a stable 1.0 release.

That said, if you're curious and feeling adventurous then please give Koto a try, your early feedback will be invaluable.

Getting Started

A Quick Tour

# Numbers
x = 1 + 2.5 + 100.sqrt()
assert_eq x, 13.5

# Strings
name = "Koto"
print "Hello, $name!"

# Functions
square = |n| n * n
print "8 squared is ${square 8}"

add_squares = |a, b| (square a) + (square b)
assert_eq (add_squares 2, 4), 20

# Iterators, ranges, and lists
fizz_buzz = (1..100)
  .keep |n| (10..=15).contains n
  .each |n|
    match n % 3, n % 5
      0, 0 then "Fizz Buzz"
      0, _ then "Fizz"
      _, 0 then "Buzz"
      else n
  ["Buzz", 11, "Fizz", 13, 14, "Fizz Buzz"]

# Maps and tuples
x = {peaches: 42, pears: 99}
  ("peaches", "pears")

y = # Maps can also be defined using indented `key: value` pairs
  apples: 123
  plums: 99

fruits = x + y # Maps can be combined using the `+` operator

fruit, amount = fruits.max |(_, amount)| amount
print "The highest amount of fruit is: $amount $fruit"

Learning the Language

The language guide gives an overview of Koto's features.

There are also some code examples that are a good starting point for getting to know the language.

Reference documentation for Koto's core library can be found here.

You're also welcome to ask for help in Discussions, or on the discord server.


The most recent release of the Koto CLI can be installed with Cargo:

cargo install koto_cli


A REPL is provided to allow for quick experimentation. Launching the koto CLI without providing a script enters the REPL.

» koto
Welcome to Koto 
» 1 + 12
» print "{}, {}!", "Hello", "World"
Hello, World!
➝ null

A help system is included in the REPL. Run help for instructions.

Language Goals

  • A clean, minimal syntax designed for coding in creative contexts.
  • Fast compilation.
    • The lexer, parser, and compiler are all written with speed in mind, enabling as-fast-as-possible iteration when working on an idea.
  • Fast and predictable runtime performance.
    • Memory allocations are reference counted.
    • Currently there's no tracing garbage collector (and no plan to add one) so memory leaks are possible if cyclic references are created.
  • Lightweight integration into host applications.
    • One of the primary use cases for Koto is for it to be embedded as a library in other applications, so it should be a good citizen and not introduce too much overhead.

Editor Support


A Koto language module for working with temporary files


~156K SLoC