summaryrefslogtreecommitdiff
path: root/src/GF/Parsing/FCFG.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2006-06-01 11:19:47 +0000
committerkr.angelov <kr.angelov@gmail.com>2006-06-01 11:19:47 +0000
commite51eaed4fde9f2bee962ed43f5b9a8592e76a947 (patch)
tree8f1b3bb01373d052ecfa1f883a37ffe2d765977a /src/GF/Parsing/FCFG.hs
parent496f1fc8767f9d8ce1bb69b6e6460c2b7b7dd4b4 (diff)
add the FCFG parser
Diffstat (limited to 'src/GF/Parsing/FCFG.hs')
-rw-r--r--src/GF/Parsing/FCFG.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/GF/Parsing/FCFG.hs b/src/GF/Parsing/FCFG.hs
new file mode 100644
index 000000000..bec6eb777
--- /dev/null
+++ b/src/GF/Parsing/FCFG.hs
@@ -0,0 +1,38 @@
+----------------------------------------------------------------------
+-- |
+-- Maintainer : PL
+-- Stability : (stable)
+-- Portability : (portable)
+--
+-- > CVS $Date: 2005/05/11 10:28:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
+--
+-- MCFG parsing
+-----------------------------------------------------------------------------
+
+module GF.Parsing.FCFG
+ (parseFCF, module GF.Parsing.FCFG.PInfo) where
+
+import GF.Data.Operations (Err(..))
+
+import GF.Formalism.Utilities
+import GF.Formalism.GCFG
+import GF.Formalism.MCFG
+import GF.Parsing.FCFG.PInfo
+
+import qualified GF.Parsing.FCFG.Active as Active
+import GF.Infra.Print
+
+----------------------------------------------------------------------
+-- parsing
+
+parseFCF :: (Print c, Ord c, Print n, Ord n, Print t, Ord t) => String -> Err (FCFParser c n t)
+parseFCF prs | prs `elem` strategies = Ok $ parseFCF' prs
+ | otherwise = Bad $ "FCFG parsing strategy not defined: " ++ prs
+
+strategies = words "bottomup topdown"
+
+parseFCF' :: (Print c, Ord c, Print n, Ord n, Print t, Ord t) => String -> FCFParser c n t
+parseFCF' "bottomup" pinfo starts toks = Active.parse "b" pinfo starts toks
+parseFCF' "topdown" pinfo starts toks = Active.parse "t" pinfo starts toks