Skip to content
Snippets Groups Projects
Commit d3b5cb70 authored by lucien.noel's avatar lucien.noel
Browse files

test 8 OK

parent a36118a1
No related branches found
No related tags found
No related merge requests found
...@@ -197,7 +197,25 @@ public class ByteCodeGenerator implements ASTVisitor { ...@@ -197,7 +197,25 @@ public class ByteCodeGenerator implements ASTVisitor {
node.getIteratorName().accept(this); node.getIteratorName().accept(this);
node.getFrom().accept(this); node.getFrom().accept(this);
node.getTo().accept(this); node.getTo().accept(this);
int memoryAddr = varAddrMemory.get(node.getIteratorName().getNom());
loadIntInByteCode(node.getFrom());
bytecode+="istore "+memoryAddr+"\n";
bytecode+="label_"+nb_label+":\n";
loadIntInByteCode(node.getTo());
bytecode+="iload "+memoryAddr+"\n";
bytecode+="if_icmplt label_"+(nb_label+1)+"\n";
node.getInstruction().accept(this); node.getInstruction().accept(this);
bytecode+="iload "+memoryAddr+"\n";
bytecode+="ldc 1\n";
bytecode+="iadd\n";
bytecode+="istore "+memoryAddr+"\n";
bytecode+="goto label_"+nb_label+"\n";
bytecode+="label_"+(nb_label+1)+":\n";
nb_label += 2;
return null; return null;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment