basic expression interpreter
This commit is contained in:
parent
eebaadc16e
commit
b244f7e3b2
5 changed files with 186 additions and 16 deletions
|
|
@ -45,7 +45,7 @@ func (p *Printer) Parenthesize(name string, expressions ...Expr) string {
|
|||
val := "(" + name
|
||||
|
||||
for _, e := range expressions {
|
||||
exprStr, ok := (e.accept(p)).(string)
|
||||
exprStr, ok := (e.Accept(p)).(string)
|
||||
if !ok {
|
||||
panic("badly implemented visitor")
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ func (p *Printer) Parenthesize(name string, expressions ...Expr) string {
|
|||
}
|
||||
|
||||
func (p *Printer) Print(e Expr) string {
|
||||
str, ok := (e.accept(p)).(string)
|
||||
str, ok := (e.Accept(p)).(string)
|
||||
if !ok {
|
||||
panic("badly implemented visitor")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue