Instructions: [PDF]
Implementation: cpp
[Code]
Instructions: [PDF]
Implementation: flex
[Code]
Instructions: [PDF]
Implementation: bison
[Code]
Implementation: [PDF]
Implementation: bison
+ emu8086
[Code]
flex
bison
emu8086
(with wine on linux)
script.sh
file
#!/bin/bash
# file names (without extensions)
SCANNER_FILE=1705039
PARSER_FILE=1705039
# compiling yacc file
bison -d -y -o $PARSER_FILE.cpp $PARSER_FILE.y
g++ -w -c -o y.o $PARSER_FILE.cpp
# compiling lex file
flex -o $SCANNER_FILE.cpp $SCANNER_FILE.l
g++ -w -c -o l.o $SCANNER_FILE.cpp
# linking object files
g++ -o a.out y.o l.o -lfl
# run executable on input file
./a.out $1
# open with emu8086 (with wine)
cp ./optimized_code.asm ~/.wine/drive_c/code.asm
wine ~/.wine/drive_c/emu8086/emu8086.exe "C:\\code.asm"
- then run
$ ./script.sh input.c
input.c
- contains thec
code to be compiled
a.o
- final object filelog.txt
- log grammar rules with code segmentserror.txt
- log errors with line numberscode.asm
- assembly (MASM) codeoptimized_code.asm
- optimized assembly code