progs/nfa.scala
changeset 491 d5776c6018f0
parent 490 4fee50f38305
child 586 451a95e1bc25
equal deleted inserted replaced
490:4fee50f38305 491:d5776c6018f0
     1 // NFAs in Scala using partial functions (returning
     1 // NFAs in Scala using partial functions (returning
     2 // sets of states)
     2 // sets of states)
     3 import scala.util.Try
     3 //
     4 
     4 // needs :load dfa.scala   for states
     5 // states class
       
     6 abstract class State
       
     7 case object Q0 extends State
       
     8 case object Q1 extends State
       
     9 case object Q2 extends State
       
    10 case object Q3 extends State
       
    11 case object Q4 extends State
       
    12 
       
    13 
     5 
    14 
     6 
    15 // type abbreviation for partial functions
     7 // type abbreviation for partial functions
    16 type :=>[A, B] = PartialFunction[A, B]
     8 type :=>[A, B] = PartialFunction[A, B]
    17 
     9