// File: pranavmodx[P]modlang/src/parser.cpp
// Function: Parser::New(Lexer&)
void Parser::New(Lexer &lexer)
{
	this->lexer = lexer;

	nextToken();
	nextToken();

	// prefix parse functions
	prefixParseFns[IDENT] = &Parser::parseIdentifier; // address of method

	prefixParseFns[INTEGER] = &Parser::parseIntegerLiteral;
	prefixParseFns[STRING] = &Parser::parseStringLiteral;

	prefixParseFns[BANG] = &Parser::parsePrefixExpression;
	prefixParseFns[MINUS] = &Parser::parsePrefixExpression;

	prefixParseFns[TRUE] = &Parser::parseBooleanLiteral;
	prefixParseFns[FALSE] = &Parser::parseBooleanLiteral;

	prefixParseFns[IF] = &Parser::parseIfExpression;
	prefixParseFns[WHILE] = &Parser::parseWhileExpression;
	prefixParseFns[FUNCTION] = &Parser::parseFunctionLiteral;

	prefixParseFns[HASHSET] = &Parser::parseHashSetLiteral;
	prefixParseFns[STACK] = &Parser::parseStackLiteral;
	prefixParseFns[QUEUE] = &Parser::parseQueueLiteral;
	prefixParseFns[DEQUE] = &Parser::parseDequeLiteral;
	prefixParseFns[MAX_HEAP] = &Parser::parseMaxHeapLiteral;
	prefixParseFns[MIN_HEAP] = &Parser::parseMinHeapLiteral;

	// brackets
	prefixParseFns[LPAREN] = &Parser::parseGroupedExpression;
	prefixParseFns[LBRACKET] = &Parser::parseArrayLiteral;
	prefixParseFns[LBRACE] = &Parser::parseHashMapLiteral;

	// infix parse functions
	infixParseFns[PLUS] = &Parser::parseInfixExpression;
	infixParseFns[MINUS] = &Parser::parseInfixExpression;
	infixParseFns[SLASH] = &Parser::parseInfixExpression;
	infixParseFns[ASTERISK] = &Parser::parseInfixExpression;
	infixParseFns[MODULO] = &Parser::parseInfixExpression;
	infixParseFns[EQ] = &Parser::parseInfixExpression;
	infixParseFns[NEQ] = &Parser::parseInfixExpression;
	infixParseFns[LTEQ] = &Parser::parseInfixExpression;
	infixParseFns[GTEQ] = &Parser::parseInfixExpression;
	infixParseFns[LT] = &Parser::parseInfixExpression;
	infixParseFns[GT] = &Parser::parseInfixExpression;

	// brackets
	infixParseFns[LPAREN] = &Parser::parseCallExpression;
	infixParseFns[LBRACKET] = &Parser::parseIndexExpression;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movq -0x10(%rbp), %rsi
callq 0x22b30
movq -0x40(%rbp), %rdi
callq 0x1f390
movq -0x40(%rbp), %rdi
callq 0x1f390
movq -0x40(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
movq %rdi, -0x48(%rbp)
leaq 0x46a67(%rip), %rsi     # 0x659c0
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x487(%rip), %rcx       # 0x1f3f0
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46a65(%rip), %rsi     # 0x659e0
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x575(%rip), %rcx       # 0x1f500
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46a63(%rip), %rsi     # 0x65a00
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x883(%rip), %rcx       # 0x1f830
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46ac1(%rip), %rsi     # 0x65a80
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x921(%rip), %rcx       # 0x1f8f0
movq %rcx, -0x58(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46a7b(%rip), %rsi     # 0x65a60
movq %rsi, -0x38(%rbp)
callq 0x22b70
movq -0x58(%rbp), %rcx
movq -0x48(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46cd8(%rip), %rsi     # 0x65ce0
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x9b8(%rip), %rcx       # 0x1f9d0
movq %rcx, -0x50(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46cd2(%rip), %rsi     # 0x65d00
callq 0x22b70
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46cf3(%rip), %rsi     # 0x65d40
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0xa23(%rip), %rcx       # 0x1fa80
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d11(%rip), %rsi     # 0x65d80
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0xbf1(%rip), %rcx       # 0x1fc70
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d0f(%rip), %rsi     # 0x65da0
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0xd1f(%rip), %rcx       # 0x1fdc0
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d2d(%rip), %rsi     # 0x65de0
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0xe5d(%rip), %rcx       # 0x1ff20
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d2b(%rip), %rsi     # 0x65e00
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x104b(%rip), %rcx      # 0x20130
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d29(%rip), %rsi     # 0x65e20
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x1239(%rip), %rcx      # 0x20340
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d27(%rip), %rsi     # 0x65e40
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x1407(%rip), %rcx      # 0x20530
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d25(%rip), %rsi     # 0x65e60
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x15f5(%rip), %rcx      # 0x20740
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46d23(%rip), %rsi     # 0x65e80
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x1963(%rip), %rcx      # 0x20ad0
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46aa1(%rip), %rsi     # 0x65c20
movq %rsi, -0x28(%rbp)
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x1ccd(%rip), %rcx      # 0x20e60
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46afb(%rip), %rsi     # 0x65ca0
movq %rsi, -0x18(%rbp)
callq 0x22b70
movq -0x48(%rbp), %rdi
leaq 0x1d17(%rip), %rcx      # 0x20ed0
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46a95(%rip), %rsi     # 0x65c60
callq 0x22b70
movq -0x40(%rbp), %rdi
leaq 0x1e25(%rip), %rcx      # 0x21000
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x20(%rbp)
leaq 0x46848(%rip), %rsi     # 0x65a40
callq 0x22ba0
movq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rdi
leaq 0x1fa4(%rip), %rcx      # 0x211b0
movq %rcx, -0x30(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46886(%rip), %rsi     # 0x65ac0
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46847(%rip), %rsi     # 0x65aa0
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x46868(%rip), %rsi     # 0x65ae0
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x468e9(%rip), %rsi     # 0x65b80
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x468ea(%rip), %rsi     # 0x65ba0
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x4686b(%rip), %rsi     # 0x65b40
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x4686c(%rip), %rsi     # 0x65b60
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x467ed(%rip), %rsi     # 0x65b00
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x467ee(%rip), %rsi     # 0x65b20
callq 0x22ba0
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdi
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
callq 0x22ba0
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x1f4e(%rip), %rcx      # 0x212b0
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
callq 0x22ba0
leaq 0x2097(%rip), %rcx      # 0x21410
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)