Skip to content

jackspirou/chip

Repository files navigation

chip

CI Go Reference Go Report Card License: MIT

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
}

Why chip

  • 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 .chp files; import it by path and call pkg.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 print and len are built in; the rest grows in chip — including importable packages like math (import "math", then math.Gcd(252, 105)).

Install

go install github.com/jackspirou/chip/cmd/chip@latest

Usage

chip 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

Learn more

  • ARCHITECTURE.md — how chip streams, and the package layout.
  • examples/ — small, runnable programs, each verified by a test.

Status

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.

License

MIT

About

Chip is a toy scripting language.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages