Skip to content

SprigA small JVM language for people and AI

Python-like syntax, static types, runs on the JVM. When something is wrong, the compiler tells you where, why, and how to fix it.

Sprig

A first look ​

spr
import java.time.LocalDate as LocalDate

variant Shape:
    Circle(radius: Float)
    Rect(width: Float, height: Float)

func area(shape: Shape) -> Float:
    return match shape:
        case Shape.Circle as circle:
            3.14159 * circle.radius * circle.radius
        case Shape.Rect as rect:
            rect.width * rect.height

print(area(Shape.Circle(radius=1.0)))
print(area(Shape.Rect(width=2.0, height=3.5)))

let day = LocalDate.parse("2026-10-05")
if day != null:
    print(day.getDayOfWeek())

Output:

text
3.14159
7.0
MONDAY

Add a Triangle to Shape later and forget to update area, and sprig check points straight at it:

text
SPR-MATCH-NONEXHAUSTIVE [FLOW] main.spr:9:12: Missing case: Shape.Triangle
  hint: Add 'case Shape.Triangle:' (there is no default case)

What you can build ​

  • Command-line tools and automation scripts
  • JSON and text processing
  • Small web services and SQLite apps (see the examples)
  • Programs that use existing Java libraries from Maven
  • The game logic of a Minecraft mod (see Fabric integration)

Can I use it yet? ​

Sprig is young. The current release is the experimental v0.9.0-beta.1, requiring JDK 21+. The features above and the syntax used by the tutorial are included in this SDK. It has no Sprig class inheritance or variance and is not meant for production use yet. This site follows main; consult release status and your installed compiler for later changes. See known limitations for the full list.

Up and running in five minutes ​

You need JDK 21 or newer. Once the SDK is installed:

bash
sprig init hello
cd hello
sprig resolve
sprig run

When you see Hello, Sprig!, head to the tutorial and build a small expense tracker in about half an hour.

Get involved ​

  • Found a bug, or something feels awkward? Open an issue.
  • Want to contribute code? Read the contributing guide, then pick an open issue.
  • Code written with an AI assistant is welcome, as long as you've read it and tested it yourself.

中文 · Apache-2.0 · GitHub

Sprig is licensed under Apache-2.0 · v0.7.1-beta.1 published as a prerelease