Question: Lexical Analysis The automaton is represented as a table, but note that this table is different from the tables discussed in lecture; The automaton has

Lexical Analysis
The automaton is represented as a table, but note that this table is different from the tables discussed in lecture; The automaton has five states 1-5, each of which has an associated action for each input a-c or end-of-file $. For a given state $ and imput (or end-of-file) I:
If the [S,I] entry is a state n, then in state S on input I the automaton transitions to state n and advances to the next input character.
If the [S,I] entry is A, then in state S on input I the automaton accepts the prefix of the input up to, but not including, the current input character. This prefix is removed from the input, and the automaton moves to state 1 and continues, Note the current input character is not conisumed.
If the [SI] entry is E, then in state S on input I the automaton reports an error and halts.
If the [S,8] entry is T, then in state S on input $ the automaton terminates successfully.
a)(10 points) Give a lexical specification that tokenizes input strings in the same manner as this automaton. Your lexer should only describe successfully terminating runs of the automaton. For full credit, your specification should be the shortest (in total length of rules) possible.
Lexical Analysis The automaton is represented as

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!