A Go compiler kit that generates lexers and parsers from BNF grammars with LR-1 conflict resolution.
Gocc is a parser and scanner generator for Go that creates lexers and parsers from BNF grammar definitions. It solves the problem of building custom language processors by automatically generating deterministic finite automata (DFAs) for lexical analysis and pushdown automata (PDAs) for syntactic analysis, with built-in LR-1 conflict resolution.
Go developers building compilers, interpreters, language tools, or any application that requires parsing custom structured text or domain-specific languages.
Developers choose Gocc because it provides a pure-Go, integrated solution for parser generation with seamless AST construction, UTF-8 support, and automatic conflict resolution, avoiding external dependencies or complex toolchains.
Parser / Scanner Generator
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Action expressions allow embedding Go code directly in BNF rules for semantic actions, leveraging Go's type system and error handling seamlessly.
Handles shift/reduce and reduce/reduce conflicts automatically in LR-1 parsers, reducing manual debugging effort for complex grammars.
Generates lexers that fully support UTF-8 input, making it suitable for international text and modern character sets.
Users can define custom abstract syntax trees by embedding Go functions in action expressions, providing fine-grained control over semantics.
Installation and usage assume GOPATH setup, which is outdated compared to Go modules, complicating integration with modern Go projects.
Supports only LR-1 languages, excluding grammars that require more advanced parsing algorithms like LALR or GLR, as admitted by the focus on LR-1.
The user guide is for an older version, and the README mentions a forthcoming update, suggesting potential maintenance or clarity issues for new users.