CS314 Fall 2016
Assignment 4
Due Friday, October 14, 11:55pm EDT.
1
Problem Pointers
Given the following correct program in C,
1. give the correct type definitions for pointer variables ra, rb, rc,
rra, rrb, and rrc.
2. draw a picture that shows all of th
CS314 Fall 16
HW #3 Sample Solution
1.1: LL(1) property - whenever the grammar allows a choice of multiple productions for a single non-terminal symbol, the FIRST+ sets of the right hand sides of the
productions for that non- terminal symbol have to be pa
Fall 2016 CS 314
Homework 4 Solution
1. (a) int *ra; int *rb; int *rc; int *rra; int *rrb; int *rrc;
1. (b)
1. (c)
3,4,11
4,11
11, 3, 11
1. (d)
The answer is flexible, such as ra=*a
2. The answer is flexible, here are two example solutions
(1)for(current_
CS314 Homework 1
Sample solution
Spring 2014
1. (a) 01 , 10
or
01 T, 10 T, T# #, T1 1, 1T 1, T0 0, 0T 0
(b) You may have multiple options to which rule to apply, but you can only apply one rule at a time.
$0110# we have two options $0110# $10# using rule
CS314 Spring 14
HW #3 Sample Solution
1.1: LL(1) property - whenever the grammar allows a choice of multiple productions for a
single non-terminal symbol, the FIRST+ sets of the right hand sides of the productions for that
non-terminal symbol have to be p
CS314 Spring 2014
Assignment 3
Due Friday, February 21, before class
1
Problem LL(1) Grammars and Recursive Descent
Parsing
<program> := program <block> .
<block> := begin <stmtlist> end
<stmtlist> := <stmt> <morestmts>
<morestmts> := ; <stmtlist> |
<stmt
CS314 Fall 2015
Assignment 1
Due Friday, September 18, hard copy at beginning of class
1
Problem Three simple rewrite systems
Remember our rewrite game in the second lecture. We represent arithmetic values > 0
as sequences of | symbols. For example, | rep
CS314 Fall 2013
Assignment 2
Due Tuesday, February 11, before class
1
Problem Context-Free Languages
Are the following languages context-free or not? If yes, specify a context-free grammar in
BNF notation that generates the language. If not, give an infor
Sample Solutions
CS314 Fall 2015 Assignment 1
September 28, 2015
Please note: There are several correct answers to some
of the problems. If you have any questions, please talk
to the TAs or the instructor.
1
Problem Three simple rewrite systems
a.
Rule 1:
CS314 Spring 2014
Assignment 4
Due Friday, February 28, before class
1
Problem Pointers
Given the following correct program in C,
1. give the correct type denitions for pointer variables ra, rb, rc, rra, rrb, and
rrc.
2. draw a picture that shows all of t
CS314 Spring 2014
Assignment 7
Due Tuesday, April 15, before class
Problem 1 Scheme Programming
1. As we discussed in class (lecture 19), let and let* do not add anything to the expressiveness of the language, i.e., they are only a convenient shorthand. F
1 Problem 1 Finite State Automaton (FSA)
The input string has to have at least two symbols, i.e., shorter sequences will be rejected.
NFA without transitions (not a DFA):
< S, s, F, T >
S = cfw_S0, S1, S2
s = S0
F = cfw_S2
T = cfw_S0 0 S0,
S0 1 S0,
S0 0 S
CS314 Spring 2014
Assignment 1
Due Friday, January 31, before class
1
Problem Rewrite Systems
Remember our game in the second lecture.
1. Given the same input, i.e., a sequence of characters starting with $ and ending with
#, and any combination of 0s and
CS314 Fall 2015
Assignment 3
Due Friday, October 9, hard copy at beginning of class
1
Problem LL(1) Grammars and Recursive Descent
Parsing
<program> := program <block> .
<block> := begin <stmtlist> end
<stmtlist> := <stmt> <morestmts>
<morestmts> := ; <st
CS314 Fall 2015
Assignment 4
Due Friday, October 23, hard copy at beginning of class
Section number and Rutgers ID MUST be included.
1
Problem Pointers
Given the following correct program in C,
1. give the correct type denitions for pointer variables ra,
CS 314
Problem Set 2
Sample Solution
1
Problem Context-Free Languages
Are the following languages context-free or not? If yes, specify a contextfree grammar in BNF notation that generates the language. If not, give an
informal argument.
All of these langu
CS314 Spring 2014
Assignment 6
Due Friday, April 4, before class
Sample Solution
Problem 1 Parameter Passing
foo
access
links
fp
a
b
control
links
bar
x
y
z
program foo()
cfw_
a, b integer;
procedure bar(integer x, integer y)
cfw_ z: integer;
<- /* 0 */
z
CS 314 Principles of Programming LanguagesOpenMP Programming Project
Due Date : Monday, May 5 2014, 11:59pm
In this project, you will implement a parallelized version of Project 2 (i.e. Ceasars cipher code breaker).
You are given a sequential C implementa
CS314 Spring 2014
Assignment 5
Due Tuesday, March 11, before class
1
Problem Lexical/Dynamic Scoping
Assume variable names written as capital letters use dynamic scoping and variable names
written as lower case letters use static (lexical) scoping. Assume
CS314 Spring 2014
Assignment 8
Due Friday, April 25, before class
Problem 1 Dependencies
S1:
S2:
S3:
S4:
S5:
S6:
S7:
S8:
S9:
S10:
S11:
S12:
S13:
end.
a := 3;
b := 5;
c := 7;
read(d);
if (d > 0) then
begin
b := b + 1;
c := a + 3;
end
else
begin
a := b + 2;
CS314 Spring 2014
Assignment 6
Due Friday, April 4, before class
Problem 1 Parameter Passing
foo
access
links
fp
a
b
control
links
bar
x
y
z
program foo()
cfw_
a, b integer;
procedure bar(integer x, integer y)
cfw_ z: integer;
<- /* 0 */
z = 5;
/* 1 */
x
CS314 Spring 2014
Assignment 8
Due Tuesday, April 29, before class
Problem 1 Dependencies
S1:
S2:
S3:
S4:
S5:
S6:
S7:
S8:
S9:
S10:
S11:
S12:
S13:
end.
a := 3;
b := 5;
c := 7;
read(d);
if (d > 0) then
begin
b := b + 1;
c := a + 3;
end
else
begin
a := b + 2
make up your own rule in a sense that
say f(x)=x is 3 (or |).Now apply those rule that
when you are done applying rules you should get
4 bars |
$| = | , $# =
a
a
b
b
a
b
a b
First part states that 0+0->0 is rule 1
.
.
(2+2) -> 1 is rule 9
2) solves the e
CS 314 OpenMP Parallel Programming Project
Due Date : Wednesday, May 3, 2017
In this project, you will implement a parallelized version of Project 2 (i.e spell checker that is based on
hash functions).
You are given a sequential C implementation of the ve