Homework 1: Basic Interpreters

Homework 1: Basic Interpreters - CS 4536 Interpreters...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 4536 - Interpreters Assignment CS 4536 Homework 1: Basic Interpreters Due: Thursday Jan 17, 11:59pm via turnin (assignment name hwk1 ) Collaboration Policy : Pairs Permitted Write a parser and interpreter for the WAE language (discussed in class), extended with the following two language features. The textbook can be of great assistance in this assignment; it provides the beginnings of a parser, an abstract syntax datatype and an interpreter. 1. Binary arithmetic operators In place of having separate rules for + and - , define a single syntactic rule for all binary arithmetic operators. Parse these into a binop datatype variant. Define a table that maps operator names (symbols) to actual functions (Scheme procedures) that perform the corresponding operation. Having a single rule like this, accompanied by a table, makes your language easier to extend: once you have modified your parser and interpreter once to support binary operators, you won't need to touch either one to add any number of new ones. To demonstrate this, define multiplication and division (using * and / to represent them in the language's concrete syntax). 2. Multi-armed with Each identifier bound by the with expression is bound only in its body. There will be zero or more identifiers bound by each with expression. If there are multiple bindings of the same
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 02/06/2008 for the course CS 4536 taught by Professor Fisler during the Winter '08 term at WPI.

Page1 / 3

Homework 1: Basic Interpreters - CS 4536 Interpreters...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online