loop.java
来自「myassembler(大学作业)」· Java 代码 · 共 35 行
JAVA
35 行
public class Loop extends Statement { private Expression condition; private Statement body; String operazione; int valore; public Loop(Expression c, Statement s) { body = (Statement)s.clone(); condition = (Expression)c.clone(); } public void run() throws ExecutionException { while (condition.eval() == 1) body.run(); } public Object clone() { return new Loop(condition, body); } /* --------------------------------------- * lj: condition * jzero li * body * jump lj * li: ... */ public String toString() { int truelabel = ++labels, falselabel = ++labels; toLabel = truelabel; String result = condition.toString()+labelling()+"JZERO L"+falselabel+"\n"+body.toString()+labelling()+"JUMP L"+truelabel+"\n"; toLabel = falselabel; return result; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?