https://github.com/siguici/vyacc
A lightweight, fast, and modern parser generator for @Vlang.
https://github.com/siguici/vyacc
lexer lexer-generator parser-generator tokenizer vlang vlang-module vlang-package yacc yacc-lex yylex
Last synced: 5 months ago
JSON representation
A lightweight, fast, and modern parser generator for @Vlang.
- Host: GitHub
- URL: https://github.com/siguici/vyacc
- Owner: siguici
- License: mit
- Created: 2025-08-12T01:45:01.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-10-22T01:21:06.000Z (9 months ago)
- Last Synced: 2025-10-22T03:23:01.435Z (9 months ago)
- Topics: lexer, lexer-generator, parser-generator, tokenizer, vlang, vlang-module, vlang-package, yacc, yacc-lex, yylex
- Language: V
- Homepage: https://vpm.vlang.io/packages/siguici.vyacc
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# π Vyacc β LALR(1) Parser Generator in V
> **Vyacc** is a **LALR(1) parser generator** written in [Vlang](https://vlang.io),
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**.
---
## π Features
- π 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
---
## βοΈ Installation
### πΉ Via VPM (Recommended)
```sh
v install siguici.vyacc
````
π¦ [Vyacc on VPM](https://vpm.vlang.io/packages/siguici.vyacc)
---
### πΉ Via Git
```sh
mkdir -p ${VMODULES:-$HOME/.vmodules}/siguici
git clone --depth=1 https://github.com/siguici/vyacc ${VMODULES:-$HOME/.vmodules}/siguici/vyacc
```
---
### πΉ As a project dependency
In your `v.mod` file:
```vmod
Module {
dependencies: ['siguici.vyacc']
}
```
---
### πΉ Native installers
The repository also provides native installers for manual installation:
- **Linux / macOS** : `install.sh`
- **Windows** : `install.ps1`
---
## π₯ Usage
Minimal example of a grammar file `example.y`:
```yacc
%token NUMBER
%left '+' '-'
%left '*' '/'
%%
expr: expr '+' expr { $$ = $1 + $3; }
| expr '*' expr { $$ = $1 * $3; }
| NUMBER { $$ = $1; }
;
```
Generate the parser:
```sh
vyacc example.y -o parser.v
v run parser.v
```
---
## π§ͺ Testing
```sh
v test .
```
---
## π€ Contributing
Contributions are **welcome**!
- Fork the repository
- Create a branch `feature/my-feature`
- Submit a PR π
---
## π License
Vyacc is distributed under the [**MIT License**](/LICENSE.md).
You are free to use, modify, and share it.
Made with β€οΈ by [Sigui KessΓ© Emmanuel](https://github.com/siguici).