Using the token types and classification values given in Figure 11.3, show the o
ID: 642544 • Letter: U
Question
Using the token types and classification values given in Figure 11.3, show the output of a scanner when it is presented with each of the following statements:
a. limit = begin + end
b. a = b ? 1;
c. if (c == 50) x = 1; else y = x + 44;
d. thenelse == error ?
Using the token types and classification values given in Figure 11.3, show the output of a scanner when it is presented with each of the following statements: a. limit = begin + end b. a = b ? 1; c. if (c == 50) x = 1; else y = x + 44; d. thenelse == error ?Explanation / Answer
a) limit= begin + end
Token in the statement are "limit", "+", and "end".
Here, the symbols are "limit", "begin" and "end" and the classification number for symbol is 1.
The classification number for "=" is 3 and for "+" is 4
b) a=b-1;
Token in the statement are "a", "=", "b", "-" , "1" and ";".
c)if (c == 50) x = 1; else y = x + 44;
d) thenelse == error ?
Token Classification number limit 1 = 3 begin 1 + 4 end 1Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.