Question: Write a program that implements the algorithm delimterMatching() from section 4.1. delimiterMatching(file) read character ch from file; while not end of file if ch is

Write a program that implements the algorithm delimterMatching() from section 4.1.

delimiterMatching(file)

read character ch from file;

while not end of file

if ch is '(', '[', or '{'

puch(ch);

else if ch is ')', ']', or '}'

if ch and popped off delimiter do not match

failure;

else if ch is '/'

read the next character;

if this character is '*'

skip all characters until '*/' is found and report an error

if the end of the file is reached before '*/' is encountered;

else ch = the character read in;

continue; // go to the beginning of the loop;

// else ignore the other characters;

read next character ch from file;

if stack is empty

success;

else failure;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!