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 2 months 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T13:16:33.000Z (11 months ago)
- Last Synced: 2024-06-20T02:12:45.025Z (7 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
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/udhos/gobule/blob/main/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/udhos/gobule)](https://goreportcard.com/report/github.com/udhos/gobule)
[![Go Reference](https://pkg.go.dev/badge/github.com/udhos/gobule.svg)](https://pkg.go.dev/github.com/udhos/gobule)
[![Actions](https://github.com/udhos/gobule/actions/workflows/cover.yml/badge.svg)](https://github.com/udhos/gobule/actions/workflows/cover.yml)
[![codecov](https://codecov.io/gh/udhos/gobule/branch/main/graph/badge.svg?token=I20LOO4AFI)](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