lib/monkey/parser.rb
# Initialize the parser. It will use the provided lexer.
#
# @param [Lexer] lexer the lexer providing tokens
Initialize the parser. It will use the provided lexer.
Initialize the parser . It will use the provided lexer .
def parse_let_statement
      token = @cur_token
      return nil unless expect_peek(Token::IDENT)
      name = AST::Identifier.new(@cur_token, @cur_token.literal)
      return nil unless expect_peek(Token::ASSIGN)
      next_token until cur_token_is(Token::SEMICOLON)
      AST::LetStatement.new(token, name, nil)
    end
def parse_let_statement token = @cur_token return nil unless expect_peek ( Token :: IDENT ) name = AST :: Identifier . new ( @cur_token , @cur_token . literal ) return nil unless expect_peek ( Token :: ASSIGN ) next_token until cur_token_is ( Token :: SEMICOLON ) AST :: LetStatement . new ( token , name , nil ) end
Initialize the parser.
Initialize the parser .
# TODO
lexer the lexer providing tokens
lexer the lexer providing tokens