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

View file

@ -36,7 +36,7 @@ func (i *Interpreter) VisitBinaryExpr(b *ast.BinaryExpr) any {
areStrings := leftType == LoxTypeString &&
rightType == LoxTypeString
switch b.Operator.Type {
switch b.Op.Type {
case lexer.TokenTypeMinus:
if !areNumbers {
// todo: error here
@ -119,7 +119,7 @@ func (i *Interpreter) VisitLiteralExpr(g *ast.LiteralExpr) any {
func (i *Interpreter) VisitUnaryExpr(g *ast.UnaryExpr) any {
right := i.Evaluate(g.Right)
switch g.Operator.Type {
switch g.Op.Type {
case lexer.TokenTypeMinus:
if right.Type() != LoxTypeNumber {
// todo: error here