Vyacc is a LALR(1) parser generator written in Vlang, inspired by Yacc/Bison but designed to be modern, simple, and modular.
Its main goal is to make the development of programming languages, DSLs, and robust parsers easier and more efficient.
- 📚 Full support for LALR(1) grammars
- 🛠 Automatic AST (Abstract Syntax Tree) generation
- 🏎 Native performance powered by V
- 🎯 Clear syntax, familiar to Yacc/Bison users
- 🔗 Easy integration with your V projects
v install siguici.vyacc
mkdir -p ${VMODULES:-$HOME/.vmodules}/siguici
git clone --depth=1 https://github.com/siguici/vyacc ${VMODULES:-$HOME/.vmodules}/siguici/vyacc
In your v.mod
file:
Module {
dependencies: ['siguici.vyacc']
}
The repository also provides native installers for manual installation:
- Linux / macOS :
install.sh
- Windows :
install.ps1
Minimal example of a grammar file example.y
:
%token NUMBER
%left '+' '-'
%left '*' '/'
%%
expr: expr '+' expr { $$ = $1 + $3; }
| expr '*' expr { $$ = $1 * $3; }
| NUMBER { $$ = $1; }
;
Generate the parser:
vyacc example.y -o parser.v
v run parser.v
v test .
Contributions are welcome!
- Fork the repository
- Create a branch
feature/my-feature
- Submit a PR 🚀
Vyacc is distributed under the MIT License. You are free to use, modify, and share it.
Made with ❤️ by Sigui Kessé Emmanuel.