Question
Objective: Learn programming language implementation systems. Practice conduction syntax analysis on given program components. Assignment: Language implementation systems must input a file, identify substrings, and
Objective: Learn programming language implementation systems. Practice conduction syntax analysis on given program components.
Assignment: Language implementation systems must input a file, identify substrings, and find all syntax errors, regardless of the specific implementation approach. For an input program a lexical analyzer will break a file into lexemes and tokens. A parser will find all syntax errors. For each error the parser will produce an appropriate diagnostic message, and recover quickly.
For the Simple Function defined as follows, choose a programming language that you are familiar with, to implement a lexical analyzer and a top-down parser. The lexical analyzer will read the test program and generate lexemes with token types. The parser must use the recursive-descending parsing algorithm to implement the syntax analysis. The project must implement the following functions:
Input the test program.
Use the Lexical Analyzer to generate lexemes and tokens, and display them.
Use the recursive-descending parser to check the syntax of the test program.
If the test program is generated by the Simple Function display The test program is correct, otherwise display The test program cannot be generated by the Simple function and identify the syntax error.
Requirements:
This is a two person team project.
You should use department programming standards.
The program must execute correctly.
EBNF grammar for Simple Function:
|
|
|
| (
First test program
int test (){
int a;
int b;
int c;
int data;
data = a * b / c;
}
Second test program
int mul (int a, int c ) {
a = a * c;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started