mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
tram using compiled resources
This commit is contained in:
@@ -30,6 +30,7 @@ import GF.Grammar.PrGrammar
|
||||
import GF.Canon.CMacros
|
||||
----import Values
|
||||
import GF.Grammar.MMacros
|
||||
import GF.Grammar.Macros (zIdent)
|
||||
import qualified GF.Infra.Modules as M
|
||||
import qualified GF.Canon.CanonToGrammar as CG
|
||||
|
||||
@@ -50,7 +51,7 @@ lookupCncInfo gr f@(CIQ m c) = do
|
||||
_ -> prtBad "not concrete module" m
|
||||
|
||||
lookupLin :: CanonGrammar -> CIdent -> Err Term
|
||||
lookupLin gr f = do
|
||||
lookupLin gr f = errIn "looking up linearization rule" $ do
|
||||
info <- lookupCncInfo gr f
|
||||
case info of
|
||||
CncFun _ _ t _ -> return t
|
||||
@@ -58,7 +59,9 @@ lookupLin gr f = do
|
||||
AnyInd _ n -> lookupLin gr $ redirectIdent n f
|
||||
|
||||
lookupLincat :: CanonGrammar -> CIdent -> Err CType
|
||||
lookupLincat gr f = do
|
||||
lookupLincat gr (CIQ _ c) | elem c [zIdent "String", zIdent "Int", zIdent "Float"] =
|
||||
return defLinType --- ad hoc; not needed? cf. Grammar.Lookup.lookupLincat
|
||||
lookupLincat gr f = errIn "looking up linearization type" $ do
|
||||
info <- lookupCncInfo gr f
|
||||
case info of
|
||||
CncCat t _ _ -> return t
|
||||
@@ -66,7 +69,7 @@ lookupLincat gr f = do
|
||||
_ -> prtBad "no lincat found for" f
|
||||
|
||||
lookupPrintname :: CanonGrammar -> CIdent -> Err Term
|
||||
lookupPrintname gr f = do
|
||||
lookupPrintname gr f = errIn "looking up printname" $ do
|
||||
info <- lookupCncInfo gr f
|
||||
case info of
|
||||
CncFun _ _ _ t -> return t
|
||||
|
||||
@@ -287,6 +287,7 @@ computeLType gr t = do
|
||||
Q (IC "Predef") (IC "Float") -> return ty ---- shouldn't be needed
|
||||
|
||||
Q m c | elem c [cPredef,cPredefAbs] -> return ty
|
||||
Q m c | elem c [zIdent "Int",zIdent "Float",zIdent "String"] -> return defLinType ----
|
||||
|
||||
Q m ident -> checkIn ("module" +++ prt m) $ do
|
||||
ty' <- checkErr (lookupResDef gr m ident)
|
||||
|
||||
@@ -34,7 +34,7 @@ import Data.List (nub)
|
||||
import Control.Monad
|
||||
|
||||
lookupResDef :: SourceGrammar -> Ident -> Ident -> Err Term
|
||||
lookupResDef gr = look True where
|
||||
lookupResDef gr m c = look True m c where
|
||||
look isTop m c = do
|
||||
mi <- lookupModule gr m
|
||||
case mi of
|
||||
|
||||
Reference in New Issue
Block a user