diff --git a/nac3core/src/codegen/expr.rs b/nac3core/src/codegen/expr.rs
index 58f090f5..58a6d8d2 100644
--- a/nac3core/src/codegen/expr.rs
+++ b/nac3core/src/codegen/expr.rs
@@ -2,7 +2,7 @@ use std::{collections::HashMap, convert::TryInto, iter::once, iter::zip};
use crate::{
codegen::{
- classes::{ListValue, RangeValue},
+ classes::{ListValue, NDArrayValue, RangeValue},
concrete_type::{ConcreteFuncArg, ConcreteTypeEnum, ConcreteTypeStore},
gen_in_range_check,
get_llvm_type,
@@ -1190,6 +1190,213 @@ pub fn gen_binop_expr<'ctx, G: CodeGenerator>(
}
}
+/// Generates code for a subscript expression on an `ndarray`.
+///
+/// * `ty` - The `Type` of the `NDArray` elements.
+/// * `ndims` - The `Type` of the `NDArray` number-of-dimensions `Literal`.
+/// * `v` - The `NDArray` value.
+/// * `slice` - The slice expression used to subscript into the `ndarray`.
+fn gen_ndarray_subscript_expr<'ctx, G: CodeGenerator>(
+ generator: &mut G,
+ ctx: &mut CodeGenContext<'ctx, '_>,
+ ty: Type,
+ ndims: Type,
+ v: NDArrayValue<'ctx>,
+ slice: &Expr