Getting started
Install Kyna, create a project, and run your first program.
1. Install the CLI
Kyna is currently distributed through the official npm preview package. Node.js 18 or newer is required for the installer and command shim.
npm install --global @kyna-language/cli@preview
ky --version
The package installs the native compiler for your platform and exposes both
ky and kyna commands.
Other installers
With Bun, use --trust so it runs Kyna's native installation and checksum
verification:
bun add --global --trust @kyna-language/cli@preview
macOS or Linux without a JavaScript package manager:
curl -fsSL https://github.com/Up-to-code/Kyna/releases/download/v1.0.0-preview.3/install.sh | sh -s -- --channel preview --version 1.0.0-preview.3
Windows PowerShell:
& ([scriptblock]::Create((irm 'https://github.com/Up-to-code/Kyna/releases/download/v1.0.0-preview.3/install.ps1'))) -Channel preview -Version 1.0.0-preview.3
The direct installers do not require Node.js. The Bun package path currently does because the published command shim uses Node.js.
2. Create a project
ky new hello --template minimal
cd hello
You can also create a single file named hello.kyna:
fn calculateRate(total: int, seconds: int): int {
if (seconds <= 0) {
return 0;
}
return total / seconds;
}
const requests = 12000;
const duration = 60;
print("Rate:", calculateRate(requests, duration), "req/s");
3. Check and run
ky check hello.kyna
ky run hello.kyna
Expected output:
Rate: 200 req/s
ky check reports type, binding, and control-flow problems without running the
program. ky run checks and executes it.
Essential commands
| Command | Purpose |
|---|---|
ky new <name> | Create a project |
ky run <file-or-dir> | Run a file or package |
ky check <file-or-dir> | Type-check without running |
ky fmt <file-or-dir> | Format source code |
ky repl | Open the interactive shell |
ky doctor | Check the installation |
ky tokens, ast, hir, mir, bytecode | Inspect compiler stages |
A directory is a package. Its *.kyna files share one namespace, except files
ending in *_test.kyna. Read Modules and packages for
imports, exports, and package boundaries.
Build from source
Use this path only when changing the compiler itself. It requires CMake 3.25+, Python 3.10+, a C++23 compiler, and libcurl.
git clone https://github.com/Up-to-code/Kyna.git
cd Kyna
cmake --preset debug
cmake --build --preset debug
ctest --preset debug
Continue learning
- Follow the language tour.
- Learn variables and bindings.
- Understand types and nullability.
- Split a project with modules and packages.