computation-hs / comp-models

An implementation of several models of computation.
http://computation-hs.github.io/comp-models/
GNU General Public License v2.0
2 stars 0 forks source link

Automata input format #16

Open mroman42 opened 9 years ago

mroman42 commented 9 years ago

We should decide a standard format for reading and writing automatas. Something like:

dfa
alpha: [a,b,c]
states: [A,B,C]
A a -> A
A b -> B
A c -> B
B a -> B
B c -> C
C a -> C

(Maybe alpha and states are not necessary)

mx-psi commented 9 years ago

YAML seems quite similar to this, except for the transition function definition, which might be implemented as a list of triples. There is a Haskell YAML parser that might save us some work.

mroman42 commented 9 years ago

Maybe something similar to:

dfa
alpha: [a,b,c]
states: [A,B,C]
transitions:
 - A: {a:A, b:B, c:B}
 - B: {a:B, c:C}
 - C: {a:C}

But I don't see how we can extend this format to NFA automata.

mx-psi commented 9 years ago

I don't know if this is possible but we could write it like this:

nfa
alpha: [a,b,c]
states: [A,B,C]
transitions:
 - A: {a:[A,B], b:[B], c:[B,C]}
 - B: {a:[A,B,C], c:[]}
 - C: {a:[C]}