CS 515 Programming Languages and Compilers I
Problem Set 2
Sample Solution
Problem 1 Predictive Parsing
Assume the following CFG for predicate logic prex expressions.
1:
2:
3:
4:
5:
6:
7:
8:
Start :=
CS 314 Principles of Programming Languages
Due date: Thursday, April 1, beginning of lecture
Problem 1
Recall the type checker based on an attribute grammar that we discussed in lectures 13 / 14.
For
198:515 Programming Languages and Compilers I
Problem Set 6
Sample Solution
Problem 1 - let and let* in TINY
1. How can the let and let* constructs be expressed in the TINY language? In other
words, c
198:515 Programming Languages and Compilers I
Problem Set 7
Sample Solution
Problem 1 - Unication in Prolog
Unify (if possible) the following Prolog lists and report any variable bindings imposed.
a)
198:515 Programming Languages and Compilers I
Problem Set 5
SAMPLE SOLUTION
Problem 1 - normal form
Using CR-I as discussed in class (see lecture 6, page 6), prove that if a normal form exists
for -te
CS 515 Homework 2 Sample Solution
1.1)
I1
g goal ,$
I0
g goal ,$
goal expr ,$
expr term AND expr ,$
expr term ,$
Term factor OR term ,$/AND
Term factor ,$/AND
factor TRUE ,OR/AND/$
factor FALSE ,OR/AN
198:515 Programming Languages and Compilers I
Problem Set 4
SAMPLE SOLUTION
Problem 1 - -term abbreviations
Give the fully expanded -terms for the following -term abbreviations as discussed in class
(
198:515 Programming Languages and Compilers I
Problem Set 8
Sample Solution.
Problem 1 - Dependence Analysis
Give the direction vectors, and if possible the distance vectors for all dependences in the