1
0
forked from GitHub/gf-core

documentation of commands; restriction options to generation

This commit is contained in:
aarne
2008-06-15 21:36:41 +00:00
parent 88a09c4b7e
commit 4be8e59c1c
2 changed files with 73 additions and 42 deletions

View File

@@ -68,6 +68,25 @@ functionsToCat pgf cat =
where
fs = lookMap [] cat $ catfuns $ abstract pgf
missingLins :: PGF -> CId -> [CId]
missingLins pgf lang = [c | c <- fs, not (hasl c)] where
fs = Map.keys $ funs $ abstract pgf
hasl = hasLin pgf lang
hasLin :: PGF -> CId -> CId -> Bool
hasLin pgf lang f = Map.member f $ lins $ lookConcr pgf lang
restrictPGF :: (CId -> Bool) -> PGF -> PGF
restrictPGF cond pgf = pgf {
abstract = abstr {
funs = restrict $ funs $ abstr,
cats = restrict $ cats $ abstr
}
} ---- restrict concrs also, might be needed
where
restrict = Map.filterWithKey (\c _ -> cond c)
abstr = abstract pgf
depth :: Exp -> Int
depth (EAbs _ t) = depth t
depth (EApp _ ts) = maximum (0:map depth ts) + 1