← All repositories

hivevm/waggle

HiveVM CC, a parser generator forked from JavaCC. Tree building is defined inside the grammar; a Gradle plugin generates parsers in Java, C++ or Rust.

  • Parser generator
  • Gradle plugin
  • Java · C++ · Rust
Language
Java
License
BSD-3-Clause
Commits
1,327 commits
Last update
Oct 2026
View on GitHub

01 / Overview

HiveVM Compiler-Compiler (HiveVM CC) is a parser generator: it reads a grammar and produces a program that recognizes input matching that grammar. It started as a fork of JavaCC 7.0.13 and is no longer grammar-compatible with JavaCC.

It keeps JavaCC’s core ideas, namely LL(k) recursive descent, a token manager with lexical states and tree building, and changes the workflow: one grammar file, tree nodes defined inside the grammar, output in three languages, and a Gradle plugin instead of a command line tool.

02 / Architecture

How it fits together

Parsing model

Top-down recursive descent, LL(1) by default, with syntactic and semantic lookahead for local LL(k) decisions. Left recursion is disallowed.

Grammar syntax

A simplified, EBNF-like syntax with semantic actions marked as islands. Tree building is expressed in the grammar with #Node annotations, in a single step with no separate JJTree pass.

Lexer

Full Unicode support, lexical states, TOKEN, MORE and SKIP, special tokens for things like comments, and a per-token IGNORE_CASE modifier.

Targets

Java, C++ and Rust. Generated Java parsers need only a JRE and have no HiveVM CC runtime dependency.

03 / Decisions

Specifications and decisions

Written specifications and architecture decision records live next to the code, so the reasoning behind the design stays reviewable.

04 / Getting started

Try it

Apply the org.hivevm.cc plugin and describe generation units in a parserProject block. Each task produces one parser from one grammar; target selects java, cpp or rust.

$ git clone https://github.com/hivevm/waggle
$ cd waggle
$ ./gradlew build
$ ./gradlew test

build.gradle

plugins {
  id "org.hivevm.cc" version "1.0.10"
}

parserProject {
  target = 'java'                 // java | cpp | rust
  output = 'src/main/generated'

  task {
    name = 'parser'
    file = 'src/main/resources/JavaCC.jj'
  }
}