Scripts are typically invoked directly, as "tool" where tool is in your PATH, or "./tool"
In Unix, the kernel itself finds the scripting binary to run an executable file beginning with #! So languages intended for scripting use typically accept #! or # as a line comment. ATS doesn't accept it as a comment, but you can make do with some overhead: $ cat hello.dats //usr/bin/env myatscc "$0"; exit (* ##myatsccdef=\ patsopt --constraint-ignore --dynamic $1 | \ tcc -run -DATS_MEMALLOC_LIBC -I${PATSHOME} -I${PATSHOME}/ccomp/runtime - $arglst(2) *) implement main0() = println!("Hello, world!") $ ./hello.dats Hello, world! The next step would be to cache the compilation entirely, as with https://github.com/mjambon/ocamlscript On Tuesday, April 25, 2017 at 7:24:19 PM UTC-5, gmhwxi wrote: > > > Often a file of ATS source code has to be compiled with the use of a > Makefile. > This can be quite inconvenient in practice. > > When teaching, I have to answer countless questions regarding the need of > certain > flags for compiling ATS code through the use of patscc/patsopt directly. > > I recently wrote a command 'myatscc' (which should be available to you if > you build > the latest version of ATS (that is, ATS2-0.3.5). The simple idea behind of > 'myatscc' is > like this: > > Given a file, say, foo.dats, one should be able to compile it by issuing > the following > command: > > myatscc foo.dats > > Whatever needed for compiling foo.dats should be written as some form of > comment > inside foo.dats. For instance, the following comment is assumed to be the > default (if > nothing is given explicitly): > > (* > ##myatsccdef=\ > patscc -D_GNU_SOURCE -DATS_MEMALLOC_LIBC -o $fname($1) $1 > *) > > $1: the first non-flag argument passed to myatscc > $fname: a built-in function for myatscc that returns the proper part of a > filename > > If you just want to see what myatscc generates (but not to execute what is > generated), > please do: > > myatscc --dryrun foo.dats > > I am pretty sure that 'myatscc' will save a great deal of my own time :) > > Cheers! > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To post to this group, send email to ats-lang-users@googlegroups.com. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/7f0763e4-de85-439b-9166-b7dfdf18f353%40googlegroups.com.