-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsysparser.hs
More file actions
30 lines (28 loc) · 886 Bytes
/
sysparser.hs
File metadata and controls
30 lines (28 loc) · 886 Bytes
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
--
-- Authors: Emilio Tuosto <emilio.tuosto@gssi.it>
--
-- This main parses a communicating system and prints
-- its corresponding Haskell's data structure
--
import Misc
import SystemParser
import Data.List as L
import System.Environment
import System.FilePath.Posix
main :: IO ()
main = do progargs <- getArgs
if L.null progargs
then putStr $ usage SYS
else do
let flags =
getFlags SYS (take ((length progargs) - 1) progargs)
myPrint flags SYS "parsing started"
let sourcefile =
last progargs
let filename =
takeFileName sourcefile
txt <- readFile sourcefile
let (_, _, _, ext) =
setFileNames filename flags
let sys = parseSystem ext txt
putStr $ show sys