0

I have the following code

  ast_node left;
  //some code
    while (next_precedence() > curr_precedence) {
      advance();
      left = parseBinaryOperation(left);
    }
  return left;
}

ast_node Parser::parseBinaryOperation(ast_node left) {
  ast_node res;
  auto curr_operator = current_token;
  res.token = curr_operator;
  res.kind = AST_OPERATOR;
  res.children.operator_op.left = &left;
  sexp += curr_operator.keyword;
  advance();
  auto currentPrecedence = precidence_map[tk_type];
  auto right = parseExpression(currentPrecedence);
  res.children.operator_op.right = &right;
  return res;
}

When I print res in parseBinaryOperation it works But when I print left(res is being returned and assigned to left) it prints weird stuff Can anyone help

Saptak Bhoumik
  • 127
  • 3
  • 9

0 Answers0