Copyright | (c) Jorge Santiago Alvarez Cuadros 2016 |
---|---|
License | GPL-3 |
Maintainer | sanjorgek@ciencias.unam.mx |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Extensions |
|
Stack Automaton
- type Delta a = (:->:) a (Maybe Symbol, Symbol) Wd
- type Key a = (Label a, (Maybe Symbol, Symbol))
- liftDelta :: Ord a => [(a, Wd, Symbol, a, Wd)] -> Delta a
- nextDTuple :: Ord a => Delta a -> Key a -> (Label a, Wd)
- data StackA a = Stack {
- getDelta :: Delta a
- getInitState :: Label a
- getFinal :: Final a
- getInitSymbol :: Symbol
- nextState :: Ord a => Delta a -> Wd -> State (Wd, Label a) (Label a)
Documentation
type Delta a = (:->:) a (Maybe Symbol, Symbol) Wd Source #
Delta for stack machine, takes a state, a symbol in string input or not and a symbol in stack head and returns next state and update stack
liftDelta :: Ord a => [(a, Wd, Symbol, a, Wd)] -> Delta a Source #
Takes a list of tuples and lift a Delta
>>>
let delta = liftD [(0,"(",'Z',0,"IZ"),(0,"",'Z',0,""),(0,"(",'I',0,"II"),(0,")",'I',0,"")]
Stack machine only needs a delta, an init state and an initial symbol.
This works for empty stack and final state acceptor
Stack | |
|