mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-09-23 10:46:01 -06:00
ditch the old typechecker completely
This commit is contained in:
@@ -20,7 +20,7 @@ import GF.Grammar.ShowTerm
|
|||||||
import GF.Grammar.Lookup (allOpers,allOpersTo)
|
import GF.Grammar.Lookup (allOpers,allOpersTo)
|
||||||
import GF.Compile.Rename(renameSourceTerm)
|
import GF.Compile.Rename(renameSourceTerm)
|
||||||
import GF.Compile.Compute.Concrete2(normalForm,normalFlatForm,Globals(..),stdPredef)
|
import GF.Compile.Compute.Concrete2(normalForm,normalFlatForm,Globals(..),stdPredef)
|
||||||
import GF.Compile.TypeCheck.ConcreteNew as TC(inferLType)
|
import GF.Compile.TypeCheck.Concrete as TC(inferLType)
|
||||||
|
|
||||||
import GF.Command.Abstract(Option(..),isOpt,listFlags,valueString,valStrOpts)
|
import GF.Command.Abstract(Option(..),isOpt,listFlags,valueString,valStrOpts)
|
||||||
import GF.Command.CommandInfo
|
import GF.Command.CommandInfo
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ import GF.Infra.Ident
|
|||||||
import GF.Infra.Option
|
import GF.Infra.Option
|
||||||
|
|
||||||
import GF.Compile.TypeCheck.Abstract
|
import GF.Compile.TypeCheck.Abstract
|
||||||
import GF.Compile.TypeCheck.Concrete(ppType)
|
import GF.Compile.TypeCheck.Concrete(checkLType,inferLType)
|
||||||
import GF.Compile.TypeCheck.ConcreteNew(checkLType,inferLType)
|
|
||||||
import GF.Compile.Compute.Concrete2(normalForm,Globals(..),stdPredef)
|
import GF.Compile.Compute.Concrete2(normalForm,Globals(..),stdPredef)
|
||||||
|
|
||||||
import GF.Grammar
|
import GF.Grammar
|
||||||
@@ -265,7 +264,7 @@ checkInfo opts cwd sgr sm (c,info) = checkInModule cwd (snd sm) NoLoc empty $ do
|
|||||||
checkUniq xss = case xss of
|
checkUniq xss = case xss of
|
||||||
x:y:xs
|
x:y:xs
|
||||||
| x == y -> checkError $ "ambiguous for type" <+>
|
| x == y -> checkError $ "ambiguous for type" <+>
|
||||||
ppType (mkFunType (tail x) (head x))
|
ppTerm Terse 0 (mkFunType (tail x) (head x))
|
||||||
| otherwise -> checkUniq $ y:xs
|
| otherwise -> checkUniq $ y:xs
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import GF.Compile.Compute.Concrete2
|
|||||||
, ppValue
|
, ppValue
|
||||||
)
|
)
|
||||||
import GF.Compile.Rename (renameSourceTerm)
|
import GF.Compile.Rename (renameSourceTerm)
|
||||||
import GF.Compile.TypeCheck.ConcreteNew (inferLType)
|
import GF.Compile.TypeCheck.Concrete (inferLType)
|
||||||
import GF.Data.ErrM (Err(..))
|
import GF.Data.ErrM (Err(..))
|
||||||
import GF.Data.Utilities (maybeAt, orLeft)
|
import GF.Data.Utilities (maybeAt, orLeft)
|
||||||
import GF.Grammar.Grammar
|
import GF.Grammar.Grammar
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,8 @@ import GF.Command.Abstract
|
|||||||
import GF.Command.Parse(readCommandLine,pCommand,readTransactionCommand)
|
import GF.Command.Parse(readCommandLine,pCommand,readTransactionCommand)
|
||||||
import GF.Compile.Rename(renameSourceTerm)
|
import GF.Compile.Rename(renameSourceTerm)
|
||||||
import GF.Compile.TypeCheck.Concrete(inferLType)
|
import GF.Compile.TypeCheck.Concrete(inferLType)
|
||||||
import GF.Compile.Compute.Concrete(normalForm,stdPredef,Globals(..))
|
import qualified GF.Compile.Compute.Concrete as O(normalForm,stdPredef,Globals(..))
|
||||||
|
import GF.Compile.Compute.Concrete2(stdPredef,Globals(..))
|
||||||
import GF.Compile.GeneratePMCFG(pmcfgForm,type2fields)
|
import GF.Compile.GeneratePMCFG(pmcfgForm,type2fields)
|
||||||
import GF.Data.Operations (Err(..))
|
import GF.Data.Operations (Err(..))
|
||||||
import GF.Data.Utilities(whenM,repeatM)
|
import GF.Data.Utilities(whenM,repeatM)
|
||||||
@@ -317,11 +318,12 @@ transactionCommand (CreateLin opts f mb_t is_alter) pgf mb_txnid = do
|
|||||||
compileLinTerm sgr mo f mb_t ty = do
|
compileLinTerm sgr mo f mb_t ty = do
|
||||||
(t,ty) <- case mb_t of
|
(t,ty) <- case mb_t of
|
||||||
Just t -> do t <- renameSourceTerm sgr mo (Typed t ty)
|
Just t -> do t <- renameSourceTerm sgr mo (Typed t ty)
|
||||||
(t,ty) <- inferLType sgr [] t
|
let g = Gl sgr (stdPredef g)
|
||||||
|
(t,ty) <- inferLType g t
|
||||||
return (t,ty)
|
return (t,ty)
|
||||||
Nothing -> case lookupResDef sgr (mo,identS f) of
|
Nothing -> case lookupResDef sgr (mo,identS f) of
|
||||||
Ok t -> do ty <- renameSourceTerm sgr mo ty
|
Ok t -> do ty <- renameSourceTerm sgr mo ty
|
||||||
ty <- normalForm (Gl sgr stdPredef) ty
|
ty <- O.normalForm (O.Gl sgr O.stdPredef) ty
|
||||||
return (t,ty)
|
return (t,ty)
|
||||||
Bad msg -> fail msg
|
Bad msg -> fail msg
|
||||||
let (ctxt,res_ty) = typeFormCnc ty
|
let (ctxt,res_ty) = typeFormCnc ty
|
||||||
@@ -344,7 +346,8 @@ transactionCommand (CreateLincat opts c mb_t) pgf mb_txnid = do
|
|||||||
compileLincatTerm sgr mo mb_t = do
|
compileLincatTerm sgr mo mb_t = do
|
||||||
t <- case mb_t of
|
t <- case mb_t of
|
||||||
Just t -> do t <- renameSourceTerm sgr mo t
|
Just t -> do t <- renameSourceTerm sgr mo t
|
||||||
(t,_) <- inferLType sgr [] t
|
let g = Gl sgr (stdPredef g)
|
||||||
|
(t,_) <- inferLType g t
|
||||||
return t
|
return t
|
||||||
Nothing -> case lookupResDef sgr (mo,identS c) of
|
Nothing -> case lookupResDef sgr (mo,identS c) of
|
||||||
Ok t -> return t
|
Ok t -> return t
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ module GF.Term (renameSourceTerm,
|
|||||||
|
|
||||||
import GF.Compile.Rename
|
import GF.Compile.Rename
|
||||||
import GF.Compile.Compute.Concrete
|
import GF.Compile.Compute.Concrete
|
||||||
import GF.Compile.TypeCheck.ConcreteNew
|
import GF.Compile.TypeCheck.Concrete
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ library
|
|||||||
GF.Compile.ToAPI
|
GF.Compile.ToAPI
|
||||||
GF.Compile.TypeCheck.Abstract
|
GF.Compile.TypeCheck.Abstract
|
||||||
GF.Compile.TypeCheck.Concrete
|
GF.Compile.TypeCheck.Concrete
|
||||||
GF.Compile.TypeCheck.ConcreteNew
|
|
||||||
GF.Compile.TypeCheck.TC
|
GF.Compile.TypeCheck.TC
|
||||||
GF.Compile.Update
|
GF.Compile.Update
|
||||||
GF.Data.BacktrackM
|
GF.Data.BacktrackM
|
||||||
|
|||||||
Reference in New Issue
Block a user