1 minute(s) to read
LL(1) Top-down parser
Implementation of a parser for a given grammar
Project Overview
The goal of the project was to implement a parser for the grammar of a mini-C language.
The parser takes a string (program) as input and returns the parse tree (list of grammar rules) corresponding to that program.
We had to verify (manually) that the grammar below is LL(1) to ensure the deterministic nature of the parser to be built.
Language Grammar
| Program ::= |
main() {declaration_list statement_list} |
| declaration_list ::= |
declaration declaration_list |
empty |
| statement_list ::= |
statement statement_list |
empty |
| statement ::= |
assignment |
test |
| assignment ::= |
id=number; |
| test ::= |
if condition statement else statement> |
| condition ::= |
id operator number |
Implemented Features
- Calculation of FIRST sets for non-terminals
- Calculation of FOLLOW sets for non-terminals
- Construction of the parsing table for the provided grammar
- Determination of whether the grammar is LL(1)
- Determination of whether a string is accepted by the grammar
So, where can I find this project?
On my GitHub, at the following link: https://github.com/FredericCanaud/AnalyseDescendanteCompilation ;)