CSC 330 Midterm Study Guide
The midterm will be open book, open note. The questions will be focused on the
work that you have done in the assignments. The questions will be limited to
the following topic areas:
-
BNF questions of the type asked in Assignment 1:
-
Given a BNF grammar, decide if a string is derivable from the grammar.
-
Given a BNF grammar and an input string, draw a parse tree for the string.
-
Given a BNF grammar, simplify it by reducing the number of rules and/or non-
terminal symbols used in the grammar.
-
Given an English description of a simple syntactic feature, define the BNF
rules for it.
-
Questions about lexical analysis, as covered in Assignment 2:
-
Given an English description of a type of token, write a regular expression for
it.
-
Given the skeleton for a JFlex lexer, fill in some rule or action to perform a
basic lexical analysis task.
-
Given a BNF, identify the tokens it uses.
-
Questions about parsing, parse trees, and symbol tables, as covered in
Assignment 3:
-
Given an excerpt of a textbook-style BNF, write the CUP-acceptable grammar for
it.
-
Given a description of the kind of parse tree that should be generated for a
particular programming language construct, write the CUP action to build the
tree.
-
Given a description of the kind information that should stored in a symbol
table for a particular programming language construct, write the CUP action to
build enter the information in a symbol table.
-
Given the specification for a language feature not specifically part of Pascal
or EJay, write the CUP grammar and actions to handle the feature.
-
Questions about operational semantics, as covered in Assignment 4:
-
Given a functionless EJay program, draw a picture memory at selected points
during its execution, where memory is both the static pool and stack.
-
Given an EJay program with several levels of function call, draw a picture
memory at selected points during its execution.
-
Given an EJay program that uses arrays and structs, draw a picture of the
static pool, stack, and heap at selected points during its execution.
-
Given the specification for a language feature not specifically part of Pascal
or EJay, write an interpreter method to handle the feature.