diff options
| author | peb <unknown> | 2005-04-20 11:49:44 +0000 |
|---|---|---|
| committer | peb <unknown> | 2005-04-20 11:49:44 +0000 |
| commit | 78108f7817fbf3269bb75f278eb9a8540737873e (patch) | |
| tree | 6fc47a586e0d4eb223fc5b1bc3a25b1ef77762c8 /src/GF/Formalism/GCFG.hs | |
| parent | 5621344c73f75f6d5a89ec77c6a4b432f391b16d (diff) | |
"Committed_by_peb"
Diffstat (limited to 'src/GF/Formalism/GCFG.hs')
| -rw-r--r-- | src/GF/Formalism/GCFG.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/GF/Formalism/GCFG.hs b/src/GF/Formalism/GCFG.hs index 407b85bc5..32ba2cedb 100644 --- a/src/GF/Formalism/GCFG.hs +++ b/src/GF/Formalism/GCFG.hs @@ -4,17 +4,18 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/04/11 13:52:50 $ +-- > CVS $Date: 2005/04/20 12:49:44 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.1 $ +-- > CVS $Revision: 1.2 $ -- -- Basic GCFG formalism (derived from Pollard 1984) ----------------------------------------------------------------------------- -module GF.Formalism.GCFG - ( Grammar, Rule(..), Abstract(..), Concrete(..) - ) where +module GF.Formalism.GCFG where +import GF.Formalism.Utilities (SyntaxChart) +import GF.Data.Assoc (assocMap, accumAssoc) +import GF.Data.SortedList (nubsort, groupPairs) import GF.Infra.Print ---------------------------------------------------------------------- @@ -28,6 +29,10 @@ data Abstract cat name = Abs cat [cat] name data Concrete lin term = Cnc lin [lin] term deriving (Eq, Ord, Show) +abstract2chart :: (Ord n, Ord e) => [Abstract e n] -> SyntaxChart n e +abstract2chart rules = accumAssoc groupPairs $ + [ (e, (n, es)) | Abs e es n <- rules ] + ---------------------------------------------------------------------- instance (Print c, Print n, Print l, Print t) => Print (Rule n c l t) where |
