Sorry, I did not make it clear what I want. I want ML scripts to invoke
from the command line, without compiling them. I made it work, see how.
There is an shc [1] translator that compiles shell scripts to C code. I
have used a one-liner [2]:

$ cat polyscript.sh
#!/bin/bash

tail -n +2 $1 | poly

I compiled this with shc and in turn with gcc:

$ shc-3.8.9/shc -f polyscript.sh
$ gcc -Wall polyscript.sh.x.c -o polyscript

Now, I was able to create a first script written in ML:

$ cat smlscript
#!/home/gergoe/projects/shebang/polyscript $0

print "Hello World!"

and, I was able to run it:

$ chmod u+x smlscript
$ ./smlscript
Poly/ML 5.4.1 Release
> > # Hello World!val it = (): unit

It might be interesting to write polyscript directly in C, but probably
that wouldn't make it faster.

Back to the original question: this is why I would like to suppress any
compiler message.

I did not find such a flag in the manual, would it be possible to add one,
David?

- Gergely

[1] http://www.datsi.fi.upm.es/~frosal/

[2]
http://stackoverflow.com/questions/15665119/how-to-define-script-interpreter-with-shebang
     holgero's answer


On 29 March 2013 02:03, Phil Clayton <[email protected]> wrote:

> I'm not sure what your exact requirements are but a possible solution may
> be to create an executable.  Then compile-time output would not be mixed
> with run-time output.  It's straightforward: wrap everything into a
> toplevel function and export that, e.g.
>
> [pclayton@rizzo ~]$ cat hello.sml
> fun main () = print "Hello World!\n";
> PolyML.export ("hello", main);
>
> Compile:
>   cat hello.sml | poly
>
> Link:
>   POLYHOME=/opt/polyml/polyml-5.**5  # your Poly/ML installation
>   POLYLIB=${POLYHOME}/lib
>   LD_RUN_PATH=${POLYLIB}:${LD_**RUN_PATH} cc -ggdb -o hello -L${POLYLIB}
> -lpolymain -lpolyml hello.o
>
> Run:
>   ./hello
>
>
> Phil
>
>
>
> On 28/03/13 20:49, Gergely Buday wrote:
>
>> Hi,
>>
>> I would like to feed an sml program into poly from standard input:
>>
>> $ cat hello.sml |poly
>> Poly/ML 5.4.1 Release
>>
>>> # Hello World!val it = (): unit
>>>
>>
>> Is it possible to use this so that the compiler itself does not print
>> anything? I have found poly -q which does not print the release
>> message but that still prints all the rest.
>>
>> - Gergely
>> ______________________________**_________________
>> polyml mailing list
>> [email protected]
>> http://lists.inf.ed.ac.uk/**mailman/listinfo/polyml<http://lists.inf.ed.ac.uk/mailman/listinfo/polyml>
>>
>>
>>
> ______________________________**_________________
> polyml mailing list
> [email protected]
> http://lists.inf.ed.ac.uk/**mailman/listinfo/polyml<http://lists.inf.ed.ac.uk/mailman/listinfo/polyml>
>
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to