1
0
forked from GitHub/gf-core

made -fcfg default parser; added lexer textvars

This commit is contained in:
aarne
2006-06-20 08:38:44 +00:00
parent 658fd526b4
commit 0333ba894b
11 changed files with 71 additions and 40 deletions

View File

@@ -21,6 +21,7 @@ module GF.Grammar.LookAbs (GFCGrammar,
lookupRef,
refsForType,
funRulesOf,
hasHOAS,
allCatsOf,
allBindCatsOf,
funsForType,
@@ -130,6 +131,10 @@ funRulesOf gr =
mtype m == MTAbstract,
(f, C.AbsFun typ _) <- tree2list (jments m)]
-- testing for higher-order abstract syntax
hasHOAS :: GFCGrammar -> Bool
hasHOAS gr = any isHigherOrderType [t | (_,t) <- funRulesOf gr] where
allCatsOf :: GFCGrammar -> [(Cat,Context)]
allCatsOf gr =
[((i,c),cont) | (i, ModMod m) <- modules gr,

View File

@@ -136,6 +136,10 @@ isRecursiveType t = errVal False $ do
(cc,c) <- catSkeleton t -- thus recursivity on Cat level
return $ any (== c) cc
isHigherOrderType :: Type -> Bool
isHigherOrderType t = errVal True $ do -- pessimistic choice
co <- contextOfType t
return $ not $ null [x | (x,Prod _ _ _) <- co]
contextOfType :: Type -> Err Context
contextOfType typ = case typ of