We are here to serve you

[30% discount for US and UK students ! Get 10$ for referring a student in any programming or assignment task]













Quality Assignment help, homework help and programming help











Assignment








Login | Register | Live Chat



We pro





































Quality Assignment help, homework help and programming help











Assignment








Login | Register | Live Chat







Programming : C, C++, Java, Python, Algorithm, Lisp, Scheme, Databases, Data-structure, javascript, Perl, Fortran, Logo design, Banner design, Php, Asp.net etc
Subjects: Mathematics, Mathematica, Physics, Accounts, Finance, Business, etc



Other services: Data entry, Test orientation help, Online tutoring , Article writing, programming testing, Coding error correction, etc



Websites, IT & Software


NET


Active Directory

AJAX

Amazon Web Services

Apache

Apache Solr

Apple Safari

AS400 & iSeries



ASP

Asterisk PBX

AutoHotkey

Azure

Balsamiq

Blog Install

BMC Remedy

Boonex Dolphin

Business Catalyst



C Programming

C# Programming

C++ Programming

CakePHP

Chordiant

Chrome OS

Cisco

Cloud Computing

CMS

COBOL

Cocoa

Codeigniter

Cold Fusion

Computer Graphics

Computer Security

CRE Loaded

CubeCart

CUDA

Delphi

Django

DNS

DotNetNuke

Drupal

Dynamics AX
# eCommerce


eLearning


Mac OS

Magento

Metatrader  

Microsoft

Microsoft Access

Microsoft Exchange

Microsoft Expression

MMORPG

MODx  

MySpace  

MySQL

Nginx

NoSQL Couch & Mongo

Objective C

OCR  

Oracle

OSCommerce

Parallels Automation

Parallels Desktop

Pattern Matching

Paypal API  

Pentaho

Perl  

Photoshop Coding

PHP

PICK Multivalue DB

Plesk

Prestashop

Prolog  

Protoshare

Python

REALbasic

Rocket Engine

Ruby & Ruby on Rails

SAP

Script Install

Sencha / YahooUI  

SEO  

Sharepoint  

Shell Script  

Shopping Carts


Electronic Forms

Embedded Software

Erlang

Expression Engine

Face Recognition

Facebook

FileMaker

Firefox

Fortran

Forum Software

FreelancerAPI

Game Design

Google Analytics

Google App Engine

Google Buzz

Google Chrome

Google Earth

Google Go

Google Plus

Google Wave

GPGPU

HP Openview

HTML

HTML5

IBM Tivoli

IIS

Interspire


JavaFX

Javascript

Joomla

jQuery / Prototype

JSP

Kinect

LabVIEW

Link Building

Linux

Lotus Notes

Silverlight

Smarty PHP

Social Engine

Social Networking

Software Architecture

Software Testing

Solaris

SQL

Symfony PHP

System Admin

TaoBao API

TestStand

Twitter

UML Design

Unity 3D

UNIX

Usability Testing

User Interface / IA

vBulletin

Virtual Worlds

Virtuemart

Virtuozzo

Visual Basic

Visual Foxpro

VoIP

Volusion

vTiger

Web Scraping

Web Security

Website Testing

Windows Desktop

Windows Server

Wordpress

XML

XSLT

Yii

YouTube

Zen Cart

Zend
Mobile Phones & Computing


Amazon Kindle

Android

Android Honeycomb

Appcelerator Titanium


Blackberry

Geolocation

iPad

iPhone


J2ME

Mobile Phone

Nokia

Palm


Samsung

Symbian

Windows CE

Windows Mobile
Writing & Content


Academic Writing

Article Rewriting

Articles

Astroturfing

Blog

Book Writing

Cartography Maps

Copy Typing

Copywriting


eBooks

Editing

Fiction

Financial Research

Forum Posting

Ghostwriting

Grant Writing

LaTeX

Medical Writing


Newsletters

PDF

Powerpoint

Press Releases

Product Descriptions

Proofreading

Publishing

Report Writing

Research


Resumes

Reviews

Speech Writing

Technical Writing

Translation

Travel Writing

WIKI
Design, Media & Architecture


3D Animation

3D Modelling

3D Rendering

3ds Max

ActionScript

Advertisement Design

After Effects

Animation

Arts & Crafts (8)

Audio Services (38)

Banner Design (89) (1)

Blog Design (18)

Brochure Design (20) (0)

Building Architecture (22)

Business Cards (12) (1)

Capture NX2 (0)


Caricature Cartoons

Commercials

Concept Design

Corporate Identity

Covers & Packaging

CSS

Dreamweaver

Fashion Design

Final Cut Pro

Finale / Sibelius

Flash

Flex

Flyer Design

Format & Layout

Google SketchUp

Graphic Design (1331) (49)


Icon Design (21) (0)

Illustration (67) (0)

Illustrator (101)

InDesign (14)

Industrial Design (7)

Interior Design (9)

Invitation Design (1)

Logo Design (266) (32)

Maya (14)

Music (18)

Papervision3D (3)

Photo Editing (15)

Photography (26) (11)

Photoshop (279) (1)

Photoshop Design (59) (1)

Poster Design (4)


Print (3) (1)

PSD to HTML (76)

PSD2CMS (10)

QuarkXPress (0)

Shopify Templates (0)

Stationery Design (6) (0)

Sticker Design (1)

T-Shirts (12) (0)

Templates (31)

Typography (5)

Video Broadcasting (36)

Video Services (136)

Voice Talent (45)

Website Design (1761) (2)

Word (14)

Yahoo! Store Design (2)
Data Entry & Admin


Article Submission (95)

BPO (81)

Customer Support (38)

Data Entry (609)


Data Processing (271)

Desktop Support (10)

Excel (261)

Order Processing (11)


Phone Support (16)

Technical Support (9)

Transcription (24)

Video Upload (22)


Virtual Assistant (80)

Web Search (103)
Engineering & Science


Aeronautical Engineering (3)

Algorithm (17)

AutoCAD (24)

Biology (3)

Biotechnology (4)

CAD/CAM (22)

Chemical Engineering (4)

Civil Engineering (8)

Climate Sciences (1)

Construction Monitoring (0)

Cryptography (2)




Data Mining (45)

Electrical Engineering (41)

Electronics (45)

Engineering (39)

Finite Element Analysis (5)

Geology (1)

GPS (7)

Home Design (7)

Imaging (2)

Instrumentation (4)

Machine Learning (1)


Manufacturing Design (19)

Materials Engineering (5)

Mathematics (15)

Matlab & Mathematica (28)

Mechanical Engineering (14)

Mechatronics (5)

Medical (10)

Microcontroller (25)

Microstation (0)

Mining Engineering (1)

Natural Language (3)


PCB Layout (23)

PLC & SCADA (3)

Product Management (3)

Project Scheduling (2)

Quantum (1)

Scientific Research (10)

Solidworks (8)

Statistics (8)

Structural Engineering (5)

Verilog / VHDL (3)

Wireless (23)
Product Sourcing & Manufacturing


Buyer Sourcing

Logistics & Shipping

Manufacturing

Product Design

Product Sourcing

Supplier Sourcing


Sales & Marketing


Ad Planning & Buying

Advertising

Branding

Bulk Marketing

Classifieds Posting

CRM

eBay

Google Adsense




Internet Marketing

Leads

Market Research

Marketing

MLM

Sales

SEM / Adwords

Telemarketing
Business, Accounting, Human Resources & Legal


Accounting

Audit

Business Analysis

Business Plans

Contracts

Employment Law

ERP

Event Planning

Finance

Fundraising

Human Resources

Inventory Management

ISO9001

Legal

Legal Research

Management




Patents

Payroll

PeopleSoft

Project Management

Property Law

Public Relations

Quickbooks & Quicken

Recruitment

Salesforce.com

SAS

Tax

Tax Law

Visa / Immigration
Other


Anything Goes (95)

» Science Assignment Help

» Mathematics Assignment Help

» Chemistry Assignment Help

» Physics Assignment Help

» Biology Assignment Help

» English Assignment Help

» Psychology Assignment Help

» History Assignment Help

» Geography Assignment Help

» Arts Assignment Help

» Nursing Assignment Help

» Assignment Help Australia

» Assignment Help UK

» Assignment Help USA

Management Subjects

» Accounting Assignment Help

» Finance Assignment Help

» Statistics Assignment Help

» Marketing Assignment Help

» HR Assignment Help

» Operations Assignment Help

» Strategy & Planning Assignment Help

» Project Management Assignment Help






» Economics Assignment Help

» IT Management Assignment Help

» Public Relations Assignment Help

» Do My Assignment

» Assignment

» Write My Assignment

Engineering Subjects

» Biotechnology Assignment Help

» Computer Science Assignment Help

» Electronics Assignment Help

» Mechanical Assignment Help

» IT Assignment Help

» Languages: C, C++, C#, Java, VB, .Net

» Databases: SQL, Oracle, MS Access

» Datastructures Assignment Help

» Operating Systems Assignment Help

» Computer Network Assignment Help

» UML Diagrams Assignment Help




» Do My Homework

» Make My Assignment

» Do My Essay

Other Subjects

» Essay Assignment Help

» Case Studies Assignment Help

» Business Development essays

» Psychology Assignment Help

» Arts & Architectures

» Humanities Assignment Help

» Social Science Assignment Help

» Essay Help & Custom Essays

» Dissertation Writing Help

» LawAssignment Help

» Programming Assignment Help

» Assignment Writing

» Assignment Help UAE

» Assignment Help Online
































Lisp


