705 views
0 votes
0 votes

Using the lexical specification below, what sequence of the rules is used to tokenize the string "dictatorial"?

1.dict 

2.dictator 

3.[a-z]*

4.dictatorial

What i think the question is asking is for the regular expression so that while pattern matching the string "dictatorial" will be chosen as token. what i am not getting here is the answer to this question, which is option 3.

my doubt is,why not option 4th ? i mean both are fulfilling the requirements after all.

the solution has stated that 3rd one has the higher priority than 4th one and i don't understand why!

Please log in or register to answer this question.

Related questions