mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
change the PGF.Data.Exp type
This commit is contained in:
@@ -26,25 +26,21 @@ realize trm = case trm of
|
||||
_ -> "ERROR " ++ show trm ---- debug
|
||||
|
||||
linExp :: GFCC -> CId -> Exp -> Term
|
||||
linExp mcfg lang tree@(DTr xs at trees) =
|
||||
addB $ case at of
|
||||
AC fun -> comp (map lin trees) $ look fun
|
||||
AS s -> R [kks (show s)] -- quoted
|
||||
AI i -> R [kks (show i)]
|
||||
--- [C lst, kks (show i), C size] where
|
||||
--- lst = mod (fromInteger i) 10 ; size = if i < 10 then 0 else 1
|
||||
AF d -> R [kks (show d)]
|
||||
AV x -> TM (prCId x)
|
||||
AM i -> TM (show i)
|
||||
where
|
||||
lin = linExp mcfg lang
|
||||
comp = compute mcfg lang
|
||||
look = lookLin mcfg lang
|
||||
addB t
|
||||
| Data.List.null xs = t
|
||||
| otherwise = case t of
|
||||
R ts -> R $ ts ++ (Data.List.map (kks . prCId) xs)
|
||||
TM s -> R $ t : (Data.List.map (kks . prCId) xs)
|
||||
linExp gfcc lang = lin
|
||||
where
|
||||
lin (EAbs xs e ) = case lin e of
|
||||
R ts -> R $ ts ++ (Data.List.map (kks . prCId) xs)
|
||||
TM s -> R $ (TM s) : (Data.List.map (kks . prCId) xs)
|
||||
lin (EApp fun es) = comp (map lin es) $ look fun
|
||||
lin (EStr s ) = R [kks (show s)] -- quoted
|
||||
lin (EInt i ) = R [kks (show i)]
|
||||
lin (EFloat d ) = R [kks (show d)]
|
||||
lin (EVar x ) = TM (prCId x)
|
||||
lin (EMeta i ) = TM (show i)
|
||||
|
||||
comp = compute gfcc lang
|
||||
look = lookLin gfcc lang
|
||||
|
||||
|
||||
compute :: GFCC -> CId -> [Term] -> Term -> Term
|
||||
compute mcfg lang args = comp where
|
||||
|
||||
Reference in New Issue
Block a user