optimusprime (empty) → 0.0.1.20091113
raw patch · 4 files changed
+98/−0 lines, 4 filesdep +basedep +cmdargsdep +containerssetup-changed
Dependencies added: base, cmdargs, containers, fgl, flite, graphviz, haskell98, mtl, parsec, uniplate, wl-pprint
Files
- LICENSE +26/−0
- OptimusPrime.hs +47/−0
- Setup.hs +3/−0
- optimusprime.cabal +22/−0
+ LICENSE view
@@ -0,0 +1,26 @@+Copyright (c) 2009, Jason Reich +All rights reserved. ++Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of University of York nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.
+ OptimusPrime.hs view
@@ -0,0 +1,47 @@+{-# LANGUAGE DeriveDataTypeable #-}++import System+import System.IO+import Flite.Identify+import Flite.Parsec.Parse+import Optimus.CallGraph+import Optimus.Pretty+import Optimus.Strategy+import Optimus.Util+import System.Console.CmdArgs hiding (prog)++data SCArgs = SCArgs { scOption :: SCOption+ , targets :: String+ , numTargets :: Int+ , scFile :: [String] }+ deriving (Show, Data, Typeable)++data SCOption = Normal | Graph | Auto | List+ deriving (Show, Data, Typeable, Eq)++version = "OptimusPrime v0.0.1, (C) Jason Reich <jason@cs.york.ac.uk>"+optimusprime = mode $ SCArgs+ { scOption = enum Normal [ Graph &= text "Produce call graph in graphviz DOT format"+ , Auto &= text "Automagically select targets for sc"+ , List &= text "Output the automagically selected targets" ]+ , targets = def &= typ "FUNCTIONS" & text "Space-delimited list of functions to target (overrides auto)"+ , numTargets = def &= typ "NUM" & text "Number of targets to supercompile (default=5)"+ , scFile = def &= args & typFile+ } &=+ text "Supercompiler for f-lite" &+ helpSuffix [""]+ +main = do+ SCArgs m ts num fs <- cmdArgs version [optimusprime]+ case fs of+ [f] -> do+ p <- parseProgFile f >>= return . identifyFuncs . freshProg desugar+ let num' = if num == 0 then 5 else num+ let ts' = if null ts then selectFuncs num' p else words ts+ case m of+ Normal -> (putProg . supercompile) p+ Graph -> (putStrLn . produceDotTrav . travGraph . freshProg desugar) p+ Auto -> (putProg . supercompileMany ts') p+ List -> putStrLn $ "Targetted functions: " ++ unwords ts'+ putStrLn ""+ otherwise -> cmdArgsHelp version [optimusprime] Text >>= putStr
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ optimusprime.cabal view
@@ -0,0 +1,22 @@+Name: optimusprime+version: 0.0.1.20091113+Synopsis: A supercompiler for f-lite+License: BSD3+License-file: LICENSE+Author: Jason Reich <jason@cs.york.ac.uk>+Maintainer: Jason Reich <jason@cs.york.ac.uk>+Homepage: http://optimusprime.posterous.com/+Stability: experimental+Build-Type: Simple+Cabal-Version: >=1.6+Description: A supercompiler for f-lite+Category: Language, Compiler, Program Transformation++Executable optimusprime+ Main-is: OptimusPrime.hs+ Build-Depends: base >= 3 && < 5, containers >= 0 && < 1,+ parsec >= 2.1.0.1 && < 3, flite >= 0 && < 1,+ uniplate >= 1.2.0.3 && < 2, wl-pprint >= 1 && < 2,+ mtl >= 1.1.0.2 && < 2, fgl >= 5.4.2.2 && < 6,+ graphviz >= 2999.6.0.0, haskell98 >= 1 && < 2,+ cmdargs >= 0.1 && < 1