CPSC 411 Compiler construction I
Author: Robin Cockett
Date: 21 March. 2008
Assignment #3: Test programs for M+ parser and scanner
- Exponential function (here) -- simple test
of variable scope.
- The Fibonacci sequence (here) -- example of
a recursive program.
- A more efficient way of computing Fibonacci numbers here.
- An example using local functions here.
- Computing the maxium of two numbers here.
- Over use of names (should parse but fails semantic checks) here.
- How to decrement a number here.
- Badly typed expression which parse but will fail type checking here.
- If you can parse this you are seriously
deviating from the grammar!
Assignment #4: Test programs for M+ semantic checking.
From the tests above 1, 3, 4, 5, 6, 7, 8, together with the following
additional tests:
- Local functions can be declared in blocks here
- Does your type checking really work on functions here
- So you should be able to compute averages ... here
Assignment #5: Test programs for M+ code generation.
From the test set for Assignment #3: 1,2,3,7 as corrected here
From the test set for Assignment #4: 1,3
... and a last program here to calculate the
GCD.
Test cases for M: the bonus ...
- Can you append lists here.
- Can you multiply matrices here.
- Quicksort here.
- Mergesort here.
- Backslang here.
- Three dimensional arrays here.
- Are you checking dimensions correctly here?
- Can you mix arrays and datatypes here.