[ANN] a goyacc calculator example

1,297 views
Skip to first unread message

Bobby Powers

unread,
Oct 22, 2011, 2:40:29 PM10/22/11
to golang-nuts
Hi folks,

I'm interested in using goyacc, so I decided to get some background
and read Johnson's Yacc paper [1]. Translating the calculator example
at the end into Go turned out to be surprisingly easy (with the help
of goyacc's units.y example), so I figured I would post it for other
to take a look at:
https://github.com/bpowers/gocalc

cheers,
Bobby

1 - http://dinosaur.compilertools.net/yacc/

Jan Mercl

unread,
Oct 22, 2011, 3:22:24 PM10/22/11
to golan...@googlegroups.com
On Saturday, October 22, 2011 8:40:29 PM UTC+2, Bobby Powers wrote:
Hi folks,

I'm interested in using goyacc, so I decided to get some background
and read Johnson's Yacc paper [1].  Translating the calculator example
at the end into Go turned out to be surprisingly easy (with the help
of goyacc's units.y example), so I figured I would post it for other
to take a look at:
https://github.com/bpowers/gocalc

 

Bobby Powers

unread,
Oct 22, 2011, 4:29:08 PM10/22/11
to golan...@googlegroups.com
On Sat, Oct 22, 2011 at 3:22 PM, Jan Mercl <jan....@nic.cz> wrote:
> One more also here: https://github.com/cznic/golex/blob/master/calc/calc.y

oh, thats great! Its nice that its slightly different: floating point
math instead of integer & no variables, as well as more concise.

Reply all
Reply to author
Forward
0 new messages