// File: /workspace/github_cpp_makefile_star2_O2/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 0x2210
movq %rax, %rbx
leaq -0x250(%rbp), %r12
movq %r12, %rdi
callq 0x2260
movq (%r15), %rsi
pushq $0x8
popq %rdx
movq %r12, %rdi
callq 0x2150
leaq -0x250(%rbp), %r15
leaq -0x21(%rbp), %r12
movq -0x250(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x230(%rbp,%rax)
jne 0x2ae2
movq %r15, %rdi
movq %r12, %rsi
callq 0x22b0
movsbl -0x21(%rbp), %esi
movq %r14, %rdi
callq 0x2cf6
jmp 0x2ab4
leaq -0x250(%rbp), %rdi
callq 0x2070
cmpl $0x0, 0x610(%r14)
jne 0x2c5a
cmpq $0x0, (%r14)
je 0x2c88
cmpq $0x0, 0x78(%r14)
je 0x2ca5
movq %r14, %rdi
callq 0x365a
movq 0xc4b8(%rip), %rdi      # 0xefd8
leaq 0x75fd(%rip), %rsi      # 0xa124
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x3772
movq %r14, %rdi
callq 0x380e
movq 0xc48d(%rip), %rdi      # 0xefd8
leaq 0x75f1(%rip), %rsi      # 0xa143
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x3878
movq 0xc46a(%rip), %rdi      # 0xefd8
leaq 0x75dc(%rip), %rsi      # 0xa151
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x390c
movq 0xc447(%rip), %rdi      # 0xefd8
leaq 0x75c8(%rip), %rsi      # 0xa160
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x39ea
movq 0xc424(%rip), %rdi      # 0xefd8
leaq 0x75b5(%rip), %rsi      # 0xa170
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x3bfe
movq 0xc401(%rip), %rdi      # 0xefd8
leaq 0x75a0(%rip), %rsi      # 0xa17e
callq 0x2220
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x3d6e
movq %r14, %rdi
callq 0x4122
movq %r14, %rdi
callq 0x43ac
movq %r14, %rdi
callq 0x462e
xorl %edi, %edi
callq 0x2210
movq %rax, %r14
movq 0xc3bc(%rip), %rdi      # 0xefd8
leaq 0x756d(%rip), %rsi      # 0xa190
callq 0x2220
subl %ebx, %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x2370
movq %rax, %rdi
callq 0x2110
leaq -0x250(%rbp), %rdi
callq 0x2080
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x746f(%rip), %rsi      # 0xa0d0
leaq -0x48(%rbp), %rdi
leaq -0x22(%rbp), %rdx
callq 0x25f4
leaq 0x208(%r14), %rsi
movl 0x608(%r14), %ecx
leaq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x3558
movq 0xc349(%rip), %rdi      # 0xefd8
leaq 0x7443(%rip), %rsi      # 0xa0d9
callq 0x2220
movq %rax, %rdi
callq 0x2110
jmp 0x2cc0
movq 0xc32c(%rip), %rdi      # 0xefd8
leaq 0x7450(%rip), %rsi      # 0xa103
callq 0x2220
movq %rax, %rdi
callq 0x2110
pushq $0x1
popq %rdi
callq 0x2280
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2100
jmp 0x2ce1
jmp 0x2cde
jmp 0x2cde
jmp 0x2cde
jmp 0x2cde
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2380
nop