Goal
Implement list indexing (read and write) in the interpreter.
Current State
The parser supports Expr::Index { target, index, target_type } and generates the correct AST. However:
-
The validator passes Expr::Index through but converts it to ValidatorExpr::BinaryOp with dummy values, losing the original index semantics:
ParserExpr::Index { target, index, target_type } => {
Ok(ValidatorExpr::BinaryOp {
left: Box::new(target),
right: Box::new(index),
op: Operation::Equal, // wrong - this is not an equality check
return_type: target_type,
})
}
This corrupts the AST and makes indexing impossible to execute correctly.
-
The runner has no Expr::Index variant (it was removed from validator AST).
-
Need to add Index variant to validator::ast::Expr and properly implement it in both validator and runner.
Goal
Implement list indexing (read and write) in the interpreter.
Current State
The parser supports
Expr::Index { target, index, target_type }and generates the correct AST. However:The validator passes
Expr::Indexthrough but converts it toValidatorExpr::BinaryOpwith dummy values, losing the original index semantics:This corrupts the AST and makes indexing impossible to execute correctly.
The runner has no
Expr::Indexvariant (it was removed from validator AST).Need to add
Indexvariant tovalidator::ast::Exprand properly implement it in both validator and runner.