Skip to content
/ goast Public

Goast (pronounced Ghost) is a Go implementation of an AST and parser. This allows for strings to be converted to and from mathematical structures.

License

Notifications You must be signed in to change notification settings

mtresnik/goast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goast

License version PRs Welcome


Goast (pronounced Ghost) is a Go implementation of an AST and parser. This allows for strings to be converted to and from mathematical structures.

Sample Code

In your project run:

go mod download github.com/mtresnik/goutils
go mod download github.com/mtresnik/goast 

Your go.mod file should look like this:

module mymodule

go 1.23.3

require github.com/mtresnik/goast v1.1.1

Then in your go files you should be able to access the parser:

package main

import (
	"github.com/mtresnik/goast/pkg/goast"
)

func main() {
	operation, err := goast.ParseOperation("a * bc + 123 / sin(3.1415 * n) ^ log_(2, 8) - e")
	if err != nil {
		println((*err).Error())
		return
	}
	println(operation.String())
}

About

Goast (pronounced Ghost) is a Go implementation of an AST and parser. This allows for strings to be converted to and from mathematical structures.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages