On 02/04/2013 14:36, David Matthews wrote:
Perhaps one can also pour in the gcc-compile phase already, so it's one
step from ML-file to executable.
I don't know how that works so perhaps that's for later.
So, in summary, it should look like:
-c option: Compile a source file which must contain a function main of
type unit -> unit (or string list => unit or string list -> int ???) and
export the object file.
-o option: Used with -c to override the default object file name.
-i option: Force interactive mode. The default is interactive only if
stdin is a terminal. This controls whether to print a prompt.
--skip-first-line option: Skip the first line of the input stream. Used
with scripts with #! at the start.
I've implemented the -i option and check for interactive mode and also a
--script option. The latter compiles and executes the input file,
stripping off the first line if it begins with #!. It also quietens the
output as with the -q option.
david@dunedin:~$ cat /tmp/hello.ML
#! /usr/local/bin/poly --script
print "Hello World\n";
david@dunedin:~$ /tmp/hello.ML
Hello World
david@dunedin:~$
It seems that when the script is called CommandLine.arguments() returns
all the arguments that have been given to the script as the first item
in the list with the name of the file itself as the second. That means
that, for the moment at least, there must be just one --script argument
and nothing else.
I'm still wondering about the compilation options. It would be nice to
find some way of including the linking phase with compilation.
Currently it's not that difficult to export an object file but there's a
bit of messing about working out exactly what to put on the "ld" line to
link the object file with the Poly libraries and any C++/gmp etc
libraries. I have in mind some sort of script that would be built as
part of building Poly/ML that would include the path to where the
libraries will be installed as well as the dependent libraries. This is
all there somewhere in the libtool/autoconf/Makefile but I'm not sure
how to get it out.
David
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml