forked from GitHub/gf-core
Imper
This commit is contained in:
@@ -29,6 +29,8 @@ oper
|
|||||||
postfixSS : Str -> SS -> SS = \f,x -> ss (x.s ++ f) ;
|
postfixSS : Str -> SS -> SS = \f,x -> ss (x.s ++ f) ;
|
||||||
embedSS : Str -> Str -> SS -> SS = \f,g,x -> ss (f ++ x.s ++ g) ;
|
embedSS : Str -> Str -> SS -> SS = \f,g,x -> ss (f ++ x.s ++ g) ;
|
||||||
|
|
||||||
|
id : (A : Type) -> A -> A ;
|
||||||
|
|
||||||
-- discontinuous
|
-- discontinuous
|
||||||
SD2 = {s1,s2 : Str} ;
|
SD2 = {s1,s2 : Str} ;
|
||||||
sd2 : (_,_ : Str) -> SD2 = \x,y -> {s1 = x ; s2 = y} ;
|
sd2 : (_,_ : Str) -> SD2 = \x,y -> {s1 = x ; s2 = y} ;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module PrLBNF (prLBNF) where
|
module PrLBNF (prLBNF,prBNF) where
|
||||||
|
|
||||||
import CF
|
import CF
|
||||||
import CFIdent
|
import CFIdent
|
||||||
@@ -16,6 +16,16 @@ import Char
|
|||||||
prLBNF :: CF -> String
|
prLBNF :: CF -> String
|
||||||
prLBNF = unlines . (map prCFRule) . rulesOfCF -- hiding the literal recogn function
|
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 :: CFRule -> String
|
||||||
prCFRule (fun,(cat,its)) =
|
prCFRule (fun,(cat,its)) =
|
||||||
prCFFun fun ++ "." +++ prCFCat True cat +++ "::=" +++ --- err in cat -> in syntax
|
prCFFun fun ++ "." +++ prCFCat True cat +++ "::=" +++ --- err in cat -> in syntax
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ customGrammarPrinter =
|
|||||||
name = cncId s
|
name = cncId s
|
||||||
in gslPrinter name opts $ Cnv.cfg $ statePInfo s)
|
in gslPrinter name opts $ Cnv.cfg $ statePInfo s)
|
||||||
,(strCI "lbnf", prLBNF . stateCF)
|
,(strCI "lbnf", prLBNF . stateCF)
|
||||||
|
,(strCI "bnf", prBNF . stateCF)
|
||||||
,(strCI "haskell", grammar2haskell . stateGrammarST)
|
,(strCI "haskell", grammar2haskell . stateGrammarST)
|
||||||
,(strCI "morpho", prMorpho . stateMorpho)
|
,(strCI "morpho", prMorpho . stateMorpho)
|
||||||
,(strCI "fullform",prFullForm . stateMorpho)
|
,(strCI "fullform",prFullForm . stateMorpho)
|
||||||
|
|||||||
Reference in New Issue
Block a user