DESCRIPTION: Extension of Lab 6 (Arithmetic Grammar Top-Down Parser). Lab builds a complete compiler implementing a top-down recursive descent parser for a right-recursive version grammar. Compiler outputs an x86 assembly file of the program using the stack to compute postfix arithmetic expressions. The assembly file produced is then compiled into a full program via NASM and gcc which is then executed to output the results.
• PARSER.l := lex /flex file with expression grammar
• lab3.sh := shell script for testing compiler
• ASSEMBLY_FILE.asm := file with sample output
-
$lex PARSER.l
-
$gcc -o myCompiler lex.yy.c
-
$echo EXPRESSION | ./myCompiler
-
nasm -f elf ASSEMBLY_FILE.asm
-
gcc -m32 ASSEMBLY_FILE.asm arithProg
-
./arithProg