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

11 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 get github.com/mtresnik/goast@main

Your go.mod file should look like this:

module mymodule

go 1.22.3

require github.com/mtresnik/goast v1.0.1

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

package main

import (
	"fmt"
	"github.com/mtresnik/goast/pkg/operations/parser"
)

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

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