From 81ef732839b5719863e980c9c80dc2db1ec7ac53 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 7 Jun 2024 10:00:27 -0400 Subject: [PATCH] Updates README. --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91b5d05..ae84805 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,44 @@ # goast [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/mtresnik/math/blob/main/LICENSE) -[![version](https://img.shields.io/badge/version-1.0.0-blue)](https://github.com/mtresnik/math/releases/tag/v1.0) +[![version](https://img.shields.io/badge/version-1.0.1-blue)](https://github.com/mtresnik/goast/releases/tag/v1.0.1) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square)](https://makeapullrequest.com)
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: +```go +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: +```go +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()) +} +``` \ No newline at end of file