Question
Compiler Design Project - C-compiler I. Goal f of m term project The students will construct a so-called semi-C interpreter through this project. II. The
Compiler Design Project - C-compiler
I. Goal f of m term project The students will construct a so-called semi-C interpreter through this project. II. The n construction f of e the interpreter In this project, the students are encouraged to build a semi-C interpreter based on the given semi-c language production rule.
1. Basic structure as an interpreter: The implemented interpreter should generate a flow graph and symbol table that reflect input source code. The flow graph contains the instructions of source code and represents the control flow of each instructions. The symbol table holds variables and their type and scope. 2. Command functions: The interpreter should provide interactive command prompt like Python or some other interpret languages. The implemented interpreter is required to include three basic commands: next command: This command executes a single or multiple line(s) of the source code. For example, next just executes current line of source code, and next 10 will execute 10 lines including current line. print command: This command prints the value contained in a variable at the moment. For example, if an integer variable a contains value 10, then print a will print 10 trace command: This command shows the history of a variable from beginning to the moment.
More details please visit
https://www2.cs.arizona.edu/~debray/Teaching/CSc453/DOCS/cminusminusspec.html
Help me with this project in Java/C/C++. (Java preferable)
Expected Result Interpreter input commands and results (In this example, the interpreter starts at the top of main function, line 12) Example input code 1 int avg(int count, int *value) 2 int i, total; 3 int sum 0; for (i = 1; i > next >next 2 >> print count 6 8 return (total / count); 9 10 11 int main(void) 12 int studentNumber, count, i, sum; 13 int mark[4]; 14 float average 15 16 count 4; 17 sum o; 18 19 for (i = 0; i 40) 1 24 25 26 27 28 0 >> next >print count 4 >next 1000 End of Program trace i i O at line 19 i 1 at line 19 i2 at line 19 i3 at line 19 printf("%f", average); S > Expected Result Interpreter input commands and results (In this example, the interpreter starts at the top of main function, line 12) Example input code 1 int avg(int count, int *value) 2 int i, total; 3 int sum 0; for (i = 1; i > next >next 2 >> print count 6 8 return (total / count); 9 10 11 int main(void) 12 int studentNumber, count, i, sum; 13 int mark[4]; 14 float average 15 16 count 4; 17 sum o; 18 19 for (i = 0; i 40) 1 24 25 26 27 28 0 >> next >print count 4 >next 1000 End of Program trace i i O at line 19 i 1 at line 19 i2 at line 19 i3 at line 19 printf("%f", average); S >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