Homework 2: Extended Basic Interpreter

Homework 2: Extended Basic Interpreter - CS 4536 - Extended...

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

View Full Document Right Arrow Icon
CS 4536 - Extended Interpreters Assignment CS 4536 Homework 2: Extended Basic Interpreter Due: Thursday Jan 24, 11:59pm via turnin (assignment name hwk2 ) Collaboration Policy : Solo Write a parser and interpreter for the FWAE language (discussed in class), with eager semantics and deferred substitutions, extended with the following two language features. 1. Conditionals To save the trouble of having to add boolean values and operators over them, create the construct if0 using the syntax described by the grammar below. Note that if0 has three parts: A test expression A then expression, which evaluates if the test expression evaluates to zero An else expression, which evaluates for any other number. Evaluation should signal an error for non-numeric test values. 2. Multi-argument fun Extend the fun language feature described in lecture so that functions can accept a list of zero or more arguments instead of just one. All arguments to the function must evaluate with the same deferred substitutions . To simplify your program, you may assume that the number of arguments in a function invocation always matches the number in the procedure definition. For example: {{fun {x y} {* x y}} 2 3} evaluates to 6. Specifically, this means that you do not need, nor will we try, test cases that violate this assumption. The following grammar gives the concrete syntax of the resulting language, CFWAE:
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 / 4

Homework 2: Extended Basic Interpreter - CS 4536 - Extended...

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