//O -> > , >= , = bool O() { int countTT = countT - 1; int countLL = countL - 1; if (now.word == ">") { InterCode a = new InterCode(); a.op = ">"; a.opr1 = "T" + countT; a.opr2 = yatta; a.res = "-"; Icode.Add(a); a.op = "JT"; a.opr1 = "-"; a.opr2 = "-"; a.res = "L" + countL; Icode.Add(a); now = (token)tokenlist[count++]; return(true); } if (now.word == ">=") { InterCode b = new InterCode(); b.op = ">="; b.opr1 = "T" + countT; b.opr2 = yatta; b.res = "-"; Icode.Add(b); b.op = "JT"; b.opr1 = "-"; b.opr2 = "-"; b.res = "L" + countL; Icode.Add(b); now = (token)tokenlist[count++]; return(true); } if (now.word == "=") { InterCode c = new InterCode(); c.op = "=="; c.opr1 = "T" + countT; c.opr2 = yatta; c.res = "-"; Icode.Add(c); c.op = "JT"; c.opr1 = "-"; c.opr2 = "-"; c.res = "L" + countL; Icode.Add(c); now = (token)tokenlist[count++]; return(true); } else { return(false); } }
//F2 -> for E in [ E O N ] { S } bool F2() { Infix = new ArrayList(); if (now.word == "for") { InterCode a = new InterCode(); a.op = "LBL"; a.opr1 = "-"; a.opr2 = "-"; a.res = "L" + countL++;; string xxcv = a.res; Icode.Add(a); int asdfg = countT + 1; yatta = "T" + asdfg; now = (token)tokenlist[count++]; b = E1(); if (b == false) { return(b); } b = CheckAllDataType(); if (b == false) { return(b); } if (now.word == "in") { Infix = new ArrayList(); now = (token)tokenlist[count++]; if (now.word == "[") { now = (token)tokenlist[count++]; E1(); if (b == false) { return(b); } O(); if (b == false) { return(b); } b = CheckAllDataType(); if (b == false) { return(b); } N(); if (b == false) { return(b); } if (now.word == "]") { InterCode q = new InterCode(); q.op = "JMP"; q.opr1 = "-"; q.opr2 = "-"; int sadxc = countL + 1; q.res = "L" + sadxc; Icode.Add(q); now = (token)tokenlist[count++]; if (now.word == "{") { a.op = "LBL"; a.opr1 = "-"; a.opr2 = "-"; a.res = "L" + countL++;; Icode.Add(a); now = (token)tokenlist[count++]; S2(); if (b == false) { return(b); } if (now.word == "}") { InterCode x = new InterCode(); x.op = "JMP"; x.opr1 = "-"; x.opr2 = "-"; x.res = xxcv; Icode.Add(x); x.op = "LBL"; x.opr1 = "-"; x.opr2 = "-"; x.res = "L" + countL++; Icode.Add(x); now = (token)tokenlist[count++]; return(true); } else { return(false); } } else { return(false); } } else { return(false); } } else { return(false); } } else { return(false); } } else { return(false); } }