339 views
2 2 votes

A lexical analyzer recognizes the following set of tokens defined by regular expressions:

  • Token $1\left(T_1\right)$ : $a$
     
  • Token $2\left(T_2\right)$ : $a a$
     
  • Token 3 ( $T_3$ ): $a^* b$ (zero or more 'a's followed by a single ' b ')
     
  • Token $4\left(T_4\right)$ : $b a$

Given the input string "aaaba", determine how many tokens will be generated using the Maximal Munch (Longest Prefix Match) rule.

3 Answers

Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
375
375 views
GO Classes asked Jan 1
375 views
Consider the following snippet of code in a C-like language:if(x_val >= 20.5) count = count + 1;Assuming the standard lexical rules (where keywords, identifiers, operator...
4 4 votes
3 3 answers
412
412 views
GO Classes asked Jan 1
412 views
Consider the following context-free grammar:Productions:$S \rightarrow A$$S \rightarrow B$$A \rightarrow a A b$$A \rightarrow \epsilon$$B \rightarrow c B d$$B \rightarrow...
1 1 vote
3 3 answers
351
351 views
GO Classes asked Jan 1
351 views
Consider the following grammar:$E \rightarrow T R$$R \rightarrow+T R$$R \rightarrow \epsilon$$T \rightarrow F Y$$Y \rightarrow * F Y$$Y \rightarrow \epsilon$$F \rightarro...
1 1 vote
3 3 answers
394
394 views
GO Classes asked Jan 1
394 views
Consider the following grammar: $$S \rightarrow A B A \rightarrow a|\epsilon B \rightarrow b| S$$Which of the following represents the correct FIRST(S)?$\{a, b, \epsilon\...