// File: matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::parse()
void EarleyParser::parse()
{
	/*
	 * early parser main cycle
	 */
	for( unsigned int i = 0; i <= this->inputVector.size(); i++ )
	{
		cout << i << "  *****************************************************" << endl << "*****************************************************" << endl;
		/*
		 * cycles over all chart
		 */
		for( unsigned int j = 0; j < this->earleyParserChart[i].size(); j++ )
		{
			if( !( this->earleyParserChart[i].at(j)->isComplete() ) )
			{
				/*
				 * the state is not complete
				 * the production corresponding to the state has not
				 * been yet analized completely
				 */
				if( this->getProduction( this->earleyParserChart[i].at(j)->nextSymbolToProcess() ) != NULL )
				{
					/*
					 * symbol to process is a non terminal and is contained in the
					 * production hash map initialized from the input context free grammar
					 *
					 * the correct production of the symbol must be predicted
					 */
					this->predictor( this->earleyParserChart[i].at(j), i );

				}else{
					/*
					 * symbol to process is a terminal symbol
					 * which has no further expansions
					 *
					 * symbol must be simply scanned
					 */
					this->scanner( this->earleyParserChart[i].at(j), i );
				}
			}else{
				/*
				 * the state is complete
				 * all symbols in the corresponding production have been
				 * expanded (non terminals) or scanned (terminals)
				 */
				this->completer( this->earleyParserChart[i].at(j), i );
			}
		}
	}

	cout << "[DEBUG]: finished parsing input string!" << endl << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x48(%rbp), %rdi
movl -0xc(%rbp), %eax
movq %rax, -0x50(%rbp)
addq $0x98, %rdi
callq 0x6c90
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
ja 0x4cf0
movl -0xc(%rbp), %esi
movq 0x174bc(%rip), %rdi     # 0x1bfd8
callq 0x2280
movq %rax, %rdi
leaq 0xe75c(%rip), %rsi      # 0x13287
callq 0x21c0
movq %rax, %rdi
movq 0x1748e(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0xe740(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, %rdi
movq 0x17470(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movl $0x0, -0x10(%rbp)
movq -0x48(%rbp), %rdi
movl -0x10(%rbp), %eax
movq %rax, -0x58(%rbp)
addq $0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x4ce0
movq -0x48(%rbp), %rdi
addq $0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rdi
callq 0x11750
testb $0x1, %al
jne 0x4c9f
movq -0x48(%rbp), %rdi
subq $-0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x117c0
movq -0x48(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x46e0
movq %rax, -0x60(%rbp)
jmp 0x4c0c
leaq -0x30(%rbp), %rdi
callq 0x2140
movq -0x60(%rbp), %rax
cmpq $0x0, %rax
je 0x4c6c
movq -0x48(%rbp), %rdi
addq $0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq -0x48(%rbp), %rdi
movq (%rax), %rsi
movl -0xc(%rbp), %edx
callq 0x4d30
jmp 0x4c9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2140
jmp 0x4d27
movq -0x48(%rbp), %rdi
addq $0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq -0x48(%rbp), %rdi
movq (%rax), %rsi
movl -0xc(%rbp), %edx
callq 0x5300
jmp 0x4cd0
movq -0x48(%rbp), %rdi
addq $0x80, %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x7990
movq %rax, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq -0x48(%rbp), %rdi
movq (%rax), %rsi
movl -0xc(%rbp), %edx
callq 0x5740
jmp 0x4cd2
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4b64
jmp 0x4ce2
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x4aeb
movq 0x172e1(%rip), %rdi     # 0x1bfd8
leaq 0xe5c1(%rip), %rsi      # 0x132bf
callq 0x21c0
movq %rax, %rdi
movq 0x172bb(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
movq 0x172ac(%rip), %rsi     # 0x1bfc8
callq 0x21f0
addq $0x70, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x2340