Computer Science/164/proj3

From lensowiki
Jump to: navigation, search

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. Precedence is now correct as well.
    • 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. Now fixed to deal with recursion.
  • 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. Finally implemented and works regardless of how deeply inside a callstack the yield happens.