From e51eaed4fde9f2bee962ed43f5b9a8592e76a947 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Thu, 1 Jun 2006 11:19:47 +0000 Subject: add the FCFG parser --- src/GF/Parsing/FCFG.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/GF/Parsing/FCFG.hs (limited to 'src/GF/Parsing/FCFG.hs') 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 -- cgit v1.2.3