Started with unions.

This commit is contained in:
aarne
2004-02-27 07:43:52 +00:00
parent b32c3081a1
commit b790008b19
14 changed files with 1324 additions and 1182 deletions

View File

@@ -10,6 +10,7 @@ import Modules
import ReadFiles
import ShellState
import MkResource
import MkUnion
-- the main compiler passes
import GetGrammar
@@ -177,6 +178,9 @@ makeSourceModule opts env@(k,gr,can) mo@(i,mi) = case mi of
mos = modules gr
--- putp " type checking reused" $ ioeErr $ showCheckModule mos mo2
return $ (k,mo2)
MTUnion ty imps -> do
mo' <- ioeErr $ makeUnion gr i ty imps
compileSourceModule opts env mo'
_ -> compileSourceModule opts env mo
_ -> compileSourceModule opts env mo
where

View File

@@ -79,5 +79,5 @@ oldLexer = map change . L.tokens where
(L.PT p (L.TS s)) | elem s new -> (L.PT p (L.TV (init s ++ "Z")))
_ -> t
new = words $ "abstract concrete interface incomplete " ++
"instance out open resource reuse transfer with where"
"instance out open resource reuse transfer union with where"

19
src/GF/Compile/MkUnion.hs Normal file
View File

@@ -0,0 +1,19 @@
module MkUnion (makeUnion) where
import Grammar
import Ident
import Modules
import Macros
import PrGrammar
import Operations
import Monad
-- building union of modules
-- AR 21/8/2002 -- 22/6/2003 for GF with modules
makeUnion :: SourceGrammar -> Ident -> ModuleType Ident -> [(Ident,[Ident])] ->
Err SourceModule
makeUnion gr m ty imps = do
Bad "Sorry: unions not yet implemented"