A file format for finite automata

Nils Anders Danielsson

This file format can be used in some of the assignments. Save every automaton in a separate text file using the UTF-8 character encoding.

A valid file must contain the following information, in the given order:

Names of elements in Σ and names of states must not contain whitespace or the characters #, { or }, and must not be ε, eps, , -> or *.

Comments are allowed. If a line contains the character #, then everything from this character to the end of the line is ignored.

Lines containing nothing but whitespace and/or comments are allowed and ignored.

Examples

Consider the DFA with the following transition table:

  a b c
 →  * s s s s
s s s s
 * s s s s

This DFA can (for instance) be represented in the following way:

       a  b  c
→ * s₀ s₁ s₀ s₂
    s₁ s₂ s₁ s₁
  * s₂ s₂ s₂ s₂

As a second example, consider the following NFA without ε-transitions:

  a b c
 → s {s₀} {s₁} {s₀, s₂}
s {s₃} {s₂}
s {s₁} {s₄}
s {s₄} {s₃}
 * s {s₄}

This NFA can (for instance) be represented in the following way:

     a    b    c
→ s₀ {s₀} {s₁} {s₀ s₂}
  s₁ {}   {s₃} {s₂}
  s₂ {}   {s₁} {s₄}
  s₃ {s₄} {}   {s₃}
* s₄ {}   {s₄} {}

Now consider the ε-NFA with the following transition table:

  ε a b
 → s {s₁} {s₀, s₂}
s {s₂} {s₄} {s₃}
s {s₁, s₄} {s₃}
s {s₅} {s₄, s₅}
s {s₃} {s₅}
 * s {s₅} {s₅}

This ε-NFA can (for instance) be represented in the following way:

# An ε-NFA.

ε a b

→ s₀ {} {s₁} {s₀ s₂}
s₁ {s₂} {s₄} {s₃}
s₂ {} {s₁ s₄} {s₃}
s₃ {s₅} {s₄ s₅} {}
s₄ {s₃} {} {s₅}
* s₅ {} {s₅} {s₅}