예제 #1
0
파일: parser.c 프로젝트: palmerc/lab
int inclusive_or_expression(void) {
	if( exclusive_or_expression() ) {
	} else if( inclusive_or_expression() ) {
		match(PIPE);
		exclusive_or_expression();
	}
}
예제 #2
0
struct Symbol* inclusive_or_expression(struct InclusiveOrExpression* node)
{
    if (node->type == 0)
        return exclusive_or_expression(node->exclusiveOrExpression);
    struct Symbol* symbol1 = load_symbol(inclusive_or_expression(node->inclusiveOrExpression));
    struct Symbol* symbol2 = load_symbol(exclusive_or_expression(node->exclusiveOrExpression));
    return inclusive_or_symbol(symbol1, symbol2, node->type);
}
예제 #3
0
// Parse a bitwise inclusive-or expression.
//
//    inclusive-or-expression:
//      exclusive-or-expression
//      inclusive-or-expression '|' exclusive-or-expression
//
// FIXME: This skips the bitwise expressions.
Expr&
Parser::inclusive_or_expression()
{
  Expr* e1 = &exclusive_or_expression();
  while (true) {
    if (Token tok = match_if(tk::bar_tok)) {
      Expr& e2 = exclusive_or_expression();
      e1 = &on_or_expression(tok, *e1, e2);
    } else {
      break;
    }
  }
  return *e1;
}
예제 #4
0
static struct block *inclusive_or_expression(struct block *block)
{
    struct var value;

    block = exclusive_or_expression(block);
    while (peek().token == '|') {
        consume('|');
        value = block->expr;
        block = exclusive_or_expression(block);
        block->expr = eval_expr(block, IR_OP_OR, value, block->expr);
    }

    return block;
}
예제 #5
0
struct Symbol* exclusive_or_expression(struct ExclusiveOrExpression* node)
{
    if (node->type == 0)
        return and_expression(node->andExpression);
    struct Symbol* symbol1 = load_symbol(exclusive_or_expression(node->exclusiveOrExpression));
    struct Symbol* symbol2 = load_symbol(and_expression(node->andExpression));
    return exclusive_or_symbol(symbol1, symbol2, node->type);
}
예제 #6
0
파일: parser.c 프로젝트: palmerc/lab
int exclusive_or_expression(void) {
	if( and_expression() ) {
	} else if( exclusive_or_expression() ) {
		match(CARAT);
		and_expression();
	} else {
		abort();
	}
}