wrote dsl for ast boiler plate generation

This commit is contained in:
basil 2025-06-08 21:18:17 -04:00
parent b244f7e3b2
commit e0dd8ff9d5
Signed by: basil
SSH key fingerprint: SHA256:y04xIFL/yqNaG9ae9Vl95vELtHfApGAIoOGLeVLP/fE
16 changed files with 915 additions and 60 deletions

62
ast/expr.go Normal file
View file

@ -0,0 +1,62 @@
package ast
// THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT MANUALLY EDIT
import "git.red-panda.pet/pandaware/lox-go/lexer"
type ExprVisitor interface {
VisitBinaryExpr(v *BinaryExpr) any
VisitGroupingExpr(v *GroupingExpr) any
VisitLiteralExpr(v *LiteralExpr) any
VisitUnaryExpr(v *UnaryExpr) any
}
type Expr interface {
Accept(v ExprVisitor) any
}
type BinaryExpr struct {
Left Expr
Op *lexer.Token
Right Expr
}
func (n *BinaryExpr) Accept(v ExprVisitor) any {
return v.VisitBinaryExpr(n)
}
var _ Expr = new(BinaryExpr)
type GroupingExpr struct {
Expr Expr
}
func (n *GroupingExpr) Accept(v ExprVisitor) any {
return v.VisitGroupingExpr(n)
}
var _ Expr = new(GroupingExpr)
type LiteralExpr struct {
Value any
}
func (n *LiteralExpr) Accept(v ExprVisitor) any {
return v.VisitLiteralExpr(n)
}
var _ Expr = new(LiteralExpr)
type UnaryExpr struct {
Op *lexer.Token
Right Expr
}
func (n *UnaryExpr) Accept(v ExprVisitor) any {
return v.VisitUnaryExpr(n)
}
var _ Expr = new(UnaryExpr)