Homework 2: Extended Basic Interpreter

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

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

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.
Image of page 1

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

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '08
  • Fisler
  • Context-free grammar, CFWAE

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern