// File: matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::createInputStringVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void EarleyParser::createInputStringVector( string filePath )
{
	string line;
	ifstream inputFile;
	string inputStringToParse;

	inputFile.open( filePath.c_str(), fstream::in );

	if( inputFile.is_open() )
	{
		/*
		 * reads a line (production) from the context free input grammar
		 */
		getline( inputFile, line );

		/*
		 * extracts words of the input string
		 * separated by " "
		 */
		this->splitToVector( line, & this->inputVector, " ", false );

		for( unsigned int i = 0; i < this->inputVector.size(); i++ ){
			cout << "[DEBUG]: " << "line token: [" << this->inputVector.at(i) << "]" << endl;

			EarleyParser::dictionaryHashTable::iterator got = this->earleyDictionary.find( this->inputVector.at(i) );
			if( got != this->earleyDictionary.end() )
			{
				/*
				 * element found in hash table (key tokenVector->at(i) contained)
				 */
				if( i == 0 )
					inputStringToParse += got->second;
				else
					inputStringToParse = inputStringToParse + " " + got->second;

			}else{
				/*
				 * element not found in hash table (key tokenVector->at(i) not contained)
				 * error in input string, word not contained in dictionary
				 */
				cout << "[DEBUG]: BAD INPUT STRING!word " << this->inputVector.at(i) << " not contained in dictionary" << endl << endl;
				exit(1);
			}
		}

		cout << "[DEBUG]: input string of parser [" << inputStringToParse << "]" << endl << endl;

		inputFile.close();

		/*
		 * extracts words of the input string to parse
		 * separated by " "
		 */
		this->splitToVector( inputStringToParse, & this->inputVector, " ", false );

		for( unsigned int i = 0; i < this->inputVector.size(); i++ ){
			cout << "[DEBUG]: " << "input vector element: [" << this->inputVector.at(i) << "]" << endl;
		}


	}else{
		cout << "Error: not able to open input file [" << filePath << "]" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rsi, -0x318(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x22a0
leaq -0x238(%rbp), %rdi
callq 0x2210
jmp 0x3f6c
leaq -0x268(%rbp), %rdi
callq 0x22a0
movq -0x318(%rbp), %rdi
callq 0x20e0
movq %rax, %rsi
leaq -0x238(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x3f9a
leaq -0x238(%rbp), %rdi
callq 0x22f0
movb %al, -0x319(%rbp)
jmp 0x3fae
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x3fbd
jmp 0x461d
leaq -0x238(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2050
jmp 0x3fcf
movq -0x310(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x330(%rbp)
leaq -0x289(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x2350
movq -0x328(%rbp), %rdx
leaq 0xf589(%rip), %rsi      # 0x1358d
leaq -0x288(%rbp), %rdi
callq 0x2290
jmp 0x4012
movq -0x330(%rbp), %rdx
movq -0x310(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x288(%rbp), %rcx
xorl %r8d, %r8d
callq 0x35c0
jmp 0x4035
leaq -0x288(%rbp), %rdi
callq 0x2140
leaq -0x289(%rbp), %rdi
callq 0x2200
movl $0x0, -0x290(%rbp)
movq -0x310(%rbp), %rdi
movl -0x290(%rbp), %eax
movq %rax, -0x338(%rbp)
addq $0x98, %rdi
callq 0x6c90
movq %rax, %rcx
movq -0x338(%rbp), %rax
cmpq %rcx, %rax
jae 0x43c8
movq 0x17f47(%rip), %rdi     # 0x1bfd8
leaq 0xef74(%rip), %rsi      # 0x1300c
callq 0x21c0
movq %rax, -0x340(%rbp)
jmp 0x40a6
movq -0x340(%rbp), %rdi
leaq 0xef67(%rip), %rsi      # 0x1301b
callq 0x21c0
movq %rax, -0x348(%rbp)
jmp 0x40c2
movq -0x310(%rbp), %rdi
addq $0x98, %rdi
movl -0x290(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x350(%rbp)
jmp 0x40e6
movq -0x350(%rbp), %rsi
movq -0x348(%rbp), %rdi
callq 0x21a0
movq %rax, -0x358(%rbp)
jmp 0x4102
movq -0x358(%rbp), %rdi
leaq 0xef19(%rip), %rsi      # 0x13029
callq 0x21c0
movq %rax, -0x360(%rbp)
jmp 0x411e
movq -0x360(%rbp), %rdi
movq 0x17e9c(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x4133
movq -0x310(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x370(%rbp)
addq $0x98, %rdi
movl -0x290(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x368(%rbp)
jmp 0x4165
movq -0x368(%rbp), %rsi
movq -0x370(%rbp), %rdi
callq 0x7580
movq %rax, -0x378(%rbp)
jmp 0x4181
movq -0x310(%rbp), %rdi
movq -0x378(%rbp), %rax
movq %rax, -0x298(%rbp)
addq $0x48, %rdi
callq 0x75e0
movq %rax, -0x2a0(%rbp)
leaq -0x298(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x75b0
testb $0x1, %al
jne 0x41c2
jmp 0x42ff
cmpl $0x0, -0x290(%rbp)
jne 0x4266
leaq -0x298(%rbp), %rdi
callq 0x7780
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x268(%rbp), %rdi
callq 0x2250
jmp 0x41f0
jmp 0x42fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x46ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x46b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4255
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x2140
leaq -0x289(%rbp), %rdi
callq 0x2200
jmp 0x46b2
leaq 0xf320(%rip), %rdx      # 0x1358d
leaq -0x2e0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x7830
jmp 0x4282
leaq -0x298(%rbp), %rdi
callq 0x7780
movq %rax, %rdx
addq $0x20, %rdx
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x77e0
jmp 0x42aa
leaq -0x268(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x2230
leaq -0x2c0(%rbp), %rdi
callq 0x2140
leaq -0x2e0(%rbp), %rdi
callq 0x2140
jmp 0x42fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x2140
jmp 0x46b2
jmp 0x43b2
movq 0x17cd2(%rip), %rdi     # 0x1bfd8
leaq 0xeea1(%rip), %rsi      # 0x131ae
callq 0x21c0
movq %rax, -0x380(%rbp)
jmp 0x431b
movq -0x310(%rbp), %rdi
addq $0x98, %rdi
movl -0x290(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x388(%rbp)
jmp 0x433f
movq -0x388(%rbp), %rsi
movq -0x380(%rbp), %rdi
callq 0x21a0
movq %rax, -0x390(%rbp)
jmp 0x435b
movq -0x390(%rbp), %rdi
leaq 0xee65(%rip), %rsi      # 0x131ce
callq 0x21c0
movq %rax, -0x398(%rbp)
jmp 0x4377
movq -0x398(%rbp), %rdi
movq 0x17c43(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, -0x3a0(%rbp)
jmp 0x4393
movq -0x3a0(%rbp), %rdi
movq 0x17c27(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x43a8
movl $0x1, %edi
callq 0x2220
jmp 0x43b4
movl -0x290(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x290(%rbp)
jmp 0x4057
movq 0x17c09(%rip), %rdi     # 0x1bfd8
leaq 0xee15(%rip), %rsi      # 0x131eb
callq 0x21c0
movq %rax, -0x3a8(%rbp)
jmp 0x43e4
movq -0x3a8(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x21a0
movq %rax, -0x3b0(%rbp)
jmp 0x4400
movq -0x3b0(%rbp), %rdi
leaq 0xec1b(%rip), %rsi      # 0x13029
callq 0x21c0
movq %rax, -0x3b8(%rbp)
jmp 0x441c
movq -0x3b8(%rbp), %rdi
movq 0x17b9e(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, -0x3c0(%rbp)
jmp 0x4438
movq -0x3c0(%rbp), %rdi
movq 0x17b82(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x444d
leaq -0x238(%rbp), %rdi
callq 0x2070
jmp 0x445b
movq -0x310(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x3d0(%rbp)
leaq -0x301(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x2350
movq -0x3c8(%rbp), %rdx
leaq 0xf0fd(%rip), %rsi      # 0x1358d
leaq -0x300(%rbp), %rdi
callq 0x2290
jmp 0x449e
movq -0x3d0(%rbp), %rdx
movq -0x310(%rbp), %rdi
leaq -0x268(%rbp), %rsi
leaq -0x300(%rbp), %rcx
xorl %r8d, %r8d
callq 0x35c0
jmp 0x44c4
leaq -0x300(%rbp), %rdi
callq 0x2140
leaq -0x301(%rbp), %rdi
callq 0x2200
movl $0x0, -0x308(%rbp)
movq -0x310(%rbp), %rdi
movl -0x308(%rbp), %eax
movq %rax, -0x3d8(%rbp)
addq $0x98, %rdi
callq 0x6c90
movq %rax, %rcx
movq -0x3d8(%rbp), %rax
cmpq %rcx, %rax
jae 0x461b
movq 0x17ab8(%rip), %rdi     # 0x1bfd8
leaq 0xeae5(%rip), %rsi      # 0x1300c
callq 0x21c0
movq %rax, -0x3e0(%rbp)
jmp 0x4535
movq -0x3e0(%rbp), %rdi
leaq 0xecca(%rip), %rsi      # 0x1320d
callq 0x21c0
movq %rax, -0x3e8(%rbp)
jmp 0x4551
movq -0x310(%rbp), %rdi
addq $0x98, %rdi
movl -0x308(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x3f0(%rbp)
jmp 0x4575
movq -0x3f0(%rbp), %rsi
movq -0x3e8(%rbp), %rdi
callq 0x21a0
movq %rax, -0x3f8(%rbp)
jmp 0x4591
movq -0x3f8(%rbp), %rdi
leaq 0xea8a(%rip), %rsi      # 0x13029
callq 0x21c0
movq %rax, -0x400(%rbp)
jmp 0x45ad
movq -0x400(%rbp), %rdi
movq 0x17a0d(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x45c2
jmp 0x45c4
movl -0x308(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x308(%rbp)
jmp 0x44e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x460a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x2140
leaq -0x301(%rbp), %rdi
callq 0x2200
jmp 0x46b2
jmp 0x4688
movq 0x179b4(%rip), %rdi     # 0x1bfd8
leaq 0xeaf6(%rip), %rsi      # 0x13121
callq 0x21c0
movq %rax, -0x408(%rbp)
jmp 0x4639
movq -0x318(%rbp), %rsi
movq -0x408(%rbp), %rdi
callq 0x21a0
movq %rax, -0x410(%rbp)
jmp 0x4655
movq -0x410(%rbp), %rdi
leaq 0xe9c6(%rip), %rsi      # 0x13029
callq 0x21c0
movq %rax, -0x418(%rbp)
jmp 0x4671
movq -0x418(%rbp), %rdi
movq 0x17949(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x4686
jmp 0x4688
leaq -0x268(%rbp), %rdi
callq 0x2140
leaq -0x238(%rbp), %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2140
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
leaq -0x268(%rbp), %rdi
callq 0x2140
leaq -0x238(%rbp), %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2140
movq -0x240(%rbp), %rdi
callq 0x2340
nop