
load "PWB";
load "Prettyprinter";
open PWB;
val jobname = "test.pepa";
val is     = Nonstdio.open_in_bin jobname;
val lexbuf = createLexerStream is;
   TextIO.output (TextIO.stdOut, "Compiling the model\n");
   TextIO.flushOut TextIO.stdOut;
val model = parseExprReport jobname is lexbuf
   handle exn => (BasicIO.close_in is; raise exn);
val M = Semantic.analyse 
   (Min.fixpointfold model);
   BasicIO.close_in is;
   TextIO.output (TextIO.stdOut, "Generating the derivation graph\n");
   TextIO.flushOut TextIO.stdOut;
   Graph.compile M;
   TextIO.output (TextIO.stdOut, "The model has " ^
		  statespace (Table.show_size()));
   TextIO.flushOut TextIO.stdOut;
   TextIO.output (TextIO.stdOut, "The model has " ^ 
		  transitionsspace (!Statespace.transitions));
   TextIO.flushOut TextIO.stdOut;
   writeHashFile jobname;
   TextIO.output (TextIO.stdOut, "Exiting PEPA Workbench.\n");
   TextIO.flushOut TextIO.stdOut;

val der = Derivatives.derivative;
val pp = Prettyprinter.print Prettyprinter.verbose;

val ds = der [] M;
val d' = hd ds;
pp (#3 d');





(* val a = Files.readFile "tiny"; *)
(* val b = Lexer.analyse a; *)
(* val c = Parser.parse b; *)
(* val d = Semantic.analyse c; *)
(* Graph.initialize; *)
(* Statespace.initialize; *)
