The encoding of the single-step evaluation rules will be in terms of a predicate singlestep(E1, E2) and represent single-step evaluation: expression E1 evaluates to expression E2 in one step: i.e. E1 → E2.
Path:. Copy interp.template to interp.pl and add clauses defining singlestep corresponding to each new language extension. You are strongly advised to proceed in the order in which the constructs/extensions are given in the companion document, except: implement recursion immediately after pairs. Implementation to deal with records and variants are of same complexity and can be done in any order.
The encoding of the type inference rules will be as a predicate typeof(G, E, T) and represent type judgement: expression E has type T in type environment G. i.e. G ⊢ E : T.
Path:. Copy typeinfer.template to typeinfer.pl and add clauses defining typeof corresponding to each new language extension. You are strongly advised to proceed in the order given in the companion document. The programs permit implicit as well as explicit type annotations (e.g. see the use of lambda). You should ensure that the type inference works for explicitly typed programs first before proceeding to implicit types.
This assignment expects you to treat let as monomorphic. Implementing a polymorphic let (see text book) is an extra-credit option.
Submit your homework via Blackboard. In "Assignments" area there you will see a form for HW4. Fill it out by uploading the archive.
Please note that the available material can be used in SWI Prolog as well as XSB Prolog. I expect your programs to be system agnostic as well. In case you see the need to use system-specific commands, make sure that you (a) include a README file in your archive, specifically and very visibly stating which system we should test your programs on; and (b) stating this information in the "Comments" section of the assignment submission form as well.
Make sure you submit the form. You may submit this homework as many times as necessary. The last submission that meets the HW deadline will be graded.