Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple Lisp Interpreter (Bison & Flex Programming) 1. Design and implement the language for the following simple Lisp interpreter. 2. Language design and implementation 2.0

image text in transcribed

Simple Lisp Interpreter (Bison & Flex Programming) 1. Design and implement the language for the following simple Lisp interpreter. 2. Language design and implementation 2.0 One statement (Lisp-expression) per line. The return value of each statement will be output to console 2.1 (stop) to terminate the program 2.2 constants: a number (the type of a number is double) 2.3 list expression and functions for basic arithmetic (+,-, *, , 1+,L, where 1+ is to increment 1, 1- is to decrement 1, is exponent (that is, 2 3) is 2 to the power of 3 (+12) (+12 3 4) 12) (-34)) 2.4 variable (atom) The length of a variable-name can be up to 255 characters long Variable name begins with an alphabet and followed by alpha-numeric characters. Support a symbol table to handle many variable entries (with C++ map) A variable is either undefined or set for a number (type double). 2.5 let statement to set a variable with a number (to be converted to double), for example, (let x 15) 2.6 print function, for example, (print a) ;; this will output the value of the atom a. Ifnot set, then "undefined" will be printed. (let a 1) (print a) (print (+ a 10.2)) :; this will print a number 1 Simple Lisp Interpreter (Bison & Flex Programming) 1. Design and implement the language for the following simple Lisp interpreter. 2. Language design and implementation 2.0 One statement (Lisp-expression) per line. The return value of each statement will be output to console 2.1 (stop) to terminate the program 2.2 constants: a number (the type of a number is double) 2.3 list expression and functions for basic arithmetic (+,-, *, , 1+,L, where 1+ is to increment 1, 1- is to decrement 1, is exponent (that is, 2 3) is 2 to the power of 3 (+12) (+12 3 4) 12) (-34)) 2.4 variable (atom) The length of a variable-name can be up to 255 characters long Variable name begins with an alphabet and followed by alpha-numeric characters. Support a symbol table to handle many variable entries (with C++ map) A variable is either undefined or set for a number (type double). 2.5 let statement to set a variable with a number (to be converted to double), for example, (let x 15) 2.6 print function, for example, (print a) ;; this will output the value of the atom a. Ifnot set, then "undefined" will be printed. (let a 1) (print a) (print (+ a 10.2)) :; this will print a number 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions