chenquan / antlr-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

antlr-go

A simple calculator implementation.

How to use

package main

import (
	"fmt"
	"github.com/chenquan/antrl-go/calculate"
)

func main() {
	s := calculate.Calculate(`1+1`)
	fmt.Println(s) // output 2

	s = calculate.Calculate(`a=1
b=3
a+b
`)
	fmt.Println(s) // output 4

}

About


Languages

Language:Go 95.1%Language:ANTLR 4.9%