SCM Repository
View of /sml/branches/SMLNJ/src/ml-burg/load
Parent Directory
|
Revision Log
Revision 3 -
(download)
(annotate)
Sat Oct 4 23:33:46 1997 UTC (23 years, 4 months ago)
File size: 2036 byte(s)
Sat Oct 4 23:33:46 1997 UTC (23 years, 4 months ago)
File size: 2036 byte(s)
This commit was manufactured by cvs2svn to create branch 'SMLNJ'.
(* * Load the files that make up mlburg, and prepare for use in * an interactive session. * You may need to change the path to the SML/NJ Library. * * To export an executable, *in an sml-noshare* : * exportFn ("mlburg", Burg.prog); *) let val smlnjLibDir = "../smlnj-lib/" in app use [ "errormsg.sml", "burg-ast.sml", "mlyacc-base.sml", "burg-gram.sig", "burg-lex.sml", "burg-gram.sml", "parse.sml", smlnjLibDir ^ "hash-key-sig.sml", smlnjLibDir ^ "hash-table-sig.sml", smlnjLibDir ^ "hash-table.sml", smlnjLibDir ^ "hash-string.sml", "burg.sml" ] end; structure Burg = struct fun prog (argv, _) = let fun help () = output (std_err, "usage: mlburg [<filename>.burg]\n") in case argv of [] => output (std_err, "?? argv is []\n") | [_] => BurgEmit.emit (std_in, (fn () => std_out)) | (_::"-h"::_) => help () | (_::"-help"::_) => help () | (_::files) => let (** fun findfile file = let val {dir, name, ext} = OS.Path.splitPath file in case ext of (OS.Path.EXT("brg" | "burg")) => OS.Path.makePath{dir=dir, name=name, ext="sml"} | _ => file ^ ".sml" (* end case *) end **) fun findname file = let val lenfile = String.length file in (if ((lenfile>4) andalso (substring (file, lenfile-4, 4)=".brg")) then substring (file, 0, lenfile-4) else if ((lenfile>5) andalso (substring (file, lenfile-5, 5)=".burg")) then substring (file, 0, lenfile-5) else file) ^".sml" end val names = map (fn n => (n,findname n)) files fun emit (inname, outname) = (let val s_in = open_in inname in BurgEmit.emit (s_in, (fn () => (open_out outname))) end) handle (err as (Io s)) => (output (std_err, s^"\n"); raise err) in app emit names end end (* * This is the function to call in an interactive session. * Takes a filename (something.burg) as argument, and produces something.sml *) fun doit s = prog (["",s],()) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |