turingMachine-1.0.0.0: An implementation of Turing Machine and Automaton

Copyright(c) Jorge Santiago Alvarez Cuadros 2016
LicenseGPL-3
Maintainersanjorgek@ciencias.unam.mx
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010
Extensions
  • TypeOperators
  • ExplicitNamespaces

Math.Model.Automaton.Stack

Description

Stack Automaton

Synopsis

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

type Key a = (Label a, (Maybe Symbol, Symbol)) Source #

A key for a delta.

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,"")]

nextDTuple :: Ord a => Delta a -> Key a -> (Label a, Wd) Source #

data StackA a Source #

Stack machine only needs a delta, an init state and an initial symbol.

This works for empty stack and final state acceptor

Constructors

Stack 

Instances

Eq a => Eq (StackA a) Source # 

Methods

(==) :: StackA a -> StackA a -> Bool #

(/=) :: StackA a -> StackA a -> Bool #

Show a => Show (StackA a) Source # 

Methods

showsPrec :: Int -> StackA a -> ShowS #

show :: StackA a -> String #

showList :: [StackA a] -> ShowS #

nextState :: Ord a => Delta a -> Wd -> State (Wd, Label a) (Label a) Source #