UMBC CMSC202, Computer Science II, Spring 1998,
Sections 0101, 0102, 0103, 0104 and Honors
Tuesday February 24, 1998
- A Book on C: 2.2
- Programming Abstractions in C:
Handouts (available on-line):
We looked one more time at the majority
program and emphasized again at the need to think clearly and
argue convincingly that a program is correct.
Introduced the Backus-Naur Form for describing syntax. (See
Section 2.2 of A Book on C.)
We build a calculator program that considers operator precedence of
* over + and works with nested parentheses. Another feature
of this program is its ability to report errors (and point to
the location of the syntax error).
See sample run.
The calculator program is divided into 2 parts. The
parser works with higher level
concepts (expressions, terms and factors). The parser
essentially follows the derivation rules for a legal
The tokenizer does the string and
character manipulations for the parser. As usual, the functions
provided by the tokenizer and the types used by the tokenizer
is given in a header file.
23 Mar 1998 13:06:58 EST
to Spring 1998 CMSC 202 Section Homepage