blob: f1e953d0b167e32e94c194c1c1ba3793e2531e2d [file] [log] [blame]
package ast
import "matheval/token"
// Node is the interface all AST nodes implement.
// The unexported marker method seals the interface — only types
// in this package can implement it.
type Node interface {
node() // sealed marker
}
// NumberLit represents a numeric literal (e.g. 3.14).
type NumberLit struct {
Value float64
}
func (*NumberLit) node() {}
// BinaryExpr represents a binary operation (e.g. 1 + 2).
type BinaryExpr struct {
Op token.Type // Plus, Minus, Star, Slash
Left Node
Right Node
}
func (*BinaryExpr) node() {}