Commit 2d3ec775 authored by Camil Staps's avatar Camil Staps 🚀

Remove core system

parent d10dc34c
[submodule "CleanTypeUnifier"]
path = CleanTypeUnifier
url = https://github.com/clean-cloogle/CleanTypeUnifier
[submodule "CleanPrettyPrint"]
path = CleanPrettyPrint
url = https://github.com/clean-cloogle/CleanPrettyPrint.git
[submodule "clean-platform"]
path = clean-platform
url = https://gitlab.science.ru.nl/clean-and-itasks/clean-platform.git
definition module Cache
from StdOverloaded import class toString
from Data.Maybe import :: Maybe
from Text.JSON import generic JSONEncode, generic JSONDecode, :: JSONNode
:: CacheType = Brief | LongTerm
:: CacheKey :== String
cacheKey :: (a -> CacheKey) | toString a
// Check if for the hash of the argument a JSON file exists of type b
readCache :: !a *World -> (Maybe b, !*World) | toString a & JSONDecode{|*|} b
// Write for the hash of a a JSON file of type b
writeCache :: CacheType !a !b -> *World -> *World | toString a & JSONEncode{|*|} b
implementation module Cache
import StdFunc
import StdTuple
from Data.Func import $
import Control.Monad
import Control.Applicative
import Data.Functor
import Crypto.Hash.MD5
import Text.JSON
import Data.Error
import StdFile
import System.FilePath
import System.File
import Data.Tuple
cache_types :== [Brief, LongTerm]
cache_dir :: CacheType -> FilePath
cache_dir LongTerm = "./cache/lt"
cache_dir Brief = "./cache/brief"
cacheKey :: (a -> CacheKey) | toString a
cacheKey = md5 o toString
toCacheFile :: CacheType -> a -> FilePath | toString a
toCacheFile t = (</>) (cache_dir t) o cacheKey
readCache :: !a *World -> (Maybe b, !*World) | toString a & JSONDecode{|*|} b
readCache k w
# (files,w) = seqList [appFst error2mb o readFile (toCacheFile t k) \\ t <- cache_types] w
= (join $ fromJSON <$> fromString <$> foldl (<|>) empty files, w)
writeCache :: CacheType !a !b -> *World -> *World | toString a & JSONEncode{|*|} b
writeCache t k v = snd o writeFile (toCacheFile t k) (toString $ toJSON v)
Subproject commit 833846d37ef22b9c24f9bf4d6adb80ccf6979581
Subproject commit 1afa69c23f7dbe2c9646ddf7daa667d1a2f8c38c
This diff is collapsed.
BIN:=CloogleServer builddb
DB=types.json
MAN:=builddb.1 # Others don't have --help/--version # $(addsuffix .1,$(BIN))
CLM:=clm
CLMFLAGS:=-dynamics -h 200M -nr -nt\
-I $$CLEAN_HOME/lib/ArgEnv\
-I $$CLEAN_HOME/lib/Dynamics\
-I $$CLEAN_HOME/lib/Generics\
-I $$CLEAN_HOME/lib/TCPIP\
-I clean-platform/src/libraries/OS-Independent\
-I clean-platform/src/libraries/OS-Independent/Deprecated/StdLib\
-I clean-platform/src/libraries/OS-Linux-64\
-I clean-platform/src/libraries/OS-Linux\
-I clean-platform/src/libraries/OS-Posix\
-I CleanTypeUnifier\
-I CleanPrettyPrint\
-I clean-compiler/frontend\
-I clean-compiler/backend\
-I clean-compiler/main\
-I clean-compiler/main/Unix
.SECONDARY: $(PRJ)
.PHONY: all clean distclean
all: $(BIN) $(DB)
clean-compiler:
svn checkout -r 2746 https://svn.cs.ru.nl/repos/clean-compiler/branches/itask/ clean-compiler
$(MAKE) -j -C clean-compiler/main/Unix
$(MAKE) -j -C clean-compiler/backendC/CleanCompilerSources -f Makefile.linux64
ln -s ../../backendC/CleanCompilerSources/backend.a clean-compiler/backend/Clean\ System\ Files/backend_library
man: $(MAN)
%.1: %
help2man -N ./$< > $@
$(BIN): clean-compiler .FORCE
$(CLM) $(CLMFLAGS) $@ -o $@
$(DB): builddb
./$< > $(DB)
clean:
$(RM) -r 'Clean System Files' $(BIN) $(MAN) $(DB)
distclean: clean
$(RM) -r clean-compiler
.FORCE:
definition module TypeDB
// Standard libraries
from StdOverloaded import class <, class zero
from StdClass import class Ord
from Data.Map import ::Map
from Data.Maybe import ::Maybe
from GenEq import generic gEq
// CleanTypeUnifier
from Type import ::Type, ::TypeVar, ::TVAssignment, ::TypeDef, class print(..),
::ClassContext, ::ClassRestriction, ::ClassOrGeneric, ::Priority
:: TypeDB
:: TypeExtras = { te_priority :: Maybe Priority
, te_isconstructor :: Bool
, te_isrecordfield :: Bool
, te_generic_vars :: Maybe [TypeVar]
, te_representation :: Maybe String
}
:: ExtendedType = ET Type TypeExtras
:: Macro = { macro_as_string :: String
, macro_extras :: TypeExtras
}
:: Location = Location Library Module LineNr LineNr Name
| Builtin Name
:: ModuleInfo = { is_core :: Bool }
:: Name :== String
:: Library :== String
:: Module :== String
:: Class :== String
:: LineNr :== Maybe Int
instance zero TypeDB
instance zero TypeExtras
instance zero ModuleInfo
instance print (Name, ExtendedType)
getName :: Location -> Name
isBuiltin :: Location -> Bool
functionCount :: TypeDB -> Int
macroCount :: TypeDB -> Int
classCount :: TypeDB -> Int
instanceCount :: TypeDB -> Int
typeCount :: TypeDB -> Int
deriveCount :: TypeDB -> Int
moduleCount :: TypeDB -> Int
filterLocations :: (Location -> Bool) TypeDB -> TypeDB
getFunction :: Location TypeDB -> Maybe ExtendedType
putFunction :: Location ExtendedType TypeDB -> TypeDB
putFunctions :: [(Location, ExtendedType)] TypeDB -> TypeDB
findFunction :: Name TypeDB -> [(Location, ExtendedType)]
findFunction` :: (Location ExtendedType -> Bool) TypeDB
-> [(Location, ExtendedType)]
findFunction`` :: [(Location ExtendedType -> Bool)] TypeDB
-> [(Location, ExtendedType)]
getMacro :: Location TypeDB -> Maybe Macro
putMacro :: Location Macro TypeDB -> TypeDB
putMacros :: [(Location, Macro)] TypeDB -> TypeDB
findMacro` :: (Location Macro -> Bool) TypeDB -> [(Location, Macro)]
findMacro`` :: [(Location Macro -> Bool)] TypeDB -> [(Location, Macro)]
getInstances :: Class TypeDB -> [([(Type,String)], [Location])]
putInstance :: Class [(Type,String)] Location TypeDB -> TypeDB
putInstances :: [(Class, [(Type,String)], Location)] TypeDB -> TypeDB
getClass :: Location TypeDB -> Maybe ([TypeVar],ClassContext,[(Name,ExtendedType)])
putClass :: Location [TypeVar] ClassContext [(Name,ExtendedType)] TypeDB -> TypeDB
putClasses :: [(Location, [TypeVar], ClassContext, [(Name,ExtendedType)])] TypeDB -> TypeDB
findClass :: Class TypeDB -> [(Location, [TypeVar], ClassContext, [(Name, ExtendedType)])]
findClass` :: (Location [TypeVar] ClassContext [(Name,ExtendedType)] -> Bool) TypeDB
-> [(Location, [TypeVar], ClassContext, [(Name, ExtendedType)])]
findClass`` :: [(Location [TypeVar] ClassContext [(Name,ExtendedType)] -> Bool)] TypeDB
-> [(Location, [TypeVar], ClassContext, [(Name, ExtendedType)])]
findClassMembers` :: (Location [TypeVar] ClassContext Name ExtendedType -> Bool) TypeDB
-> [(Location, [TypeVar], ClassContext, Name, ExtendedType)]
findClassMembers`` :: [Location [TypeVar] ClassContext Name ExtendedType -> Bool]
TypeDB -> [(Location, [TypeVar], ClassContext, Name, ExtendedType)]
getType :: Location TypeDB -> Maybe TypeDef
putType :: Location TypeDef TypeDB -> TypeDB
putTypes :: [(Location, TypeDef)] TypeDB -> TypeDB
findType :: Name TypeDB -> [(Location, TypeDef)]
findType` :: (Location TypeDef -> Bool) TypeDB -> [(Location, TypeDef)]
findType`` :: [(Location TypeDef -> Bool)] TypeDB -> [(Location, TypeDef)]
allTypes :: (TypeDB -> [TypeDef])
getDerivations :: Name TypeDB -> [(Type, String, [Location])]
putDerivation :: Name Type String Location TypeDB -> TypeDB
putDerivations :: Name [(Type, String, Location)] TypeDB -> TypeDB
putDerivationss :: [(Name, [(Type, String, Location)])] TypeDB -> TypeDB
getModule :: Library Module TypeDB -> Maybe ModuleInfo
putModule :: Library Module ModuleInfo TypeDB -> TypeDB
findModule` :: (Library Module ModuleInfo -> Bool) TypeDB -> [(Library, Module, ModuleInfo)]
searchExact :: Type TypeDB -> [(Location, ExtendedType)]
getTypeInstances :: Name TypeDB -> [(Class, [(Type,String)], [Location])]
getTypeDerivations :: Name TypeDB -> [(Name, [Location])]
newDb :: TypeDB
openDb :: *File -> *(Maybe TypeDB, *File)
saveDb :: !TypeDB !*File -> *File
This diff is collapsed.
This diff is collapsed.
Subproject commit 4f8beddaeb27ae87485aa54271b10da39e0c80fc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment