private ExpressionNode F() { if (token.type == TokenType.PAREN_OPEN) { token = lexer.GetNextToken(); var eValor = E(); if (token.type != TokenType.PAREN_CLOSE) { throw new ParserException("Expected closing parenthesis."); } token = lexer.GetNextToken(); return(eValor); } else if (token.type == TokenType.LIT_INT) { var valor = new NumNode(float.Parse(token.lexema)); token = lexer.GetNextToken(); return(valor); } else if (token.type == TokenType.LIT_BOOL) { var valor = new BoolNode(bool.Parse(token.lexema)); token = lexer.GetNextToken(); return(valor); } else if (token.type == TokenType.ID) { return(ID()); } else { throw new ParserException("Expected a factor."); } }
public string Print(BoolNode bnode) { return("" + bnode.t); }