-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathTest.hs
67 lines (59 loc) · 1.75 KB
/
Test.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
module Test
where
import System.Environment
import Comorphisms.LogicGraph
import Static.AnalysisLibrary
import System.IO
import Static.DotGraph
import Static.DevGraph
import Options
import CASL.Logic_CASL
import Common.Lib.Graph
import Logic.Logic
import Logic.Grothendieck
import Common.Result
import Common.Id
import Common.AS_Annotation
--proceed :: String -> IO()
proceed fname = do
anaFile logicGraph defaultLogic defaultHetcatsOpts emptyLibEnv fname
{- case res of
Just(_,_,dg,_) -> do
putStrLn ("Successfully analyzed.")
putStrLn ("Writing development graph to "++fname++".dot")
h <- openFile (fname++".dot") WriteMode
sequence (map (hPutStrLn h) (dot dg))
hClose h
_ -> return ()
-}
getCASLSig :: String -> IO CASLSign
getCASLSig fname = do
res <- proceed fname
case res of
Just (_,_,dg,_) -> do
case match 1 dg of
(Just ctx,_) -> case dgn_sign $ lab' ctx of
G_sign lid sig ->
case maybeResult $ rcoerce lid CASL nullPos sig of
Just sig' -> return sig'
Nothing -> error "Not a CASL sig"
_ -> error "Node 1 no in development graph"
Nothing -> error "Error occured"
getCASLSens :: String -> IO [Named CASLFORMULA]
getCASLSens fname = do
res <- proceed fname
case res of
Just (_,_,dg,_) -> do
case match 1 dg of
(Just ctx,_) -> case dgn_sens $ lab' ctx of
G_l_sentence_list lid sens ->
case maybeResult $ rcoerce lid CASL nullPos sens of
Just sens' -> return sens'
Nothing -> error "Not the CASL logic"
_ -> error "Node 1 no in development graph"
Nothing -> error "Error occured"
main :: IO()
main = do
files <- getArgs
sequence (map proceed files)
return ()