Lexical analysis

Finite Automata

Draw or load a DFA or NFA, check whether it is deterministic, and run strings through it step by step.

  • Lecture reference: Lexical Analysis III · slides 3–16

DFA: strings ending in 00

Lecture reference: Lexical Analysis III · slide 8

A complete DFA over { 0, 1 }: every state has a 0- and a 1-transition.

What language does this recognize? Give the RE.

Show answer

L(R) where R = (0 | 1)*00

The strings over { 0, 1 } that end in 00.

Automaton

DFA Every state has exactly one transition on each symbol of Σ. Open in DFA Minimization
100101

Double-click empty space to add a state. Drag from a state with Shift held, or from the + on a selected state, to add a transition. Click a label to edit it; double-click a state to toggle accepting. Double-tap empty space to add a state. Tap a state, then drag its + to another state to add a transition. Tap a label to edit it.

3 states · 6 transitions. Select a state or a transition to edit it.

Run

1100
Step 1 of 5
Start in state A.
Path
  1. →1
  2. →1
  3. →0
  4. →0
The outcome is decided at the end of the input.

M = (Σ, S, s0, F, T)

Σ
= { 0, 1 }
input alphabet
S
= { A, B, C }
states
s0
= A
start state
F
= { C }
accepting states

T : S × Σ → S transition function

  • A→0B
  • A→1A
  • B→0C
  • B→1A
  • C→0C
  • C→1A

Batch run

3 of 6 accepted.

  • Accept "00" ends in C
  • Accept "100" ends in C
  • Accept "1100" ends in C
  • Reject "001" ends in A
  • Reject "0" ends in B
  • Reject "" ends in A