The problem is two-fold the first is to design a state


The problem is two-fold. The first is to design a state diagram to recognize one form of the comments of the C-based programming languages, those that begin with /* and end with */.

I believe I have that (attached as 4#1).

The second part of the question is to write the code to implement the state diagram.

I have attached what I have come up with (attached as 4#3). However, I am unsure what I have left out and what I need to do to define SLASH.

int getComment() {
getChar();

/* slash state */

if(charClass != AST)
return SLASH_CODE;
else {
/* state-end state loop */
do {
getChar();
/* com state loop */
while (charClass != AST)
getChar();
} while (charClass != SLASH);
return COMMENT;
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: The problem is two-fold the first is to design a state
Reference No:- TGS01247980

Now Priced at $20 (50% Discount)

Recommended (98%)

Rated (4.3/5)