Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/udhos/gobule
Golang Go parser for the Bule Language
https://github.com/udhos/gobule
bule-language compiler go interpreter parser
Last synced: about 1 month ago
JSON representation
Golang Go parser for the Bule Language
- Host: GitHub
- URL: https://github.com/udhos/gobule
- Owner: udhos
- License: mit
- Created: 2021-05-13T03:48:07.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T13:16:33.000Z (12 months ago)
- Last Synced: 2024-11-18T00:13:30.017Z (3 months ago)
- Topics: bule-language, compiler, go, interpreter, parser
- Language: Go
- Homepage:
- Size: 77.1 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/udhos/gobule/blob/main/LICENSE)
[](https://goreportcard.com/report/github.com/udhos/gobule)
[](https://pkg.go.dev/github.com/udhos/gobule)
[](https://github.com/udhos/gobule/actions/workflows/cover.yml)
[](https://codecov.io/gh/udhos/gobule)# gobule
Golang Go parser for the [Bule Language](https://github.com/johnowl/owl-rules).
## Usage
```
package mainimport (
"log"
"os""github.com/udhos/gobule/parser"
)func main() {
vars := map[string]interface{}{
"platform": "android",
}envDebug := os.Getenv("DEBUG")
debug := envDebug != ""log.Printf("DEBUG=[%s] debug=%v", envDebug, debug)
result := parser.RunString("platform = 'android'", vars, debug)
if result.IsError() {
log.Printf("ERROR status=%d errors=%d last_error: [%s]\n", result.Status, result.Errors, result.LastError)
return
}log.Printf("result: %v", result.Eval)
}
```## Build
Use this recipe if you need to build the parser for development.
```
git clone https://github.com/udhos/gobule
cd gobule
go generate ./parser ;# generate parser
go test ./parser ;# run tests
go install ./parser ;# build
```## Bule Language
https://github.com/johnowl/owl-rules
## Tokens
https://github.com/johnowl/owl-rules/blob/master/src/main/kotlin/com/johnowl/rules/RulesEvaluator.kt
## Syntax Analyser Generators
### ModernC goyacc
go get modernc.org/goyacc
https://gitlab.com/cznic/goyacc
### Golang goyacc
go get golang.org/x/tools/cmd/goyacc
https://blog.golang.org/generate