// File: /workspace/github_cpp_makefile_star2_O1/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 0x4074
movq %r15, %rdi
movq %r12, %rsi
callq 0x32d0
movsbl -0x21(%rbp), %esi
movq %r14, %rdi
callq 0x43e0
jmp 0x4046
leaq -0x250(%rbp), %rdi
callq 0x3070
cmpl $0x0, 0x610(%r14)
jne 0x4319
cmpq $0x0, (%r14)
je 0x4352
cmpq $0x0, 0x78(%r14)
je 0x4378
movq %r14, %rdi
callq 0x4e9e
movq 0xcf26(%rip), %r15      # 0x10fd8
leaq 0x906b(%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 0xcef4(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x501e
movq %r14, %rdi
callq 0x50cc
movq 0xced0(%rip), %r15      # 0x10fd8
leaq 0x9034(%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 0xce9e(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5176
movq 0xce82(%rip), %r15      # 0x10fd8
leaq 0x8ff4(%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 0xce50(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x522c
movq 0xce34(%rip), %r15      # 0x10fd8
leaq 0x8fb5(%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 0xce02(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5360
movq 0xcde6(%rip), %r15      # 0x10fd8
leaq 0x8f77(%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 0xcdb4(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x55a4
movq 0xcd98(%rip), %r15      # 0x10fd8
leaq 0x8f37(%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 0xcd66(%rip), %rdi      # 0x10fd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x5768
movq %r14, %rdi
callq 0x5c90
movq %r14, %rdi
callq 0x6068
movq %r14, %rdi
callq 0x640e
xorl %edi, %edi
callq 0x3220
movq %rax, %r14
movq 0xcd28(%rip), %rdi      # 0x10fd8
leaq 0x8ed9(%rip), %rsi      # 0xd190
movl $0x8, %edx
callq 0x32b0
subl %ebx, %r14d
movq 0xcd0d(%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 0x8da8(%rip), %rsi      # 0xd0d0
leaq 0x8da9(%rip), %rdx      # 0xd0d8
leaq -0x48(%rbp), %rdi
callq 0x376a
leaq 0x208(%r14), %rsi
movl 0x608(%r14), %ecx
leaq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x4cd6
movq 0xcc7f(%rip), %rdi      # 0x10fd8
leaq 0x8d79(%rip), %rsi      # 0xd0d9
movl $0x29, %edx
callq 0x32b0
movq 0xcc67(%rip), %rdi      # 0x10fd8
callq 0x3100
jmp 0x439c
movq 0xcc59(%rip), %rdi      # 0x10fd8
leaq 0x8d7d(%rip), %rsi      # 0xd103
movl $0x20, %edx
callq 0x32b0
movq 0xcc41(%rip), %rdi      # 0x10fd8
callq 0x3100
movl $0x1, %edi
callq 0x32c0
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x43cb
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x43cb
jmp 0x43c8
jmp 0x43c8
jmp 0x43c8
jmp 0x43c8
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3080
movq %rbx, %rdi
callq 0x33d0
nop