CS 3723 Programming Languages
Fall 2001 -- Review for Final Exam
Exam is Tuesday, 11 December 2001
Refer to the review for Exam 1
for material in the first part of
the course.
Topics:
- Simple Translation of Arithmetic Expressions:
- Full Parser of Course Grammar:
- Translation of AEs to Quadruples (Project III):
- Translation of Control Structures to Quadruples (Project IV):
- Implementing functions and parameters:
- Need extensions of the Quadruple machine, at least to include
and indirect JMP.
- Use of a run-time stack and activation records to support
return addresses, parameters to functions, local variables,
local arrays, value returned by a function, and pointers of
various kinds.
- Run-time storage management:
- Discuss C, C++, and Java with respect to:
simple variables, arrays, structs (or classes), parameters,
return values, assignment operator, static variables,
dynamic allocation, dynamically allocating primitive types
(C/C++ yes, Java no except in type-wrapper classes),
allocating arrays, automatic initialization, recovering
dynamic storage (C uses free, C++ uses new, Java automatic
with garbage collection).
- Static and global variables declared in a separate area.
- Local variables on the stack.
- New (or malloced) objects in a separate area (called the
heap).
- More on garbage collection in Java.
- Postscript:
- A 2-dimensional page description language.
- Allows the font characters themselves to be described algorithmically
and manipulated.
- Provides many good primitives for drawing 2-dim figures.
- A number of examples:
Postscript programs.
Sample Questions:
- About parsers:
- Given a parser, say what it is doing (and how).
- Write a parser for a simple example language.
- Translating AEs to quads:
- Explain how the returned addresses of run-time
variables work. (Variables which will hold the desired
value at run time.)
- Given some semantic actions, say how they are working.
- Given a parser, create semantic actions to do some simple
task.
- Translating control stuctures:
- Describe how the backpatching works.
- Actually do the translation for some simple example.
- Functions and parameters:
- Show the activation records used at run-time on a stack. Explain.
- Run-time storage management:
- Explain how and when the run-time stack is used.
- Explain about the heap, including garbage collection.
- Postscript:
- Given a simple example program, answer questions about it.
Revision date: 2001-12-04.
(Please use ISO
8601, the International Standard.)