Define the interface of a module that implements the


Problem

1. Complete the design of the language recognizer. Use both TDN and GDN to describe your design. Describe what changes are needed to transform a two-pass solution into a one-pass solution.

2. Define the interface of a module that implements the abstract data-type STACK, where operation pop raises an exception if called to operate on an empty stack.

3. Suppose we are asked to build a cross-reference table for the variables appearing in a pro-gram. A cross-reference program is an aid to reconstructing documentation from other programs that are, by assumption, correct. Thus, according to the specification, it should never happen that a variable is used without or before being declared. For simplicity, we assume that the language does not provide rules specifying the scope of variables: All van- . able names are global. We design a cross-reference table Module CRT-an abstract object-that exports two operations: (1) Procedure NOTIFY is called to insert a variable's name in the table, along with the number of the line on which the declaration of the variable occurred. (2) Procedure OCCUR is called to record the occurrence of a variable in a statement, by specifying the variable's name and the number of. the line on which the variable occurs. As part of the contract with client modules, we specify in the interface that NOTIFY can-not be called if a variable with the same namb is already in the cross-reference table. Also, OCCUR can be called only if the variable we are transmitting as a parameter has already

• been declared (i.e., it was in the cross-reference table).11ese protocols are consistent with , the 'assumption that the source program is Correct. Design a robust CRT module and provide its TDN description. Implement your design in a programming language your choice, assuming that suitable other modules drive CRT: . Discuss the pros and cons of the language as far as exception handling is concerned.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Define the interface of a module that implements the
Reference No:- TGS02685010

Expected delivery within 24 Hours