UMinho Haskell Libraries (1.0)ContentsIndex
Language.ContextFree.SLR
Portability portable
Stability experimental
Maintainer Joćo Saraiva - jas@di.uminho.pt
Description
Construction of the SLR(1) Action Tables
Synopsis
data Action st pr
= Shift st
| Accept
| Reduce pr
| Error
slr_at :: (Ord t, Ord nt) => Cfg t nt -> AT [Item (Symb t nt)] [Symb t nt]
e_slr_at :: (Ord t, Ord nt) => Cfg t nt -> AT [Item (Symb t nt)] [Symb t nt]
st_follows_shifts :: (Eq t, Eq nt) => Cfg t nt -> CT (Item (Symb t nt)) -> [Item (Symb t nt)] -> ([Item (Symb t nt)], [(Item (Symb t nt), [Symb t nt])], [(Symb t nt, [Item (Symb t nt)])])
is_accepting_action :: (Eq t, Eq nt) => [Item (Symb t nt)] -> Bool
lookupAT :: (Eq t, Eq nt, Eq st) => [Symb t nt] -> AT st pr -> st -> Symb t nt -> Action st pr
Documentation
data Action st pr
Constructors
Shift st
Accept
Reduce pr
Error
Instances
(Eq pr, Eq st) => Eq (Action st pr)
(Show pr, Show st) => Show (Action st pr)
slr_at
:: (Ord t, Ord nt)
=> Cfg t ntGrammar
-> AT [Item (Symb t nt)] [Symb t nt]Action table
Computes the SLR(1) tables for a given grammar.
e_slr_at
:: (Ord t, Ord nt)
=> Cfg t ntGrammar
-> AT [Item (Symb t nt)] [Symb t nt]Action table
Computes the SLR(1) tables for a given expanded grammar.
st_follows_shifts
:: (Eq t, Eq nt)
=> Cfg t ntGrammar
-> CT (Item (Symb t nt))Goto Table induced by the grammar
-> [Item (Symb t nt)]State
-> ([Item (Symb t nt)], [(Item (Symb t nt), [Symb t nt])], [(Symb t nt, [Item (Symb t nt)])])Tripe (state,follows,moves)
For a given state, it accumulates the information needed to compure the SLR(1) action tables: - the follow sets of each reducing item - the destination state for each symbol
is_accepting_action :: (Eq t, Eq nt) => [Item (Symb t nt)] -> Bool
lookupAT :: (Eq t, Eq nt, Eq st) => [Symb t nt] -> AT st pr -> st -> Symb t nt -> Action st pr
Produced by Haddock version 0.6