Skip to content

Commit 80e1ea5

Browse files
authored
feat: implement ANTLR grammar-aware fuzzing library for parser testing (#17)
* feat: initialize fuzz * fix: remove range * feat: parse grammar IR * feat: lexer parser v1 * feat: generator for lexer rules * chore: merge grammars * chore: remove list grammar options * v1 * chore: go mod tidy
1 parent 1f80ab0 commit 80e1ea5

File tree

13 files changed

+2899
-267
lines changed

13 files changed

+2899
-267
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@ go.work.sum
4444
# node_modules
4545
**/node_modules/
4646

47-
**/*.class
47+
**/*.class
48+
49+
# No binary files
50+
**/bin/**

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.24.5
44

55
require (
66
github.com/antlr4-go/antlr/v4 v4.13.1
7+
github.com/pkg/errors v0.9.1
78
github.com/stretchr/testify v1.10.0
89
)
910

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/bytebase/antlr/v4 v4.0.0-20240827034948-8c385f108920 h1:IfmPt5o5R70NK
22
github.com/bytebase/antlr/v4 v4.0.0-20240827034948-8c385f108920/go.mod h1:ykhjIPiv0IWpu3OGXCHdz2eUSe8UNGGD6baqjs8jSuU=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
6+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
57
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
68
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
79
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=

tools/fuzzing/DESIGN.md

Lines changed: 0 additions & 230 deletions
This file was deleted.

tools/fuzzing/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.PHONY: all test clean help
2+
3+
all: test
4+
5+
# Run tests
6+
test:
7+
@echo "Running tests..."
8+
go test -v github.com/bytebase/parser/tools/fuzzing/...
9+
10+
# Clean build artifacts
11+
clean:
12+
@echo "Cleaning..."
13+
go clean
14+
15+
# Install dependencies
16+
deps:
17+
@echo "Installing dependencies..."
18+
cd ../.. && go mod tidy && go mod download
19+
20+
# Format code
21+
fmt:
22+
@echo "Formatting code..."
23+
go fmt github.com/bytebase/parser/tools/fuzzing/...
24+
25+
# Run linter
26+
lint:
27+
@echo "Running linter..."
28+
golangci-lint run
29+
30+
# Show help
31+
help:
32+
@echo "Available targets:"
33+
@echo " test - Run all tests"
34+
@echo " clean - Clean build artifacts"
35+
@echo " deps - Install/update dependencies"
36+
@echo " fmt - Format all Go code"
37+
@echo " lint - Run golangci-lint"
38+
@echo " help - Show this help message"

0 commit comments

Comments
 (0)