%{ package main import ( "fmt" ) %} %union { n int } %type expr term %start expr %% expr : term '+' term { fmt.Printf("%d + %d\n", $1, $3) $$ = 0 } ; term: '9' { $$ = 9 } ; %% type lex struct { } func (l *lex) Error(s string) { fmt.Println("error", s) } func (l *lex) Lex(lval *yySymType) int { return 9 }