// File: /workspace/github_cpp_makefile_star2_O3/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::make_parser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void xbytes::make_parser(const string& file_name)
{
	int start_time = time(NULL);

	//open file
	std::ifstream ifs;
	ifs.open(file_name.c_str(), std::ifstream::in);

	//read file
	char cc;
	while(ifs.good())
	{
		ifs.get(cc);
		lexical_rule(cc);
	}
	
	//close file
	ifs.close();

	//check program file is complete
	if(bracket_count)
	{
		error_on_line(line, "expect }", char_index_in_line);
	}
	if(start == NULL)
	{
		std::cout << "ERROR: not found start symbol [program] ." << std::endl;
		exit(1);
	}
	if(token_code.size() == 0)
	{
		std::cout << "ERROR: not found token declare ." << std::endl;
		exit(1);		
	}

	//parse rule 
	sort_symbol();
	std::cout << "set precedence & associativity" << std::endl;
	find_symbol_precedence();
	find_rule_precedence();
	std::cout << "find_nullable" << std::endl;
	find_nullable();
	std::cout << "find_first_set" << std::endl;
	find_first_set();
	std::cout << "find_follow_set" << std::endl;
	find_follow_set();
	std::cout << "find_lr_state" << std::endl;
	find_lr_state();
	std::cout << "make_action_table" << std::endl;
	make_action_table();

	//dump
	//dump();

	//emit code
	emit_hxx_file();
	emit_cxx_file();

	emit_action_table();

	int eslape = time(NULL) - start_time;
	std::cout << "CONSULE:" << eslape << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rsi, %r15
movq %rdi, %r14
xorl %edi, %edi
callq 0x3220
movq %rax, %rbx
leaq -0x250(%rbp), %r12
movq %r12, %rdi
callq 0x32a0
movq (%r15), %rsi
movq %r12, %rdi
movl $0x8, %edx
callq 0x3140
leaq -0x250(%rbp), %r15
leaq -0x21(%rbp), %r12
movq -0x250(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x230(%rbp,%rax)
jne 0x405e
movq %r15, %rdi
movq %r12, %rsi
callq 0x32d0
movsbl -0x21(%rbp), %esi
movq %r14, %rdi
callq 0x43ca
jmp 0x4030
leaq -0x250(%rbp), %rdi
callq 0x3070
cmpl $0x0, 0x610(%r14)
jne 0x4303
cmpq $0x0, (%r14)
je 0x433c
cmpq $0x0, 0x78(%r14)
je 0x4362
movq %r14, %rdi
callq 0x4ed4
movq 0xcf3c(%rip), %r15      # 0x10fd8
leaq 0x9081(%rip), %rsi      # 0xd124
movl $0x1e, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xcf0a(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5058
movq %r14, %rdi
callq 0x5106
movq 0xcee6(%rip), %r15      # 0x10fd8
leaq 0x904a(%rip), %rsi      # 0xd143
movl $0xd, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xceb4(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5184
movq 0xce98(%rip), %r15      # 0x10fd8
leaq 0x900a(%rip), %rsi      # 0xd151
movl $0xe, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xce66(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x523c
movq 0xce4a(%rip), %r15      # 0x10fd8
leaq 0x8fcb(%rip), %rsi      # 0xd160
movl $0xf, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xce18(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5370
movq 0xcdfc(%rip), %r15      # 0x10fd8
leaq 0x8f8d(%rip), %rsi      # 0xd170
movl $0xd, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xcdca(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x55b6
movq 0xcdae(%rip), %r15      # 0x10fd8
leaq 0x8f4d(%rip), %rsi      # 0xd17e
movl $0x11, %edx
movq %r15, %rdi
callq 0x32b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xcd7c(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5782
movq %r14, %rdi
callq 0x5cae
movq %r14, %rdi
callq 0x6084
movq %r14, %rdi
callq 0x642a
xorl %edi, %edi
callq 0x3220
movq %rax, %r14
movq 0xcd3e(%rip), %rdi      # 0x10fd8
leaq 0x8eef(%rip), %rsi      # 0xd190
movl $0x8, %edx
callq 0x32b0
subl %ebx, %r14d
movq 0xcd23(%rip), %rdi      # 0x10fd8
movl %r14d, %esi
callq 0x33b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq -0x250(%rbp), %rdi
callq 0x3080
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8dbe(%rip), %rsi      # 0xd0d0
leaq 0x8dbf(%rip), %rdx      # 0xd0d8
leaq -0x48(%rbp), %rdi
callq 0x375a
leaq 0x208(%r14), %rsi
movl 0x608(%r14), %ecx
leaq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x4d0c
movq 0xcc95(%rip), %rdi      # 0x10fd8
leaq 0x8d8f(%rip), %rsi      # 0xd0d9
movl $0x29, %edx
callq 0x32b0
movq 0xcc7d(%rip), %rdi      # 0x10fd8
callq 0x3100
jmp 0x4386
movq 0xcc6f(%rip), %rdi      # 0x10fd8
leaq 0x8d93(%rip), %rsi      # 0xd103
movl $0x20, %edx
callq 0x32b0
movq 0xcc57(%rip), %rdi      # 0x10fd8
callq 0x3100
movl $0x1, %edi
callq 0x32c0
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x43b5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x43b5
jmp 0x43b2
jmp 0x43b2
jmp 0x43b2
jmp 0x43b2
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3080
movq %rbx, %rdi
callq 0x33d0
nop