💡Lexical parser
1: A lexical analysis program that implements a minimal language for n! and returns a binary as output.
2: Lexical analysis requires the following errors to be reported:
1, illegal characters.
2: colon mismatch.
3: Overflow of identifier length.
Targeted changes can be made to the test program to report the above errors.
💡Syntax parser
1: According to the given method, write the corresponding recursive descending grammar analysis program to implement the grammar check and syntax of the lexical.
The syntax check of the analysed word sequences and the analysis of the program structure, the generation of the corresponding variable list and.
The syntax analysis is based on a given method, which generates a list of variables and a list of procedures, and writes the syntax-checked errors in the compilation to the corresponding files.
2: syntax analysis is reported by specific syntax errors, e.g. missing semicolon, missing right bracket, missing begin, etc;
The syntax analysis requires that all syntax errors are reported as far as possible, and only one error can be reported per line; targeted modifications to the test program are required to check the syntax analyser's error reporting capabilities.
💡Analysis of experimental data and results
💡Conclusions of the lexical parser experiment
1: The lexical analyser can correctly report lexical errors and generate the corresponding binary files.
2: This experiment has not yet been carried out for a small number of error functions, and more improvements can be made later
3: Through this experiment, I have designed a simple lexical analyser who has the function of reporting errors, which can be used in practical applications to warn programmers of errors and also improve my programming skills.
💡Conclusion of the grammar parser experiment
1:This experiment has implemented a syntax parser, realised the functions of a syntax parser and gained a deeper understanding of recursive descent analysis.
2:This experiment has achieved most of the functions in syntax error reporting, but there are still some small parts that have not been implemented, so I can continue to improve a little.
3: This experiment is more proficient in the use of C programming methods, but also deepened their understanding of recursive descent analysis.