Problem 1 Note: we did not take points if you calculated the substitutioon in a forwards style, incrementally, as you decomposed the constraints (the algorithm discussed in class and MP updates the substitution backwards). -1p for each missing step of the algorithm -1p for each binding missing from the final substitution solution -3p if you did not apply the substitution corresponding to the Elimination step to the remaining constraints -3p if your substitution is not a substitution -3p if you replaced the constraints V=t1 and V=t2 with t1=t2 and lost track of V -1p if you applied Orient to a pair of variables (precisely one of them should be a variable) -3p if you took the freedom to apply equational reasoning at will (not part of the algorithm) -3p if the resulting substitution is not canonical -5p if you took the freedom to swap arguments of constructors (very wrong to do this!) -5p if you got a result which is wrong -3p if you forgot to show the actual solution -2p if you forgot to remove the eliminated equality from the set of constraints when applied Eliminate -3p if you eliminated a variable which cannot be eliminated (for example, y in z=y) Problem 2 (a): 1pt for the empty substitution case 1pt for matching the first element of the list representing the substitution 3pts for applying the first entry in the substitution correctly or recursing on the remaining of the substitution Problem 2 (b): 2pts for the case when the type is (TyVar v) 3pts for the case when the type is (TyConst (c, ts)) Problem 3 (a): -3pts: regular expression accepts both too much and to little -2pts: regular expression accepts both too much -2pts: regular expression accepts both too little -2pts: missing ; -2pts: ; after the last pair -1pt: { and } around every pair -1pt: (0 | 1)* instead of (0 | 1)+ and/or (a | b)* instead of (a | b)+ Problem 3 (b): -3pts: grammar is not (right) regular -1pt: grammar is not regular by class definition -2pts: grammar accepts to much -2pts: grammar accepts to little Problem 4(a,b,c) 0pts if answered none exists when a parse tree exists 0pts if answered with a parse tree when one doesn't exist -2pts for each missing non terminal -1pt for each missing terminal Problem 5(a) -2pts if a clear example is not shown -4pts if the definition of ambiguity and example is completely wrong Problem 5(b) -2pt if grammar is "buggy" but has a guessable quick fix, e.g. did not define the rule 0pt if grammar is "buggy" and there's no quick fix, e.g. a grammar that parses nothing or parses only trivial strings -3pt if the grammar is ambiguous -3pt if the + does not have a higher precedence than raise -3pt if + is not left associative -2pt if there is a string accepted by the original grammar but not in the new grammar -2pt if there is a string accepted by the new grammar but not in the original grammar Problem 6 (a) -1pt for each missing token definition -1pt if the token is not a constant Problem 6 (b) +3pt Plus to Dollar term must be of type term * trem +1pt for Zero term representation +1pt for One term representation Problem 6 (c) +1pt correct match for a plus token +2pts correct nested match for term1 (after the plus token) +2pts correct nested match for term2 (after term1) +1pt correct nested match with a dollar token and the rest +2pts for the correct constructor call of Plus to Dollar term +1pt for raising Failure no Parse after if the dollar token is not matched +1pt correct match for the zero token +1pt correct match for the one token +1pt for raising Failure no Parse if the Plus token is not matched +3pts for correct parse tokens function that makes sure the input token list is empty Problem 7. Horizontally: +1pt for each correct row in the solution Partial credit vertically: -1pt for each wrong stack configuration -1pt for each wrong current string problem 8: 3pts: solving the ambiguity related to the associativity of ; 2pts: showing the nested case ambiguity 5pts: solving the nested case ambiguity