mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
opers in cnc
This commit is contained in:
@@ -218,7 +218,7 @@ checkCncInfo gr m (a,abs) (c,info) = do
|
|||||||
checkPrintname gr mpr
|
checkPrintname gr mpr
|
||||||
return (c,CncCat (Yes typ') mdef' mpr)
|
return (c,CncCat (Yes typ') mdef' mpr)
|
||||||
|
|
||||||
_ -> return (c,info)
|
_ -> checkResInfo gr (c,info)
|
||||||
|
|
||||||
where
|
where
|
||||||
env = gr
|
env = gr
|
||||||
@@ -740,6 +740,12 @@ checkEqLType env t u trm = do
|
|||||||
all (\ (l,a) ->
|
all (\ (l,a) ->
|
||||||
any (\ (k,b) -> alpha g a b && l == k) ts) rs
|
any (\ (k,b) -> alpha g a b && l == k) ts) rs
|
||||||
|
|
||||||
|
(ExtR r s, ExtR r' s') -> alpha g r r' && alpha g s s'
|
||||||
|
|
||||||
|
(ExtR r s, t) -> alpha g r t || alpha g s t
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- the following say that Ints n is a subset of Int and of Ints m
|
-- the following say that Ints n is a subset of Int and of Ints m
|
||||||
(App (Q (IC "Predef") (IC "Ints")) (EInt n),
|
(App (Q (IC "Predef") (IC "Ints")) (EInt n),
|
||||||
App (Q (IC "Predef") (IC "Ints")) (EInt m)) -> m >= n
|
App (Q (IC "Predef") (IC "Ints")) (EInt m)) -> m >= n
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ evalModule oopts ms mo@(name,mod) = case mod of
|
|||||||
MGrammar (mod' : _) <- foldM evalOp gr ids
|
MGrammar (mod' : _) <- foldM evalOp gr ids
|
||||||
return $ mod'
|
return $ mod'
|
||||||
MTConcrete a -> do
|
MTConcrete a -> do
|
||||||
js' <- mapMTree (evalCncInfo oopts gr0 name a) js
|
js' <- mapMTree (evalCncInfo oopts gr name a) js ---- <- gr0 6/12/2005
|
||||||
return $ (name, ModMod (Module mt st fs me ops js'))
|
return $ (name, ModMod (Module mt st fs me ops js'))
|
||||||
|
|
||||||
_ -> return $ (name,mod)
|
_ -> return $ (name,mod)
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ transCncDef x = case x of
|
|||||||
let defs2 = [(f, termInPattern t) | (f,(_,Yes t)) <- defs']
|
let defs2 = [(f, termInPattern t) | (f,(_,Yes t)) <- defs']
|
||||||
returnl [(f, G.CncFun Nothing (yes t) nope) | (f,t) <- defs2]
|
returnl [(f, G.CncFun Nothing (yes t) nope) | (f,t) <- defs2]
|
||||||
|
|
||||||
_ -> Bad $ "illegal definition in concrete syntax:" ++++ printTree x
|
_ -> errIn ("illegal definition in concrete syntax:") $ transResDef x
|
||||||
|
|
||||||
transPrintDef :: PrintDef -> Err [(Ident,G.Term)]
|
transPrintDef :: PrintDef -> Err [(Ident,G.Term)]
|
||||||
transPrintDef x = case x of
|
transPrintDef x = case x of
|
||||||
|
|||||||
@@ -1,18 +1,41 @@
|
|||||||
concrete English of Abstract = {
|
concrete English of Abstract = {
|
||||||
|
|
||||||
pattern
|
lincat
|
||||||
Pred np vp = np ++ vp ;
|
VP = {s : Num => Str} ;
|
||||||
ConjS c A B = A ++ c ++ B ;
|
NP, Conj = {s : Str ; n : Num} ;
|
||||||
ConjVP c A B = A ++ c ++ B ;
|
|
||||||
ConjNP c A B = A ++ c ++ B ;
|
lin
|
||||||
|
Pred np vp = ss (np.s ++ vp.s ! np.n) ;
|
||||||
John = "John" ;
|
ConjS c A B = ss (A.s ++ c.s ++ B.s) ;
|
||||||
Mary = "Mary" ;
|
ConjVP c A B = {s = \\n => A.s ! n ++ c.s ++ B.s ! n} ;
|
||||||
Bill = "Bill" ;
|
ConjNP c A B = {s = A.s ++ c.s ++ B.s ; n = c.n} ;
|
||||||
Walk = "walks" ;
|
|
||||||
Run = "runs" ;
|
John = pn "John" ;
|
||||||
Swim = "swims" ;
|
Mary = pn "Mary" ;
|
||||||
|
Bill = pn "Bill" ;
|
||||||
|
Walk = vp "walk" ;
|
||||||
|
Run = vp "run" ;
|
||||||
|
Swim = vp "swim" ;
|
||||||
|
|
||||||
|
And = {s = "and" ; n = Pl} ;
|
||||||
|
Or = pn "or" ;
|
||||||
|
|
||||||
|
param
|
||||||
|
Num = Sg | Pl ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
vp : Str -> {s : Num => Str} = \run -> {
|
||||||
|
s = table {
|
||||||
|
Sg => run + "s" ;
|
||||||
|
Pl => run
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pn : Str -> {s : Str ; n : Num} = \bob -> {
|
||||||
|
s = bob ;
|
||||||
|
n = Sg
|
||||||
|
} ;
|
||||||
|
|
||||||
|
ss : Str -> {s : Str} = \s -> {s = s} ;
|
||||||
|
|
||||||
And = "and" ;
|
|
||||||
Or = "or" ;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user