Skip to content

interpreter: implement List indexing operations #23

Description

@Prestgg1

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:

  1. 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.

  2. The runner has no Expr::Index variant (it was removed from validator AST).

  3. Need to add Index variant to validator::ast::Expr and properly implement it in both validator and runner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions