mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 11:19:32 -06:00
rudimentary abstract syntax type checker and solver in PGF
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
module GF.Command.TreeOperations (
|
||||
treeOp,
|
||||
allTreeOps
|
||||
--typeCheck,
|
||||
) where
|
||||
|
||||
import GF.Compile.TypeCheck
|
||||
import PGF (compute,paraphrase)
|
||||
import PGF (compute,paraphrase,typecheck)
|
||||
|
||||
-- for conversions
|
||||
import PGF.Data
|
||||
@@ -29,12 +28,9 @@ allTreeOps pgf = [
|
||||
("smallest",("sort trees from smallest to largest, in number of nodes",
|
||||
smallest)),
|
||||
("typecheck",("type check and solve metavariables; reject if incorrect",
|
||||
id))
|
||||
concatMap (typecheck pgf)))
|
||||
]
|
||||
|
||||
typeCheck :: PGF -> Tree -> (Tree,(Bool,[String]))
|
||||
typeCheck pgf t = (t,(True,[]))
|
||||
|
||||
smallest :: [Tree] -> [Tree]
|
||||
smallest = sortBy (\t u -> compare (size t) (size u)) where
|
||||
size t = case t of
|
||||
|
||||
Reference in New Issue
Block a user