|
| Language.ContextFree.LR_0 | | Portability | portable | | Stability | experimental | | Maintainer | Joćo Saraiva - jas@di.uminho.pt |
|
|
|
|
|
| Description |
| Representing Grammars as Finite Automata, i.e., as LR(0) Automata
|
|
| Synopsis |
|
|
|
| Documentation |
|
| type Item sy = ([sy], Int) |
To represent grammars as LR(0) automata, the produtions are defined as
'LR(0) items' which are used to define the automata states.
A LR(0) item is a production with a dot in its right-hand side: it indicates
how much of a production has been seen at a given point in the parsing process. To model LR(0) items we introduce the Item data type |
|
| is_reducing_it :: Item sy -> Bool |
| When the dot is after the last symbol of the production, the item is called a reducing item.
(the production's RHS can be reduced to its left-had side) |
|
| reducing_its :: [Item sy] -> [Item sy] |
|
| after_dot :: Item sy -> [sy] |
| Computes the production symbols after the dot. |
|
| pr_of_it :: Item sy -> [sy] |
| Prodution of a given Item |
|
| expand_cfg :: Cfg t nt -> Cfg t nt |
|
| elr_0_tt :: (Ord t, Ord nt) => Cfg t nt -> CT (Item (Symb t nt)) |
|
| cfg2LR_0Ndfa :: (Eq t, Eq nt) => Cfg t nt -> Ndfa (Item (Symb t nt)) (Symb t nt) |
|
| cfg2LR_0Dfa :: (Ord t, Ord nt) => Cfg t nt -> Dfa [Item (Symb t nt)] (Symb t nt) |
|
| ecfg2LR_0Dfa :: (Ord t, Ord nt) => Cfg t nt -> Dfa [Item (Symb t nt)] (Symb t nt) |
|
| lr_0_tt :: (Ord t, Ord nt) => Cfg t nt -> CT (Item (Symb t nt)) |
|
| Produced by Haddock version 0.6 |