Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
console and graph packages split off.
- Loading branch information
Erdwolf
authored and
Erdwolf
committed
Sep 6, 2011
1 parent
6066ed5
commit 8267db8
Showing
11 changed files
with
107 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
module Main (main) where | |||
import Console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
Name: prolog-console | |||
Version: 0.1 | |||
Synopsis: A Prolog interpreter written in Haskell. | |||
License: PublicDomain | |||
Author: Matthias Bartsch | |||
Maintainer: bartsch@cs.uni-bonn.de | |||
Category: Language | |||
Build-type: Simple | |||
|
|||
Cabal-version: >=1.2 | |||
|
|||
Executable hsprolog | |||
Main-is: Main.hs | |||
|
|||
Build-depends: | |||
base >=4 && <5, | |||
parsec >= 3.1.1, | |||
readline >= 1.0.1.0, | |||
prolog == 0.1.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
module Main where | |||
|
|||
import Control.Applicative ((<$>)) | |||
import Control.Arrow ((>>>),(<<<)) | |||
import Language.Prolog (consult, parseQuery) | |||
import ParseArgs (parseArgs) | |||
import GraphViz (resolveTree, resolveTreeToFile) | |||
|
|||
main = do | |||
(queryString, files, output) <- parseArgs | |||
p <- concat <$> mapM ((abortOnError=<<) . consult) files | |||
q <- abortOnError $ parseQuery queryString | |||
resolveTreeToFile output p q | |||
--case output of | |||
-- Nothing -> resolveTree p q {- FIXME Never shown since thread terminated. -} | |||
-- Just file -> resolveTreeToFile file p q >> return () | |||
|
|||
abortOnError = either (error . show) return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
{-# LANGUAGE DeriveDataTypeable #-} | |||
module ParseArgs ( | |||
parseArgs | |||
) where | |||
|
|||
import System.Console.CmdArgs | |||
import System.Environment (getProgName) | |||
|
|||
data Options = Options | |||
{ query :: String | |||
, file :: [String] | |||
, output :: String | |||
, positional :: [String] | |||
} | |||
deriving (Data, Typeable) | |||
|
|||
options = Options | |||
{ query = def &= typ "QUERY" &= help "Set Prolog query (If not set, first positional argument is used)" | |||
, file = def &= typ "FILE" &= help "Consult file before executing query" | |||
, output = "graph.png" &= typ "FILE" &= help "Save generated image to file (default: 'graph.png')" | |||
, positional = def &= args &= typ "QUERY [FILE]..." | |||
} | |||
&= versionArg [ignore] | |||
&= helpArg [name "h"] | |||
|
|||
parseArgs = do | |||
opts <- getProgName >>= cmdArgs . ((options &=) . program) | |||
return $ case opts of | |||
Options q fs o [] -> (q, fs, o) | |||
Options _ fs o [q] -> (q, fs, o) | |||
Options _ fs o (q:fs') -> (q, fs++fs', o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
Name: prolog-graph | |||
Version: 0.1 | |||
Synopsis: A Prolog interpreter written in Haskell. | |||
License: PublicDomain | |||
Author: Matthias Bartsch | |||
Maintainer: bartsch@cs.uni-bonn.de | |||
Category: Language | |||
Build-type: Simple | |||
|
|||
Cabal-version: >=1.2 | |||
|
|||
Executable hsprolog-graph | |||
Main-is: Main.hs | |||
|
|||
Build-depends: | |||
base >=4 && <5, | |||
prolog == 0.1.*, | |||
fgl >= 5.4.2.4, | |||
mtl >= 2.0.1.0, | |||
cmdargs >= 0.8, | |||
text >= 0.11.1.5, | |||
graphviz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters