summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <unknown>2004-09-19 20:27:38 +0000
committeraarne <unknown>2004-09-19 20:27:38 +0000
commit0e21dcbf543f9a0367e69abd7f5f19b7852911e3 (patch)
tree17f439f9732ea405f1325b81d51c65d8ec37b433
parentdf4cbb482f0546b884eb210d825c794d14f82712 (diff)
Imper
-rw-r--r--grammars/prelude/Prelude.gf2
-rw-r--r--src/GF/CF/PrLBNF.hs12
-rw-r--r--src/GF/UseGrammar/Custom.hs1
3 files changed, 14 insertions, 1 deletions
diff --git a/grammars/prelude/Prelude.gf b/grammars/prelude/Prelude.gf
index 385a734ec..d124d7df6 100644
--- a/grammars/prelude/Prelude.gf
+++ b/grammars/prelude/Prelude.gf
@@ -29,6 +29,8 @@ oper
postfixSS : Str -> SS -> SS = \f,x -> ss (x.s ++ f) ;
embedSS : Str -> Str -> SS -> SS = \f,g,x -> ss (f ++ x.s ++ g) ;
+ id : (A : Type) -> A -> A ;
+
-- discontinuous
SD2 = {s1,s2 : Str} ;
sd2 : (_,_ : Str) -> SD2 = \x,y -> {s1 = x ; s2 = y} ;
diff --git a/src/GF/CF/PrLBNF.hs b/src/GF/CF/PrLBNF.hs
index 345863456..59067c39b 100644
--- a/src/GF/CF/PrLBNF.hs
+++ b/src/GF/CF/PrLBNF.hs
@@ -1,4 +1,4 @@
-module PrLBNF (prLBNF) where
+module PrLBNF (prLBNF,prBNF) where
import CF
import CFIdent
@@ -16,6 +16,16 @@ import Char
prLBNF :: CF -> String
prLBNF = unlines . (map prCFRule) . rulesOfCF -- hiding the literal recogn function
+-- a hack to hide the LBNF details
+prBNF :: CF -> String
+prBNF = unlines . (map (unwords . unLBNF . drop 1 . words . prCFRule)) . rulesOfCF
+ where
+ unLBNF r = case r of
+ "---":ts -> ts
+ ";":"---":ts -> ts
+ c:ts -> c : unLBNF ts
+ _ -> r
+
prCFRule :: CFRule -> String
prCFRule (fun,(cat,its)) =
prCFFun fun ++ "." +++ prCFCat True cat +++ "::=" +++ --- err in cat -> in syntax
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs
index 229b94fc7..9587038be 100644
--- a/src/GF/UseGrammar/Custom.hs
+++ b/src/GF/UseGrammar/Custom.hs
@@ -195,6 +195,7 @@ customGrammarPrinter =
name = cncId s
in gslPrinter name opts $ Cnv.cfg $ statePInfo s)
,(strCI "lbnf", prLBNF . stateCF)
+ ,(strCI "bnf", prBNF . stateCF)
,(strCI "haskell", grammar2haskell . stateGrammarST)
,(strCI "morpho", prMorpho . stateMorpho)
,(strCI "fullform",prFullForm . stateMorpho)