Esempio n. 1
0
void term(int n) /* 項関連処理。nは優先順位 */
{
  TknKind kd;

  if (n == 8) { factor(); return; }
  term(n+1);
  while (n == opOrder(token.kind)) {                /* 強さが同じ演算子が続く */
    kd = token.kind;
    token = nextTkn(); term(n+1);
    gencode_Binary(kd);                                         /* 二項演算子 */
  }
}
Esempio n. 2
0
void term(int n) /* n은 우선 순위 */
{
  TknKind op;
  if (n == 7) { factor(); return; }
  term(n+1);
  while (n == opOrder(code.kind)) {                /* 우선 순위가 같은 연산자가 연속된다 */
    op = code.kind;
    code = nextCode(); term(n+1);
    if (syntaxChk_mode) { stk.pop(); stk.pop(); stk.push(1.0); }   /* 구문 chk 시 */
    else binaryExpr(op);
  }
}