Third Lecture (compiler theory) lexical analysis

Regular Expressions

  1. Priority of: * (the Kleene closure) connected, | (or operation).

Regular defined

Finite Automata

Here Insert Picture Description

  • With input
  • Read head
  • Finite Controller
  1. FM definition language
  2. Longest substring matching principle
    Here Insert Picture Description

There are classification of finite automata

  1. DFA: deterministic finite automata
  2. NFA: non-deterministic finite automata
    Here Insert Picture Description
  3. Automatic machine with a "E- edge" with automatic machines without "E- edge" having equivalence
  • Automatic machine with a "E- edge" is more intuitive
    Here Insert Picture Description

DFA implementation

  1. DFA can transition diagram or the conversion table indicates
    Here Insert Picture Description

Lexical analyzer

RE (regular expressions) - NFA - DFA

From RE to NFA

Here Insert Picture Description
Here Insert Picture Description

From NFA to DFA

Subset construction method
Here Insert Picture Description

Lexical analyzer

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Published 109 original articles · won praise 128 · views 40000 +

Guess you like

Origin blog.csdn.net/JAck_chen0309/article/details/104603296