Klang
⚠️
This page is currently under construction.
cargo install klang # To install the Klang toolchain
pip install pyklang # To install the Python frontend
Klang is a domain-specific language (DSL) for programming robots.
Klang is built into K-Scale OS, and is designed to be a simple and flexible way to get started building robot applications. Right now, it is basically a glorified templating engine. Klang commands are executed by the neural interpreter described below. Here is a sample Klang program:
> wave [arm] arm {
> wave joint [joint] twice {
move joint [joint] on the [arm] arm to 90
move joint [joint] on the [arm] arm to 0
}
" wave joint [1] twice
" wave joint [2] twice
" wave joint [3] twice
}
> wave both arms {
" wave [right] arm
" wave [left] arm
}
" wave both arms
This converts to the following tree:
wave both arms {
wave right arm {
wave joint 1 twice {
move joint 1 on the right arm to 90
move joint 1 on the right arm to 0
}
wave joint 2 twice {
move joint 2 on the right arm to 90
move joint 2 on the right arm to 0
}
wave joint 3 twice {
move joint 3 on the right arm to 90
move joint 3 on the right arm to 0
}
}
wave left arm {
wave joint 1 twice {
move joint 1 on the left arm to 90
move joint 1 on the left arm to 0
}
wave joint 2 twice {
move joint 2 on the left arm to 90
move joint 2 on the left arm to 0
}
wave joint 3 twice {
move joint 3 on the left arm to 90
move joint 3 on the left arm to 0
}
}
}
Neural Interpreter
Below is a diagram showing the architecture of the Klang neural interpreter.