Skip to content

Five-minute quick start ​

By the end of this page you will have checked one source file, run it, built an executable, and inspected its generated Go.

1. Create a source file ​

Save this program as hello.km:

ts
import go fmt from "fmt";

function main(): void {
  fmt.Println("Hello from Kinmokusei");
}

import go gives the file an explicit namespace for an ordinary Go package. Nothing from fmt is placed into the file scope implicitly.

2. Check before running ​

sh
keika check hello.km

A valid file produces no output and exits with status 0. check lexes, parses, resolves imports, and performs semantic checking; it does not generate or execute a program.

3. Run the program ​

sh
keika run hello.km

Expected output:

text
Hello from Kinmokusei

run generates a project-local Go module, invokes the selected Go toolchain, and executes the program. A locked cross-target project is rejected before execution; use build for cross-compilation.

4. Build an executable ​

sh
keika build -o hello hello.km

The output is a native executable for the active or project-locked target.

5. Inspect generated Go ​

sh
keika emit-go -o generated.go hello.km

The generated file is formatted and intentionally readable:

go
// Code generated by Kinmokusei. DO NOT EDIT.
package main

import fmt "fmt"

func main() {
	fmt.Println("Hello from Kinmokusei")
}

emit-go is a publication boundary, not only a debugging aid. Generated output is standalone Go and does not require the compiler at consumer build time.

Read a diagnostic ​

If fmt.Println receives a value that cannot connect to the Go API, or a local is used with the wrong Kinmokusei type, check reports the original .km path and source span. Machine consumers can request the stable JSON envelope:

sh
keika check --json hello.km

The exit status is 0 for valid source, 1 for invalid source or project input, and 2 for command misuse. See Diagnostics for the schema.

Where next? ​

Kinmokusei is a pre-1.0 project. Documentation describes implemented behavior.