-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Disciplined Disciple Compiler top-level driver. -- -- This defines the top-level commands supported by the compiler, such as -- -make and -compile. @package ddc-driver @version 0.3.2.1 module DDC.Driver.Command.RewriteRules -- | Load and typecheck a module's rewrite rules, using exported and -- imported definitions from module cmdTryReadRules :: (Ord n, Show n, Pretty n, NFData n) => Fragment n err -> FilePath -> Module () n -> IO (NamedRewriteRules () n) module DDC.Driver.Command.Load -- | Load and typecheck a module. cmdReadModule :: (Ord n, Show n, Pretty n, NFData n) => Fragment n err -> FilePath -> IO (Maybe (Module (AnTEC SourcePos n) n)) cmdReadModule' :: (Ord n, Show n, Pretty n, NFData n) => Bool -> Fragment n err -> FilePath -> IO (Maybe (Module (AnTEC SourcePos n) n)) -- | Load and transform a module, printing the result to stdout. The -- current transform is set with the given string. cmdLoadFromFile :: Maybe String -> [FilePath] -> FilePath -> ErrorT String IO () -- | Load and transform a module, then print the result to stdout. cmdLoadFromString :: Language -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Check -- | Show the universe of some type. cmdUniverse :: Language -> Source -> String -> IO () -- | Given the type of some thing (up one level) show the universe of the -- thing. cmdUniverse1 :: Language -> Source -> String -> IO () -- | Given the kind of some thing (up two levels) show the universe of the -- thing. cmdUniverse2 :: Language -> Source -> String -> IO () -- | Given the sort of some thing (up three levels) show the universe of -- the thing. We can't type check naked sorts, so just parse them. cmdUniverse3 :: Language -> Source -> String -> IO () -- | Show the kind of a type. cmdShowKind :: Language -> Source -> String -> IO () -- | Check if two types are equivlant. cmdTypeEquiv :: Language -> Source -> String -> IO () -- | Show the type of a witness. cmdShowWType :: Language -> Source -> String -> IO () -- | Show the type of an expression. cmdShowType :: Language -> ShowTypeMode -> Source -> String -> IO () -- | Check expression and reconstruct type annotations on binders. cmdExpRecon :: Language -> Source -> String -> IO () -- | What components of the checked type to display. data ShowTypeMode ShowTypeAll :: ShowTypeMode ShowTypeValue :: ShowTypeMode ShowTypeEffect :: ShowTypeMode ShowTypeClosure :: ShowTypeMode -- | Parse and type-check a core module from a file. cmdCheckModuleFromFile :: (Ord n, Show n, Pretty n, Pretty (err (AnTEC SourcePos n))) => Fragment n err -> FilePath -> ErrorT String IO (Module (AnTEC SourcePos n) n) -- | Parse and type-check a core module from a string. cmdCheckModuleFromString :: (Ord n, Show n, Pretty n, Pretty (err (AnTEC SourcePos n))) => Fragment n err -> Source -> String -> ErrorT String IO (Module (AnTEC SourcePos n) n) -- | Parse a core type, and check its kind. cmdParseCheckType :: (Ord n, Show n, Pretty n) => Source -> Fragment n err -> String -> IO (Maybe (Type n, Kind n)) -- | Parse the given core expression, and return it, along with its type, -- effect and closure. -- -- If the expression had a parse error, undefined vars, or type error -- then print this to the console. -- -- We include a flag to override the language profile to allow partially -- applied primitives. Although a paticular evaluator (or backend) may -- not support partially applied primitives, we want to accept them if we -- are only loading an expression to check its type. cmdParseCheckExp :: (Ord n, Show n, Pretty n, Pretty (err (AnTEC SourcePos n))) => Fragment n err -> ModuleMap (AnTEC () n) n -> Bool -> Source -> String -> IO (Maybe (Exp (AnTEC SourcePos n) n)) instance Eq ShowTypeMode instance Show ShowTypeMode module DDC.Driver.Command.Ast -- | Parse, check, and pretty print a module's internal representation. cmdAstModule :: Language -> Source -> String -> IO () -- | Parse, check, and pretty print an expression's internal -- representation. cmdAstExp :: Language -> Source -> String -> IO () -- | Compiler stages. -- -- A compiler stage is a sequence of standard transformations. Each of -- the individual transformations are expressed as a pipeline from -- DDC.Build.Pipeline. The stages here run several pipelines each, -- and contain the code that can dump the intermediate program after each -- transformation. module DDC.Driver.Stage -- | Configuration for main compiler stages. data Config Config :: Bool -> Simplifier Int () Name -> Simplifier Int () Name -> ViaBackend -> Config -> Builder -> Bool -> Bool -> Maybe FilePath -> Maybe FilePath -> Bool -> Bool -> Bool -> Bool -> Config -- | Dump intermediate code. configDump :: Config -> Bool -- | Simplifiers to apply to intermediate code configSimplLite :: Config -> Simplifier Int () Name configSimplSalt :: Config -> Simplifier Int () Name -- | Backend code generator to use configViaBackend :: Config -> ViaBackend -- | Runtime system configuration configRuntime :: Config -> Config -- | The builder to use for the target architecture configBuilder :: Config -> Builder -- | Suppress imports in Core modules configSuppressCoreImports :: Config -> Bool -- | Suppress the #import prelude in C modules configSuppressHashImports :: Config -> Bool -- | Override output file configOutputFile :: Config -> Maybe FilePath -- | Override directory for build products configOutputDir :: Config -> Maybe FilePath -- | Keep intermediate .ddc.ll files configKeepLlvmFiles :: Config -> Bool -- | Keep intermediate .ddc.c files configKeepSeaFiles :: Config -> Bool -- | Keep intermediate .ddc.s files configKeepAsmFiles :: Config -> Bool -- | Avoid running the type checker where possible. When debugging program -- transformations, use this to get the invalid code rather than just the -- type error message. configTaintAvoidTypeChecks :: Config -> Bool data ViaBackend -- | Compile via the C backend. ViaC :: ViaBackend -- | Compile via the LLVM backend. ViaLLVM :: ViaBackend -- | Type check Core Flow. stageFlowLoad :: Config -> Source -> [PipeCore () Name] -> PipeText Name Error -- | Prepare a Core Flow module for lowering. stageFlowPrep :: Config -> Source -> [PipeCore () Name] -> PipeCore () Name -- | Lower a Core Flow module. Is needs to already be prepped, and have -- full type annotations. stageFlowLower :: Config -> Source -> [PipeCore () Name] -> PipeCore (AnTEC () Name) Name -- | Wind loop primops into tail recursive loops in a Core Flow module. stageFlowWind :: Config -> Source -> [PipeCore () Name] -> PipeCore (AnTEC () Name) Name -- | Type check Core Lite. stageLiteLoad :: Config -> Source -> [PipeCore () Name] -> PipeText Name Error -- | Optimise Core Lite. stageLiteOpt :: Config -> Source -> [PipeCore () Name] -> PipeCore () Name -- | Convert Core Lite to Core Salt. stageLiteToSalt :: Config -> Source -> [PipeCore () Name] -> PipeCore () Name -- | Optimise Core Salt. stageSaltOpt :: Config -> Source -> [PipeCore () Name] -> PipeCore () Name -- | Convert Core Salt to C code. stageSaltToC :: Config -> Source -> Sink -> PipeCore () Name -- | Convert Core Salt to LLVM. stageSaltToLLVM :: Config -> Source -> [PipeLlvm] -> PipeCore () Name -- | Compile Core Salt via C code. stageCompileSalt :: Config -> Source -> FilePath -> Bool -> PipeCore () Name -- | Compile LLVM code. stageCompileLLVM :: Config -> Source -> FilePath -> Bool -> PipeLlvm instance Show ViaBackend module DDC.Driver.Command.Flow.Lower -- | Lower a flow program to loop code. cmdFlowLower :: Config -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Flow.Prep -- | Prepare a Disciple Core Flow module for lowering. cmdFlowPrep :: Config -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Flow.Thread -- | Thread a state token through the given flow program. This can't be -- generic in the language fragment because we need to provide a specific -- type to use for the world token, and new types for the effectful -- combinators. cmdFlowThread :: Config -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Flow.Wind -- | Lower a flow program to loop code. cmdFlowWind :: Config -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Compile -- | Compile a source module into a .o file. cmdCompile :: Config -> FilePath -> ErrorT String IO () module DDC.Driver.Command.BaseBuild cmdBaseBuild :: Config -> ErrorT String IO () module DDC.Driver.Command.Make -- | Make a source module into an executable. cmdMake :: Config -> FilePath -> ErrorT String IO () module DDC.Driver.Command.Parse cmdParseModule :: Config -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.ToC -- | Parse, check, and convert a module to C. -- -- The output is printed to stdout. cmdToC :: Config -> Language -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.ToLlvm -- | Parse, check and convert a module to LLVM. -- -- The output is printed to stdout. cmdToLlvm :: Config -> Language -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.ToSalt -- | Parse, check, and fully evaluate an expression. -- -- The output is printed to stdout. cmdToSalt :: Config -> Language -> Source -> String -> ErrorT String IO () module DDC.Driver.Command.Flow.Concretize -- | Concretize rate variables to loop indices. cmdFlowConcretize :: Config -> Source -> String -> ErrorT String IO ()