Skip to content

Ratslang

Configuration language for
building physical systems in Rust.

rat.rl
# A robot rat for maze trials.
rat {
  # @type length
  # @min 1cm
  # @max 10cm
  whisker.length = 4cm

  # @type velocity
  # @max 2m/s
  scurry_speed = 1.2m/s

  # @enum CURIOUS, SNEAKY, HANGRY
  mood = CURIOUS

  nap_after = 20min
}
  • The unit is part of the value

    36km/h and 10m/s are the same speed on a type-level. A bound of @max 2m rejects 250cm, whichever unit either side is written in.

    Units and dimensions →

  • The default file is the schema

    @type, @min and @enum comments in your default check user files and drive completion and hover text in the editor.

    Schemas and constraints →

  • Deserialize into Rust structs

    Serde reads values into uom quantities, so a length stays a length without losing conversion accuracy.

    Serde integration →

  • LSP for your editor

    Completion, hover docs, diagnostics and quick fixes from the same schema rules the application checks. Set up for Helix, Neovim and VS Code.

    Editor setup →

Ratslang is intentionally small: assignments, references, namespaces, and includes.