A program designed to parse source code for a custom language (can be seen in t1.txt
to t6.txt
). The syntax and semantics of the source code are analysed for correctness using parse tree creation and type expression table formation. Any errors in the source code are displayed with line numbers.
Instructions to use the program:
make all
to compile the code intooutput
../output inputcode.txt
to run the code, put the source code ininputcode.txt
(name can be changed) and grammar ingrammar.txt
(should be right associative, and unambiguous).make clean
to remove all.o
files.
- The driving code including the
main
function is indriver.c
. - All data structure definitions are in
customcompiler.h
. - The grammar is in
grammar.txt
in a format that can be parsed by the program. - Sample source code for testing the compiler is in
t1.txt
tot6.txt
.