A toy systems scripting language with Go-like syntax that runs as a demand-driven stream.
func gcd(a int, b int) int {
if b == 0 {
return a
}
return gcd(b, a % b)
}
func main() {
print(gcd(252, 105)) // 21
}
- Streaming execution. A program runs as it is read — there is no whole-program gate. A statement can even call a function defined further down the file; chip reads ahead to resolve it (example).
- Minimal, Go-like syntax.
func,:=,if,for, and little else. - Strongly typed, incrementally. Type checking is woven into the stream, not run as a separate pass.
- Packages, Go-style. A package is a directory of
.chpfiles;importit by path and callpkg.Member. Capitalized names are exported; the entry file still streams while imported packages load eagerly (example). - Pure Go. No cgo, no codegen backend — embed it as a library or use the CLI.
- A standard library written in chip. Only
printandlenare built in; the rest grows in chip — including importable packages likemath(import "math", thenmath.Gcd(252, 105)).
go install github.com/jackspirou/chip/cmd/chip@latestchip run examples/hello.chp # run a program (shorthand: chip examples/hello.chp)
chip repl # interactive session
chip fmt <file.chp> # canonical formatting
chip lint <file.chp> # unused names, missing returns, dead code- ARCHITECTURE.md — how chip streams, and the package layout.
- examples/ — small, runnable programs, each verified by a test.
A learning project and a labor of love — expect rough edges and breaking changes. chip reimagines SNARL, a MIPS-targeting teaching compiler, in the spirit of Go's lexical simplicity: extreme minimal syntax, idiomatic Go implementation.