gobule

module
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT

README

license Go Report Card Go Reference Actions codecov

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
Package bulexer implemetns the lexical analyzer.
Package bulexer implemetns the lexical analyzer.
Package main implements bulexer-run.
Package main implements bulexer-run.
Package conv implements version conversion helpers.
Package conv implements version conversion helpers.
Package parser implements the syntax analyzer.
Package parser implements the syntax analyzer.
Package main implements parser-run.
Package main implements parser-run.

Jump to

Keyboard shortcuts

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