gobule

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2022 License: MIT

README

license Go Report Card Go Reference

gobule

Golang Go parser for the Bule Language.

Usage

package main

import (
	"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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL