Hi community,

i don't know if it's useful, but if someone wants to build and execute a 
"myatscc" code definiton in-situ via .dats file itself, here it is:

$ cat hello.dats
exec <$0 ; read ; cat > $0.dats ; exec myatscc $0.dats $@

(*
##myatsccdef=patscc -cleanaft -o $fname($fname($1)) $1 -DATS_MEMALLOC_LIBC 
-I${PATSHOME} $arglst(2) ; rm $1 ; ./$fname($fname($1))
*)

implement main0() = println!("Hello, world!")


Cheers,
Marcello



Am Montag, 8. Mai 2017 05:12:38 UTC+2 schrieb gmhwxi:
>
> 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/fe99e81c-f085-43bf-854b-5f4379e7f84c%40googlegroups.com.

Reply via email to