// File: AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::Program()
void Parser::Program(){
	Scopes->newScope(); //Create new scope for the program
	declareRunTime(); //set up runtime functions as global in the outermost scope
	if( !ProgramHeader() ) ReportError("Expected program header");
	if( !ProgramBody() ) ReportError("Expected program body");
	if( !CheckToken(T_PERIOD) ) ReportWarning("expected '.' at end of program");
	if( CheckToken(T_EOF) ) Scopes->exitScope(); //exit program scope once program ends
		
	else ReportError("Found some tokens remaining in file when end of program was expected");
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0x90(%rax), %rdi
callq 0x18250
movq -0xc0(%rbp), %rdi
callq 0x95b0
movq -0xc0(%rbp), %rdi
callq 0x9da0
testb $0x1, %al
jne 0x82f6
leaq -0x29(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x3430
movq -0xc8(%rbp), %rdx
leaq 0x1d329(%rip), %rsi     # 0x255bd
leaq -0x28(%rbp), %rdi
callq 0x62d0
jmp 0x829f
movq -0xc0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x9060
jmp 0x82b1
leaq -0x28(%rbp), %rdi
callq 0x31a0
leaq -0x29(%rbp), %rdi
callq 0x32e0
jmp 0x82f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x82e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x31a0
leaq -0x29(%rbp), %rdi
callq 0x32e0
jmp 0x8502
movq -0xc0(%rbp), %rdi
callq 0xa020
testb $0x1, %al
jne 0x838a
leaq -0x61(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x3430
movq -0xd0(%rbp), %rdx
leaq 0x1d2ad(%rip), %rsi     # 0x255d5
leaq -0x60(%rbp), %rdi
callq 0x62d0
jmp 0x8333
movq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x9060
jmp 0x8345
leaq -0x60(%rbp), %rdi
callq 0x31a0
leaq -0x61(%rbp), %rdi
callq 0x32e0
jmp 0x838a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x837c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x31a0
leaq -0x61(%rbp), %rdi
callq 0x32e0
jmp 0x8502
movq -0xc0(%rbp), %rdi
movl $0x12b, %esi            # imm = 0x12B
callq 0x9300
testb $0x1, %al
jne 0x8438
leaq -0x89(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x3430
movq -0xd8(%rbp), %rdx
leaq 0x1d227(%rip), %rsi     # 0x255eb
leaq -0x88(%rbp), %rdi
callq 0x62d0
jmp 0x83d2
movq -0xc0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x8510
jmp 0x83e7
leaq -0x88(%rbp), %rdi
callq 0x31a0
leaq -0x89(%rbp), %rdi
callq 0x32e0
jmp 0x8438
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x8427
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x31a0
leaq -0x89(%rbp), %rdi
callq 0x32e0
jmp 0x8502
movq -0xc0(%rbp), %rdi
movl $0x15d, %esi            # imm = 0x15D
callq 0x9300
testb $0x1, %al
jne 0x844f
jmp 0x8467
movq -0xc0(%rbp), %rax
movq 0x90(%rax), %rdi
callq 0x18340
jmp 0x84f9
leaq -0xb1(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x3430
movq -0xe0(%rbp), %rdx
leaq 0x1d182(%rip), %rsi     # 0x2560a
leaq -0xb0(%rbp), %rdi
callq 0x62d0
jmp 0x8496
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x9060
jmp 0x84ab
leaq -0xb0(%rbp), %rdi
callq 0x31a0
leaq -0xb1(%rbp), %rdi
callq 0x32e0
jmp 0x84f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x84eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x31a0
leaq -0xb1(%rbp), %rdi
callq 0x32e0
jmp 0x8502
addq $0xe0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3420
nopl (%rax,%rax)