Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using PLY, write an interpreter for the language of LISP expressions. A LISP expression is defined as follows: A number (integer as well as fractional)
Using PLY, write an interpreter for the language of "LISP expressions".
A LISP expression is defined as follows:
- A number (integer as well as fractional) is a LISP expression.
- if E1 and E2 are LISP expressions then so are (+ E1 E2), (- E1 E2), (* E1 E2), and (/ E1 E2).
- if L is a LIST expression (defined below) then (car L) is a LISP expression.
- if B is a BOOLEAN expression and E1 and E2 are LISP expressions then (if B E1 E2) is a LISP expression.
A LIST Expression is defined as follows:
- if E1, E2, ..., En are LISP expressions where n>=0 then (E1 E2 ... En) is a LIST expression.
- if L is a LIST expression then (cdr L) is a LIST expression.
- if E is a LISP expression and L is a LIST expression then (cons E L) is a LIST expression.
A BOOLEAN expression is defined as follows:
- True and False are BOOLEAN expressions.
- if E1 and E2 are LISP expressions then (> E1 E2), (>= E1 E2), (< E1 E2), (<= E1 E2), (= E1 E2), and (<> E1 E2) are BOOLEAN expressions.
- if B1 and B2 are BOOLEAN expressions then so are (not B1), (and B1 B2), and (or B1 B2).
PLEASE I NEED THE PLY PARSER (Python)
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