Recognition of Tokens in Compiler Design

Estudies4you
Recognition of Tokens in Compiler Design
Recognition of Tokens
Tokens can be recognized by Finite Automata
A Finite automaton(FA) is a simple idealized machine used to recognize patterns within input taken from some character set(or Alphabet) C. The job of FA is to accept or reject an input depending on whether the pattern defined by the FA occurs in the input.
There are two notations for representing Finite Automata. They are
  Transition Diagram
  Transition Table
Transition diagram is a directed labeled graph in which it contains nodes and edges
Nodes represents the states and edges represents the transition of a state
Every transition diagram is only one initial state represented by an arrow mark (-->) and zero or more final states are represented by double circle
Example:
 Where state "1" is initial state and state 3 is final state.
Finite Automata for recognizing identifiers

Finite Automata for recognizing keywords

Finite Automata for recognizing numbers

Finite Automata for relational operators

Finite Automata for recognizing white spaces 
To Top