Open main menu

lensowiki β

Computer Science/164/proj3

< Computer Science‎ | 164
Revision as of 06:35, 12 November 2009 by Lensovet (talk | contribs) (Milestone 1: if/else and args/retvals complete)

Milestone 1

  • Fields and methods
    The starter code supports empty objects and string literals, but it does not support adding fields or methods to objects. You can test your implementation on the provided test-fields.164 file, which also details what fields must support and what syntax you must support. This should be done now. However, the string x[0]+x[1] gets evaluated as (x[0]+x)[1] instead of (x[0])+(x[1]).
    • basic syntax for put and get
      • S -> E[E] = E
      • E -> E[E]
    • sugar for variable access
      • S -> E.E = E → E[E] = E
      • E -> E.E → E[E]
    • sugar for method calls with self
      • S -> def E:id(arglist) { body } → E[id] = lambda('self,'+arglist, body)
      • E -> E:Id(arglist) → E[Id](E[Id], arglist)
  • If/else and while statements
    You must add support for if/else and while statements. You can test your implementation on the provided test-ifwhile.164 file. This should be done now.
  • Function arguments and return values
    The starting code supports function calls with no arguments or return values. You must add these features. You can test your implementation on the provided test-functions.164 file. This should be done now. Did some additional testing such as passing a lambda which is then called immediately in the arg list.
  • Coroutines
    You must add support for coroutines and the coroutine, yield, and resume expressions. The coroutine expression creates a new coroutine. The resume expression resumes a coroutine from where it last stopped, raising an error if it has already finished. The yield expression yields back to whoever resumed the coroutine. You can test your implementation on the provided test-coroutine.164 file. Unlike functions, you do not have to support a variable number of arguments for resume and yield. Resume takes two arguments, the second of which is passed as an argument to the function (the first time it is resumed) or returned by the corresponding yield (after the first resume). So yield's return value is the argument passed to the corresponding resume.