public ArrayList<String> compile(Compiler compiler) throws Exception { ArrayList<String> res = new ArrayList<>(); // exec("var "+A+" ; "+statementString()+" \n"+"var "+B,res); exec(";" + statementString(), res); String eq = tokens.get(1).value; Token result = tokens.get(0); if (eq.equals("=")) { tokens.remove(0); tokens.remove(0); } res.addAll(expression(tokens)); if (eq.equals("=")) { Variable v = Alzheimer.variables.get(result.value); if (v == null) { v = Alzheimer.variables.get(result.valueWithoutIndex()); if (v == null) { throw new CompilerException("Unknown variable " + result.value, result.file, result.line); } String rest = result.valueAfterIndex(); if (rest.length() <= 0) { Variable tmp = new Variable(); tmp.name = result.value; String alz = "" + v.accessVarName() + "=( " + tmp.arrayIndex() + " );\n"; res.addAll(Alzheimer.compile(alz)); res.addAll(v.type.pop(v.nameWithoutIndex() + "[" + v.accessVarName() + "]")); } else { String realName = result.valueWithoutIndex() + result.valueAfterIndex() + "[" + v.arraySize() + "]"; Variable real = Alzheimer.variables.get(realName); if (real == null) { throw new CompilerException( "Unknown variable " + result.value, result.file, result.line); } Variable tmp = new Variable(); tmp.name = result.value; String alz = "" + real.accessVarName() + "=( " + tmp.arrayIndex() + " );\n"; res.addAll(Alzheimer.compile(alz)); res.addAll(real.type.pop(real.nameWithoutIndex() + "[" + real.accessVarName() + "]")); } } else { if (v.isArray) { res.addAll(popArray(v, result.file, result.line)); } else { res.addAll(v.type.pop(result.value)); } } } exec("; end of statement", res); // exec("delv "+A+" \n"+"delv "+B+" ; end of statement",res); if (useStackGuard) { res = Alzheimer.stackGuard(res); } return res; }