Skip to content

1. Your first program ​

The smallest Stated source defines a named function that copies an input sequence into a fresh result sequence.

Prerequisites ​

Install Go 1.24 or newer and clone the Stated compiler repository. Run every command below from the compiler repository root.

Save the complete program ​

Create copy.st with exactly this source:

txt
Define copy-values as a function.
It accepts an integer sequence named input.
Collect the input values in encounter order into a fresh sequence. Retain every occurrence.

Generated Go ​

go
package generated

func CopyValues(p0 []int64) ([]int64, error) {
	result := make([]int64, len(p0))
	copy(result, p0)
	return result, nil
}

This is the callable Go emitted by the compiler. Stated adds no runtime or executable wrapper.

Compile it ​

sh
make stated INPUT=copy.st

The command prints the input source followed by its generated Go. You can also run bin/stated -source copy.st directly.

Exercise ​

What does CopyValues([]int64{}) return?

Verified solution

It returns a fresh empty []int64. The generated function has no process protocol or hidden execution state.

Download copy.st · Download generated Go

Continue: Inputs and results →

Stated compiles controlled English deterministically. It does not call an LLM at compile time.