diff --git a/projects/modernc.org/goyacc/README.md b/projects/modernc.org/goyacc/README.md new file mode 100644 index 0000000000..a929b26dc5 --- /dev/null +++ b/projects/modernc.org/goyacc/README.md @@ -0,0 +1 @@ +Goyacc is a version of yacc generating Go programs. diff --git a/projects/modernc.org/goyacc/package.yml b/projects/modernc.org/goyacc/package.yml new file mode 100644 index 0000000000..33c94f0389 --- /dev/null +++ b/projects/modernc.org/goyacc/package.yml @@ -0,0 +1,52 @@ +distributable: + url: https://gitlab.com/cznic/goyacc/-/archive/{{version.tag}}/{{version.tag}}.tar.gz + strip-components: 1 + +display-name: modernc.org/goyacc + +versions: + gitlab: cznic/goyacc/tags + +build: + dependencies: + go.dev: ~1.19 + env: + CGO_ENABLED: 0 + GO_LDFLAGS: + - -s + - -w + linux: + GO_LDFLAGS: + - -buildmode=pie + script: + - go build -v -ldflags="${GO_LDFLAGS}" -o "{{ prefix }}"/bin/goyacc + - go test + +provides: + - bin/goyacc + +test: + - run: goyacc -o test.go $FIXTURE + fixture: + extname: y + content: | + %{ + package main + %} + + %union { val int } + %token NUM + %type expr term factor + + %% + expr : expr '+' term { $$ = $1 + $3; } + | term { $$ = $1; } + ; + term : term '*' factor { $$ = $1 * $3; } + | factor { $$ = $1; } + ; + factor : '(' expr ')' { $$ = $2; } + | NUM { $$ = $1; } + ; + %% + - grep 'package main' test.go