A simple C/C++ compiler implemented in LEX (Flex) and YACC (Bison).
- gcc
- g++
- flex
- bison
- Python (
PyQT5
)
-
Add the required code to
.c
or.cpp
file. -
Compile and run the lexer and parser on the code :
bison --yacc parser.y -d # process parser using bison flex lexer.l # process lexer using flex g++ -c symbolTable.cpp # compile symbol table file and object file gcc -c lex.yy.c y.tab.c compiling.c # compile c files and get object files g++ -o cpp.out symbolTable.o compiling.o lex.yy.o y.tab.o # link output object files ./cpp.out /path/to/input/file /path/to/output/directory # run output file providing required code file
-
Alternatively, use
run.bash
to compile and run the compiler :./run.bash /path/to/input/file /path/to/output/directory
-
Use GUI :
- First, compile the code and get
cpp.out
. - Second, copy
cpp.out
togui
folder. - Third, run GUI :
cd gui/ python gui.py
- Finally, choose the input file and the output directory, then press compile button.
- First, compile the code and get