I have attached the program. I partially misunderstood the assignment when I wrote the program, and now I cannot figure out how to correct the program.
The program is a Scheme compiler that simplifies expressions according to the 20 rules given by the assignment.
I have been running the program in DrRacket 5.3.3. Once loaded into DrRacket, the program works as follows:
I enter the expression to be evaluated as a list:
> (parse '(+ 2 3))
The program outputs the following:
(+ 2 3)
5
This expression is simplified according to Rule 1, and in this case the program is functioning properly.
The program functions properly for rules that only involve c, where c represents a constant which in this case is any integer. The program cannot correctly evaluate expressions which include a "t". The program should be able to evaluate expressions where t represents a variable or another s-expression.
For example if I enter the following expression:
(parse '(+ (+ 3 t) 2))
The program output should be:
(+ (+ 3 2) t)
(+ 5 t)
Could you help me figure out how to correct this?
I am sure that you have questions. Please let me know.
Thank you.
please download the file from the link below
[login to view URL]
pay 20$ for error checking the code
Hi! Indeed using rule (9) the answer is the one you have provided.
How does respond the program for that example?
Could you also please send me your script?
Thanks, Anca