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:
  1. BNF questions of the type asked in Assignment 1:
    1. Given a BNF grammar, decide if a string is derivable from the grammar.
    2. Given a BNF grammar and an input string, draw a parse tree for the string.
    3. Given a BNF grammar, simplify it by reducing the number of rules and/or non- terminal symbols used in the grammar.
    4. Given an English description of a simple syntactic feature, define the BNF rules for it.

  2. Questions about lexical analysis, as covered in Assignment 2:
    1. Given an English description of a type of token, write a regular expression for it.
    2. Given the skeleton for a JFlex lexer, fill in some rule or action to perform a basic lexical analysis task.
    3. Given a BNF, identify the tokens it uses.

  3. Questions about parsing, parse trees, and symbol tables, as covered in Assignment 3:
    1. Given an excerpt of a textbook-style BNF, write the CUP-acceptable grammar for it.
    2. 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.
    3. 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.
    4. Given the specification for a language feature not specifically part of Pascal or EJay, write the CUP grammar and actions to handle the feature.

  4. Questions about operational semantics, as covered in Assignment 4:
    1. Given a functionless EJay program, draw a picture memory at selected points during its execution, where memory is both the static pool and stack.
    2. Given an EJay program with several levels of function call, draw a picture memory at selected points during its execution.
    3. 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.
    4. Given the specification for a language feature not specifically part of Pascal or EJay, write an interpreter method to handle the feature.