GoForge — Build | Test | Ship | Collaborate GoForge — Build | Test | Ship | Collaborate
v0.3.0

participle

Grammar-indexed parser construction

$ go get goforge.dev/participle@v0.3.0

goforge.dev/participle is the /goals/10-participle semantic rewrite of Participle. It is authored in Go+ and distributed as ordinary generated Go.

Version 0.3.0 is the current release. Go and Java 25 are generated from the same parser.gp and runtime.gp semantics, published as goforge.dev/participle@v0.3.0 and dev.goforge:participle:0.3.0. Browse the Go package documentation.

Java and Maven Central

The Java artifact is built from the same Go+ enums, indexed grammar structures, and assignment parser as the Go package; it is not a hand-maintained port. Java-specific conformance tests cover successful parsing and exact failure positions. Maven Central receives the binary, generated sources, documentation, POM provenance, checksums, and OpenPGP signatures. Browse the immutable Maven Central release.

<dependency>
  <groupId>dev.goforge</groupId>
  <artifactId>participle</artifactId>
  <version>0.3.0</version>
</dependency>

Grammar facts in types

  • Expression[n] is a grammar GADT indexed by minimum token consumption.
  • Grammar[g], FirstSet[g], and Parser[g,T] must carry the same identity.
  • Span[n] ties each source range to the number of grammar tokens it covers.
  • Lookahead consumes zero tokens, commit preserves consumption, sequences add a token, and alternatives must agree.
  • Dynamic grammars cross an existential package boundary and regain a static identity only after their retained runtime witness is checked.

The forcing case also improved Go+ v0.27.0: omitted natural witnesses are now inferred consistently across every indexed argument, including imported calls. Mixing a grammar with another grammar’s FIRST evidence is rejected during Go+ generation.

Measured gate

Five semantic benchmark runs over 256 assignments measured 5,523–5,556 ns and 263 allocations for the rewrite, versus 218,693–219,709 ns and 8,237 allocations for upstream Participle v2.1.4. Using conservative endpoints, the rewrite is at least 39.3x faster with 96.8% fewer allocations.

Provenance and scope

The baseline is github.com/alecthomas/participle/v2 v2.1.4 at commit bcbb39153e17f8018257f17aba8eac628d396b64, MIT licensed. Version 0.3 targets the documented assignment-language compatibility surface; it does not claim drop-in compatibility with the complete reflection/tag API.