FYI. Here is another MYATSCCDEF that allows you to compile and run a single-file ATS program without installing patscc/patsopt (but you do need ATS2-include for all the necessary header files):
(* ##myatsccdef=\ curl --data-urlencode mycode@$1 \ http://bucs320-tutoriats.rhcloud.com/\ SERVICE/assets/patsopt_ccats_eval_code_0_.php | \ php -R 'if (\$argn != \"\") echo(json_decode(urldecode(\$argn))[1].\"\\n\");' | \ tcc -run -std=c99 -D_XOPEN_SOURCE -I\${PATSHOME} -I\${PATSHOME}/ccomp/runtime -L\${PATSHOME}/ccomp/atslib/lib -o $fname($1) -x c - *) Please visit the link: http://www.ats-lang.org/Downloads.html#Install_of_ATS2_include for information on installing ATS2-include. If you don't have 'tcc', you can try 'gcc' or 'clang'. Cheers! On Sunday, May 7, 2017 at 11:12:38 PM UTC-4, gmhwxi wrote: > > FYI. > > In case one wants to use ATS as a scripting language, > please include the following comment in the file containing > scripting code written in ATS: > > (* > ##myatsccdef=\ > patsopt --constraint-ignore --dynamic $1 | \ > tcc -run -DATS_MEMALLOC_LIBC -I${PATSHOME} -I${PATSHOME}/ccomp/runtime - > $arglst(2) > *) > > 'tcc' is for Tiny C Compiler, which can compile about 1M lines of C per > second. > > On Thursday, April 27, 2017 at 1:56:01 AM UTC-4, gmhwxi wrote: >> >> Thanks! >> >> These days I have been thinking about (and working on) a tutorial system >> for ATS. And myatscc is an attempt to provide an option that avoids the >> need >> to make directly use of patscc/patsopt. >> >> Yes, you can use myatscc to compile multiple files. I will be happy to >> show >> it to you. >> >> First, I suggest that you make an npm-package for ats3d, which, by the >> way, >> is beautifully written. >> >> If you are not familiar with the process of npm-packaging, I will be >> happy to do it. >> It does not take much time at all. Afterwards, let use myatscc to compile >> all the >> test files inside ats3d/TEST. >> >> >>The way I see it, it should be possible for the compiler (or some other >> tool) to infer module dependencies automatically? >> >> I have not thought about it carefully. >> >> Incidentally, we discussed the ways of automating programmer's workflow >>> here: >>> https://github.com/RyanTKing/wombats/issues/1 >>> I'm going to try to adapt the existing xmake project to tailor it to the >>> needs of ATS programming. I don't have much time for this, at the moment, >>> though. >>> >> >> Sounds great! I will talk to Ryan. >> >> On Thursday, April 27, 2017 at 12:23:30 AM UTC-4, Artyom Shalkhakov wrote: >>> >>> Hi Hongwei, >>> >>> On Wednesday, April 26, 2017 at 6:24:19 AM UTC+6, 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 :) >>>> >>>> >>> This is awesome! >>> >>> Can it compile multi-module programs too? I currently have a very clumsy >>> Makefile setup here: >>> >>> https://github.com/ashalkhakov/ats3d/tree/master/src/TEST >>> >>> (see specifically the Makefile) >>> >>> The way I see it, it should be possible for the compiler (or some other >>> tool) to infer module dependencies automatically? >>> >>> Incidentally, we discussed the ways of automating programmer's workflow >>> here: >>> >>> https://github.com/RyanTKing/wombats/issues/1 >>> >>> I'm going to try to adapt the existing xmake project to tailor it to the >>> needs of ATS programming. I don't have much time for this, at the moment, >>> though. >>> >>> >>>> 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/e45e480e-d167-4aff-b2ee-f3eb27fd1319%40googlegroups.com.