mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
transfer added to GF command interpreter[D[
This commit is contained in:
@@ -369,11 +369,8 @@ applyTransfer opts gr trs (mm,f) t =
|
||||
Just m -> maybe empty id $ lookup m trs
|
||||
_ -> ifNull empty (snd . head) trs
|
||||
|
||||
-- these are missing
|
||||
trans = error "no transfer yet"
|
||||
----- core2exp . T.appTransfer tr . exp2core
|
||||
empty = error "emptyEnv"
|
||||
---- T.emptyEnv
|
||||
trans tr f = core2exp . T.evaluateExp tr . exp2core f
|
||||
empty = T.builtin
|
||||
|
||||
{-
|
||||
optTransfer :: Options -> StateGrammar -> G.Term -> G.Term
|
||||
|
||||
@@ -20,13 +20,45 @@ import GF.Grammar.AbsCompute
|
||||
import qualified GF.Canon.GFC as GFC
|
||||
import GF.Grammar.LookAbs
|
||||
import GF.Grammar.MMacros
|
||||
import GF.Grammar.Macros
|
||||
import GF.Grammar.PrGrammar
|
||||
import GF.Grammar.TypeCheck
|
||||
|
||||
import GF.Infra.Ident
|
||||
import GF.Data.Operations
|
||||
|
||||
import qualified Transfer.Core.Abs as T
|
||||
|
||||
import Control.Monad
|
||||
|
||||
|
||||
-- transfer is done in T.Exp - we only need these conversions.
|
||||
|
||||
exp2core :: Ident -> Exp -> T.Exp
|
||||
exp2core f = T.EApp (T.EVar (var f)) . exp2c where
|
||||
exp2c e = case e of
|
||||
App f a -> T.EApp (exp2c f) (exp2c a)
|
||||
Abs x b -> T.EAbs (T.PVVar (var x)) (exp2c b) ---- should be syntactic abstr
|
||||
Q _ c -> T.EVar (var c)
|
||||
QC _ c -> T.EVar (var c)
|
||||
K s -> T.EStr s
|
||||
EInt i -> T.EInt $ toInteger i
|
||||
Meta m -> T.EMeta (T.TMeta (prt m)) ---- which meta symbol?
|
||||
Vr x -> T.EVar (var x) ---- should be syntactic var
|
||||
|
||||
var x = T.CIdent $ prt x
|
||||
|
||||
core2exp :: T.Exp -> Exp
|
||||
core2exp e = case e of
|
||||
T.EApp f a -> App (core2exp f) (core2exp a)
|
||||
T.EAbs (T.PVVar x) b -> Abs (var x) (core2exp b) ---- only from syntactic abstr
|
||||
T.EVar c -> Vr (var c) -- GF annotates to Q or QC
|
||||
where
|
||||
var (T.CIdent x) = zIdent x
|
||||
|
||||
|
||||
|
||||
-- The following are now obsolete (30/11/2005)
|
||||
-- linearize, parse, etc, by transfer. AR 9/10/2003
|
||||
|
||||
doTransfer :: GFC.CanonGrammar -> Ident -> Tree -> Err Tree
|
||||
|
||||
Reference in New Issue
Block a user