summaryrefslogtreecommitdiff
path: root/src/GF/Formalism
diff options
context:
space:
mode:
authorkr_angelov <kr_angelov@gmail.com>2006-12-28 16:45:57 +0000
committerkr_angelov <kr_angelov@gmail.com>2006-12-28 16:45:57 +0000
commit3f183ce821b3f0188dbe61738fb9b63c6423f655 (patch)
treeb532f63fc0cacd035d8e8fde4ffe11dd3df158c0 /src/GF/Formalism
parent041c00abf3bfbbc770d52b23f9e27598f25f1f63 (diff)
GFCC to FCFG conversion
Diffstat (limited to 'src/GF/Formalism')
-rw-r--r--src/GF/Formalism/FCFG.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/GF/Formalism/FCFG.hs b/src/GF/Formalism/FCFG.hs
index a4923038e..2be442a29 100644
--- a/src/GF/Formalism/FCFG.hs
+++ b/src/GF/Formalism/FCFG.hs
@@ -30,13 +30,13 @@ data FSymbol cat tok
| FSymTok tok
type FCFGrammar cat name tok = [FCFRule cat name tok]
-data FCFRule cat name tok = FRule (Abstract cat name) (Array FLabel (Array FPointPos (FSymbol cat tok)))
+data FCFRule cat name tok = FRule name [cat] cat (Array FLabel (Array FPointPos (FSymbol cat tok)))
------------------------------------------------------------
-- pretty-printing
instance (Print c, Print t) => Print (FSymbol c t) where
- prt (FSymCat c l n) = prt c ++ "[" ++ prt n ++ "," ++ prt l ++ "]"
+ prt (FSymCat c l n) = "($" ++ prt n ++ "!" ++ prt l ++ ")"
prt (FSymTok t) = simpleShow (prt t)
where simpleShow str = "\"" ++ concatMap mkEsc str ++ "\""
mkEsc '\\' = "\\\\"
@@ -47,5 +47,6 @@ instance (Print c, Print t) => Print (FSymbol c t) where
prtList = prtSep " "
instance (Print c, Print n, Print t) => Print (FCFRule n c t) where
- prt (FRule abs lins) = prt abs ++ " := \n" ++ prtSep "\n" [" | "++prtSep " " [prt sym | (_,sym) <- assocs syms] | (_,syms) <- assocs lins]
+ prt (FRule name args res lins) = prt name ++ " : " ++ (if null args then "" else prtSep " " args ++ " -> ") ++ prt res ++
+ " =\n [" ++ prtSep "\n " ["("++prtSep " " [prt sym | (_,sym) <- assocs syms]++")" | (_,syms) <- assocs lins]++"]"
prtList = prtSep "\n"