edited by
116 views
0 0 votes

Consider the following lex script

%%
a(b|cd)*b {printf("%s#",yytext); }
a(b|cd)*cd {printf("%s#",yytext); }
a+b*d {printf("%s#",yytext); }

Tokenize the given input strings using the scanner generated using the above script and answer the questions by filling in the blanks

  1. What is the output string corresponding to the input
     abbbdcdabcddc 
    ? $\_\_\_\_\_\_\_$
  2. What is the output string corresponding to the input
  3. abbbcdacdbccd 
    ? $\_\_\_\_\_\_\_$
  4. What is the first substring in the input
    abbbdcdabcddc
    that does not match any pattern? $\_\_\_\_\_\_\_$
  5. What is the last substring in the input
    abbbdcdabcddc
    that does not match any pattern? 
  6. Provide the sequence of substrings in the input
    abbbcdacdbccd
    that do not match any pattern. Fill in the blanks starting from the first blank by filling as many blanks as needed. $\_\_\_\_$ , $\_\_\_\_$ , $\_\_\_\_$, $\_\_\_\_$

Please log in or register to answer this question.

Position:
Show:

Related questions

0 0 votes
0 0 answers
118
118 views
Shubham Sharma 2 asked Dec 8, 2025
118 views
Consider the following augmented grammar:$\text{S'} \rightarrow \text{S}$$\text{S} \rightarrow \text{A a}$$\text{A} \rightarrow \text{B C}$$\text{A} \rightarrow \text{B C...
0 0 votes
0 0 answers
120
120 views
Shubham Sharma 2 asked Dec 8, 2025
120 views
Consider the syntax-directed translation (SDT) scheme, in the form of the rules listed below, to generate three-address code for a simple expression grammar. The attribut...
0 0 votes
0 0 answers
82
82 views
Shubham Sharma 2 asked Dec 8, 2025
82 views
Consider the following C program. Assume the presence of necessary header files.int Sub(int i, int j) { return i - j; } int Mul(int i, int j) { return i * j; } int Delta(...
0 0 votes
0 0 answers
93
93 views
Shubham Sharma 2 asked Dec 8, 2025
93 views
Function $f o o$ in $C$, given below, takes two integers $x, y$ as arguments and returns an integer giving the value of $x^{y}$ (i.e. $x$ raised to the power $y$ ). Assum...