public static void RunStatement(Statement statement, IMemory memory) { switch (statement) { case DeclareVariableStatement dvs: memory.DeclareVariable(dvs.Name, dvs.Type, dvs.Dimension, dvs.Counts, dvs.InitialValue); break; case SetVariableStatement svs: memory.SetValue(svs.Variable, svs.Value); break; default: throw new NotImplementedException(); } }