Lisp Question
This project involves completing an interpreter for an imperative language written in a functional language--LISP. A copy of the skeleton interpreter is attached.
To understand this program, it is essential to understand the program state that is carried from one statement to the next as the interpreter executes a program. Consider the sample program that was provided in the requirements:
((assign x to 1) (assign y to (x * 2)) (write x) (write y))
Show what is in the three-element list that contains the program state after the execution of each of the four statements in the above program.
Requirements:
The fourth project involves completing a LISP program hat is provided in the case study of module 5. That program interprets a simple imperative language. The skeleton version provided interprets assignment and write statements and evaluates binary expressions. The following dialog illustrates the execution of a simple program with that version.
>(interpret-program '((assign x to 1) (assign y to (x * 2)) (write x) (write y)) nil)
(1 2)
The complete grammar of the language is provided below in extended BNF:
program ::=
statement_list
statement_list::=
statement|
   ({statement})
statement ::=
assignment_statement|
write_statement|
read_statement|
if_statement|
while_statement
assignment_statement::=
   (assignvariable to expression)
write_statement::=
   (writeexpression)
read_statement::=
   (readvariable)
if_statement::=
   (ifexpression then statement_list1else statement_list2)
while_statement::=
   (whileexpression do statement_list)
expression ::=
variable|
literal|
(unary_operator expression) |
(expressionbinary_operator expression)
Nonterminals are shown in red, terminals in blue and BNF metasymbols are black. You must add the functions to interpret the read, if and while statements and the function to evaluate unary expressions and modify the necessary functions to call them. You are not required to perform any syntax checking on the input. You may assume that the programs are syntactically correct. Explicit input and output should not be used in this program. The main function should accept the input as a parameter. The output should be the value of the main function. In addition, no explicit iteration should be used, recursion must be used in its place.
Answer

; main function creates state containing supplied input and empty
; memory and output, returns output

(defun interpret-program (program input)
    (third (interpret-statement-list program (list '(()) input nil))))

; interprets a single statement if statement-list is a single statement
; recursively interprets all statements if it is a list

(defun interpret-statement-list (statement-list state)
    (cond
        ((null statement-list) state)
        ((atom (first statement-list)) 
            (interpret-statement statement-list state))
        (t (interpret-statement-list (rest statement-list)
            (interpret-statement (first statement-list) state)))))

; determines the type of statement based on the first word
; and calls the appropriate function to interpret it

(defun interpret-statement (statement state)
    (cond
        ((eq (first statement) 'assign)
            (interpret-assignment-statement (second statement)
            (fourth statement) state))
        ((eq (first statement) 'write)
            (interpret-write-statement (second statement) state))
        ((eq (first statement) 'read)
            (interpret-read-statement (second statement) state))
        ((eq (first statement) 'if)
            (interpret-if-statement (second statement)
                                    (fourth statement)
                                    (sixth statement)
                                    state))
        ((eq (first statement) 'while)
            (interpret-while-statement (second statement) (fourth statement)
                                       state))))

; interprets the write statement by evaluating the expression
; and appending its value to the output stream

(defun interpret-write-statement (write-expression state)
    (let
        ((memory (first state))
        (input (second state))
        (output (third state)))
    (list memory input (append output 
        (list (evaluate-expression write-expression state))))))

; interprets the assignment statement by evaluating the expression
; and assigning the value to the specified variable

(defun interpret-assignment-statement (variable expression state)
    (let
        ((memory (first state))
        (input (second state))
        (output (third state)))
    (list (set-value memory variable 
        (evaluate-expression expression state)) input output)))

; interprets the read statement, taking first value from input list
; and assigning the value to the specified variable

(defun interpret-read-statement (variable state)
  (let
        ((memory (first state))
         (input (second state))
         (output (third state)))
    (list (set-value memory variable (first input))
          (rest input)
          output)))

; interpets the while statement, evaluating its expression and, if its
; value is true, interpeting statement list and interpeting while
; statement again.

(defun interpret-while-statement (expression statement-list state)
  (let
        ((memory (first state))
         (input (second state))
         (output (third state)))
      (let ((condition (evaluate-expression expression state)))
        (cond
          (condition
           (interpret-while-statement expression statement-list
                                      (interpret-statement-list statement-list
                                                                state)))
          (t
           state)))))

; interprets the if statement, evaluating its expression, and if its value
; is true, interprets true-statement-list, and false-statement-list otherwise

(defun interpret-if-statement (expression
                               true-statement-list
                               false-statement-list
                               state)
  (let
        ((memory (first state))
         (input (second state))
         (output (third state)))
      (let ((condition (evaluate-expression expression state)))
        (cond
          (condition
           (interpret-statement-list true-statement-list state))
          (t
           (interpret-statement-list false-statement-list state))))))


; evaluates an expression by checking whether it is a literal, a
; variable, a binary or unary expression

(defun evaluate-expression (expression state)
    (cond
        ((numberp expression) expression)
        ((atom expression) (get-value (first state) expression))
        ((eq (length expression) 2)
            (evaluate-unary-expression expression state))
        ((eq (length expression) 3)
            (evaluate-binary-expression expression state))))

; evaluates a binary expression by first evaluating the subexpressions
; and then applying the operator to those subexpressions

(defun evaluate-binary-expression (expression state)
    (let
        ((left-operand (evaluate-expression (first expression) state))
        (operator (second expression))
        (right-operand (evaluate-expression (third expression) state)))
    (apply operator (list left-operand right-operand))))

; evaluates an unary rexpression by evaluating the subexpression
; and then applying the operator to the subexpression

(defun evaluate-unary-expression (expression state)
  (let
      ((operator (first expression))
       (operand (evaluate-expression (second expression) state)))
    (apply operator (list operand))))

; adds the variable-value pair to the head of the association list
; that comprises the current state of the memory.  Previous 
; occurences of that variable are not removed.

(defun set-value (memory variable value)
    (cons (list variable value) memory))

; retrieves the value of a variable from the association list
; that comprises the current state of the memory 

(defun get-value (memory variable)
    (second (assoc variable memory)))