Built a LALR Parser in C for parsing and analyzing input source code. The parser, implemented to adhere to the Look-Ahead LR parsing algorithm, processes the input according to specified grammar rules and generates a parse tree.
Please ensure you have Flex and Bison installed on your system.
-
Clone the repository
git clone https://github.com/alexislayvu/LALR-Parser.git
-
Go into the directory
cd LALR-Parser
-
Generate parser code
bison -d calc.y
-
Generate lexer code
flex calc.lex
-
Compile the lexer and parser
gcc lex.yy.c calc.tab.c -w
-
Execute the parser and enter an arithmetic expression
a.exe