Lexical Finite Automata

Creator
Creator
Alan JoAlan Jo
Created
Created
2022 Oct 5 3:19
Editor
Editor
Alan JoAlan Jo
Edited
Edited
2022 Oct 5 3:42
Refs
Refs
  • normal state: copy a character to a token buffer
  • accept state: return a token & go back to intial state
  • “error” state: report an error & stop
 
to make a finite automata as a code we need
  • state
  • lookahead() - just look
  • next() - next character
  • return token
  • report error (there is error state)
  • while lookahead() ≠ EOF
  • case per state
 
 
 
 
  1. Regex to DFA separately
  1. Combine DFAs to NFA
  1. NFA to DFA conversion
  1. Adjust DFA
 
 
 

Recommendations