Parsing automata in Haskell (small project)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

23 lines
688 B

import Text.Parsec.String
import Text.Parsec.Combinator
import Text.Parsec.Prim
import Text.Parsec.Token
import Text.Parsec.Language
import Control.Applicative
import Data.Functor.Identity
import Data.Functor.Compose
import Data.Functor.Constant
import Data.Functor.Product
import Data.Vector
type WithOutput o = Product Identity (Constant o)
data FSM t s i = FSM (s -> i -> t s)
type DeterministicFSM s i o = FSM (WithOutput o) s i
type PartialFSM s i o = FSM (Compose Maybe (WithOutput o)) s i
type NondeterministicFSM s i o = FSM (Compose [] (WithOutput o)) s i
-- createMachine :: Vector (Vector (t Int)) -> FSM t Int Int
createMachine v = FSM (\s i -> v ! s ! i)
main = print 10