1
0
Go to file
2026-01-21 21:59:27 +01:00
cmd/treerack error fixes and doc updates 2026-01-21 20:54:16 +01:00
docs error fixes and doc updates 2026-01-21 20:54:16 +01:00
internal/self error fixes and doc updates 2026-01-21 20:54:16 +01:00
scripts documentation 2026-01-18 22:52:27 +01:00
.gitignore refactor build 2026-01-16 01:03:43 +01:00
.travis.yml update travis key 2017-11-05 04:05:22 +01:00
boot_test.go drop manual boot 2018-01-04 19:27:43 +01:00
boot.go use generated syntax for all parsers 2018-01-05 19:06:10 +01:00
char_test.go recover tests 2018-01-06 21:30:07 +01:00
char.go use generated syntax for all parsers 2018-01-05 19:06:10 +01:00
chardefine.go generator tests 2018-01-06 22:56:26 +01:00
check_test.go add recent mml syntax 2018-08-19 19:36:23 +02:00
choice.go add keyword commit type 2019-02-02 18:07:10 +01:00
choicedefine.go fix generated builder: builders didn't have the generalizations registered 2019-01-27 18:29:30 +01:00
context_test.go simplify build time pending check 2017-11-06 11:41:00 +01:00
context.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
define.go add keyword commit type 2019-02-02 18:07:10 +01:00
errors_test.go refactor parsing phase 2017-12-31 17:34:10 +01:00
escape_test.go documentation 2026-01-18 22:52:27 +01:00
escape.go documentation 2026-01-18 22:52:27 +01:00
format_test.go remove randomness from code generation 2018-01-09 03:53:20 +01:00
gendoc.go add go modules 2025-08-19 00:56:08 +02:00
generate_test.go generator tests 2018-01-06 22:56:26 +01:00
go.mod refactor build 2026-01-16 01:03:43 +01:00
go.sum refactor build 2026-01-16 01:03:43 +01:00
head.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
headexported.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
idset_test.go improve testing 2017-11-05 03:28:36 +01:00
idset.go track parsers by numeric id 2017-07-15 21:49:08 +02:00
json_test.go documentation 2026-01-18 22:52:27 +01:00
keyval_test.go documentation 2026-01-18 22:52:27 +01:00
keyword_test.go documentation 2026-01-18 22:52:27 +01:00
license use non-screaming casing 2025-10-22 21:01:15 +02:00
Makefile error fixes and doc updates 2026-01-21 20:54:16 +01:00
mml_test.go documentation 2026-01-18 22:52:27 +01:00
mmlexp2_test.go documentation 2026-01-18 22:52:27 +01:00
mmlexp3_test.go documentation 2026-01-18 22:52:27 +01:00
mmlexp_test.go documentation 2026-01-18 22:52:27 +01:00
node_test.go improve testing 2017-11-05 03:28:36 +01:00
node.go refactor build 2026-01-16 01:03:43 +01:00
nodehead.go documentation 2026-01-18 22:52:27 +01:00
notes.txt error fixes and doc updates 2026-01-21 20:54:16 +01:00
open_test.go fix choice error reporting 2017-11-25 22:01:02 +01:00
parse_test.go error fixes and doc updates 2026-01-21 20:54:16 +01:00
readme.md add made in Berlin 2026-01-21 21:59:27 +01:00
registry.go remove randomness from code generation 2018-01-09 03:53:20 +01:00
results_test.go simplify build time pending check 2017-11-06 11:41:00 +01:00
results.go refactor parsing phase 2017-12-31 17:34:10 +01:00
run_test.go fix bug with building empty items of sequences 2017-11-04 22:08:15 +01:00
scheme_test.go documentation 2026-01-18 22:52:27 +01:00
sequence.go add keyword commit type 2019-02-02 18:07:10 +01:00
sequencedefine.go fix generated builder: builders didn't have the generalizations registered 2019-01-27 18:29:30 +01:00
sexpr_test.go documentation 2026-01-18 22:52:27 +01:00
syntax_test.go add keyword commit type 2019-02-02 18:07:10 +01:00
syntax.go documentation 2026-01-18 22:52:27 +01:00
syntax.treerack add keyword commit type 2019-02-02 18:07:10 +01:00
syntaxhead.go documentation 2026-01-18 22:52:27 +01:00
whitespace_test.go improve testing 2017-11-05 03:28:36 +01:00
whitespace.go improve testing 2017-11-05 03:28:36 +01:00

treerack

A parser generator for Go.

Treerack defines and generates recursive descent parsers for arbitrary syntaxes, processing input content into its Abstract Syntax Tree (AST) representation. It utilizes a custom syntax definition format derived from EBNF (Extended Backus-Naur Form), allowing for clear and concise grammar descriptions.

Examples

Overview

Treerack operates without a separate lexing phase, parsing character streams directly to produce an AST. The syntax language supports recursive references, enabling the definition of context-free grammars.

We can define syntaxes during development and use the provided tool to generate static Go code, which is then built into the application. Alternatively, the library supports loading syntaxes dynamically at runtime.

The parser engine handles recursive references and left-recursion internally. This way it makes it more convenient writing intuitive grammar definitions, and allows defining context-free languages without complex workarounds.

Installation

From source (recommended):

git clone https://code.squareroundforest.org/arpio/treerack
cd treerack
make install

Alternatively ("best effort" basis):

go install code.squareroundforest.org/arpio/treerack/cmd/treerack

Documentation

Developer Notes

We use a Makefile to manage the build and verification lifecycle.

Important: generating the parser for the Treerack syntax itself (bootstrapping) requires multiple phases. Consequently, running standard go build or go test commands may miss subtle consistency problems.

The decisive way to verify changes is via the makefile:

make check

Limitations

  • Lexer & UTF-8: Treerack does not require a lexer, which simplifies the architecture. However, this enforces the use of UTF-8 input. We have considered support for custom tokenizers as a potential future improvement.
  • Whitespace Delimited Languages: due to the recursive descent nature and the lack of a dedicated lexer state, defining whitespace-delimited syntaxes (such as Python-style indentation) can be difficult to achieve with the current feature set.

Made in Berlin, DE