#include cc.def/1 extern char line[]; extern int lptr; extern char *cptr; expression() { int lval[2]; if(heir1(lval))rvalue(lval); } /* expression */ heir1(lval) int lval[]; { int k,lval2[2]; k=heir1a(lval); if (match("=")) { if(k==0){ needlval(); return 0; } if (lval[1])push(); if(heir1(lval2))rvalue(lval2); store(lval); return 0; } else return k; } /* heir1 */ heir1a(lval) /* Process exp ? exp : exp */ int lval[]; { int k; k = heir1b(lval); blanks(); if(match("?")) { error("?: expressions not implemented"); kill(); return 0; } else return k; } /* heir1a */ heir1b(lval) /* process exp || exp */ int lval[]; { int k, lval2[2]; k = heir1c(lval); blanks(); if(ch() != '|') return k; if(nch() != '|') return k; if(k) rvalue(lval); forever { if(match("||")) { push(); if(heir1c(lval2)) rvalue(lval2); pop(); or(); } else return 0; } } /* heir1b */ heir1c(lval) /* process exp && exp */ int lval[]; { int k, lval2[2]; k = heir2(lval); blanks(); if(ch() != '&') return k; if(nch() != '&') return k; if(k) rvalue(lval); forever { if(match("&&")) { push(); if(heir2(lval2)) rvalue(lval2); pop(); land(); } else return 0; } } /* heir1c */ heir2(lval) int lval[]; { int k,lval2[2]; k=heir3(lval); blanks(); if(ch()!='|')return k; if(nch() == '|') return k; if(k)rvalue(lval); forever { if (match("|")) { push(); if(heir3(lval2)) rvalue(lval2); pop(); or(); } else return 0; } } /* heir2 */ heir3(lval) int lval[]; { int k,lval2[2]; k=heir4(lval); blanks(); if(ch()!='^')return k; if(k)rvalue(lval); forever { if (match("^")) { push(); if(heir4(lval2))rvalue(lval2); pop(); xor(); } else return 0; } } /* heir3 */ heir4(lval) int lval[]; { int k,lval2[2]; k=heir5(lval); blanks(); if(ch()!='&')return k; if(nch() == '&') return k; if(k)rvalue(lval); forever {if (match("&")) {push(); if(heir5(lval2))rvalue(lval2); pop(); and(); } else return 0; } } heir5(lval) int lval[]; { int k,lval2[2]; k=heir6(lval); blanks(); if((streq(line+lptr,"==")==0)& (streq(line+lptr,"!=")==0))return k; if(k)rvalue(lval); forever {if (match("==")) {push(); if(heir6(lval2))rvalue(lval2); pop(); eq(); } else if (match("!=")) {push(); if(heir6(lval2))rvalue(lval2); pop(); ne(); } else return 0; } } heir6(lval) int lval[]; { int k,lval2[2]; k=heir7(lval); blanks(); if((streq(line+lptr,"<")==0)& (streq(line+lptr,">")==0)& (streq(line+lptr,"<=")==0)& (streq(line+lptr,">=")==0))return k; if(streq(line+lptr,">>"))return k; if(streq(line+lptr,"<<"))return k; if(k)rvalue(lval); forever {if (match("<=")) {push(); if(heir7(lval2))rvalue(lval2); pop(); if(cptr=lval[0]) if(cptr[ident]==pointer) {ule(); continue; } if(cptr=lval2[0]) if(cptr[ident]==pointer) {ule(); continue; } le(); } else if (match(">=")) {push(); if(heir7(lval2))rvalue(lval2); pop(); if(cptr=lval[0]) if(cptr[ident]==pointer) {uge(); continue; } if(cptr=lval2[0]) if(cptr[ident]==pointer) {uge(); continue; } ge(); } else if((streq(line+lptr,"<"))& (streq(line+lptr,"<<")==0)) {inbyte(); push(); if(heir7(lval2))rvalue(lval2); pop(); if(cptr=lval[0]) if(cptr[ident]==pointer) {ult(); continue; } if(cptr=lval2[0]) if(cptr[ident]==pointer) {ult(); continue; } lt(); } else if((streq(line+lptr,">"))& (streq(line+lptr,">>")==0)) {inbyte(); push(); if(heir7(lval2))rvalue(lval2); pop(); if(cptr=lval[0]) if(cptr[ident]==pointer) {ugt(); continue; } if(cptr=lval2[0]) if(cptr[ident]==pointer) {ugt(); continue; } gt(); } else return 0; } }