Skip to content

jmhobbs/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov GoDoc

Calculator

This is a demo of using goyacc and golex to build a simple parser which handles basic arithmetic.

It's a dumb little thing though, as it has no concept of the usual order of operations, it just goes left to right.

For example:

jmhobbs@hobbs:cmd $ go run main.go 5+6*10
5 + 6 * 10 = 110
jmhobbs@hobbs:cmd $ go run main.go 10*5+6
10 * 5 + 6 = 56
jmhobbs@hobbs:cmd $ # Oh my sweet, simple calculator.

It was created as an example for a talk at the Omaha Gophers in March 2019.

You can view the (probably unhelpful) slides here: https://docs.google.com/presentation/d/1tRmOXhBPfYbEXXmD7qoRHYBNbjpQQSODPS5snRtm3Zo/edit

Tags!

There are 5 tags on this repo which correspond to a state of completion.

Links