Creating a package written in ATS

61 views
Skip to first unread message

gmhwxi

unread,
May 22, 2015, 12:18:35 PM5/22/15
to ats-lan...@googlegroups.com

I created the following package for use by other projects:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/CATS-parsemit

Here is an example to show how CATS-parsemit can be used:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/CATS-atscc2js

Basically, one needs to copy the SATS files provided by CATS-parsemit to a local directory, say,
.CATS-parsemit. In addition, one needs to copy the CATS files generated from the ATS source (of CATS-parsemit).
This can be done by issuing:

make pkgreloc

These CATS files replace the need for library binaries (in the form of .a or .so files), thus greatly enhancing portability.

Now just do 'make all', and 'atscc2js' should be built properly.

Yannick Duchêne

unread,
May 22, 2015, 12:41:51 PM5/22/15
to ats-lan...@googlegroups.com


Le vendredi 22 mai 2015 18:18:35 UTC+2, gmhwxi a écrit :

[…] In addition, one needs to copy the CATS files generated from the ATS source (of CATS-parsemit).

This can be done by issuing:

make pkgreloc

From `CATS-parsemit` or from `CATS-atscc2js`? I don't know the `pkgreloc` target.

Hongwei Xi

unread,
May 22, 2015, 1:08:08 PM5/22/15
to ats-lan...@googlegroups.com
>>From `CATS-parsemit` or from `CATS-atscc2js`? I don't know the `pkgreloc` target.

In CATS-atscc2js


--
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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/b62fc6c3-1d12-4935-8b26-90959cd13969%40googlegroups.com.

Yannick Duchêne

unread,
May 22, 2015, 1:12:22 PM5/22/15
to ats-lan...@googlegroups.com
From  `CATS-atscc2js` seems to deal with the hidden directory `.CATS-parsemit` , this do the same as copying manually and I still have compilation errors:

./.CATS-parsemit/catsparse_include_all_dats.c:165072:22: error: CATSPARSE__filename_stdin undeclared (first use in this function)
and
./.CATS-parsemit/catsparse_include_all_dats.c:165125:22: error: CATSPARSE__location_dummy undeclared (first use in this function)




Hongwei Xi

unread,
May 22, 2015, 1:16:42 PM5/22/15
to ats-lan...@googlegroups.com
Your version of ATS2 is not newer enough :)


--
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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.

Yannick Duchêne

unread,
May 22, 2015, 2:08:18 PM5/22/15
to ats-lan...@googlegroups.com


Le vendredi 22 mai 2015 19:16:42 UTC+2, gmhwxi a écrit :
Your version of ATS2 is not newer enough :)

I have 0.1.12 :( Isn't it the lastest?

I will try to install from GitHub (ATS, not just Contrib), but I feel to remember ATS1 is required to build ATS2 from GitHub.

Yannick Duchêne

unread,
May 22, 2015, 2:15:04 PM5/22/15
to ats-lan...@googlegroups.com
OK, I've seen there is a newer 0.1.13. Installing from the script I use just fetched the previous one.

Zhiqiang Ren

unread,
May 28, 2015, 12:08:25 PM5/28/15
to ats-lan...@googlegroups.com

gmhwxi

unread,
May 28, 2015, 12:14:48 PM5/28/15
to ats-lan...@googlegroups.com
This is just to make sure that the contents in these files cannot interfere with each other.

If you like, you could also do

val () = let #include "...." in () end

Yannick Duchêne

unread,
May 28, 2015, 1:39:43 PM5/28/15
to ats-lan...@googlegroups.com
I have not yet looked at it, but I have a question too: how do one make use of what's included in the local sections, as this is not like a namespace? Or is this only for side effects?

gmhwxi

unread,
May 28, 2015, 2:52:50 PM5/28/15
to ats-lan...@googlegroups.com
Well, the point is to make sure that whatever is included in the local sections cannot
be used in other parts of the code. However, the compiler still gets to compile the code
in local sections. This makes it straightforward to combine several files of ATS code into
a single one.

Yannick Duchêne

unread,
May 28, 2015, 5:55:59 PM5/28/15
to ats-lan...@googlegroups.com
I see, it's like encapsulation, but if whatever in a local section cannot be used in another part, what's the intended effect if not side effetcs? Or is it about externs? But if so, then what about dynloads?

gmhwxi

unread,
May 28, 2015, 7:04:28 PM5/28/15
to ats-lan...@googlegroups.com
Just to have all the implements available to the compiler.
If a file is included, then the dynload for the file is not needed.
It is kind of being inlined.

Yannick Duchêne

unread,
May 28, 2015, 11:37:00 PM5/28/15
to ats-lan...@googlegroups.com


Le vendredi 29 mai 2015 01:04:28 UTC+2, gmhwxi a écrit :
Just to have all the implements available to the compiler.

Okay, I see. So may be unless an application is so big it needs separate units to be type-checked within a reasonable amount of time, this may be more simple to always use includes in locals.
 
If a file is included, then the dynload for the file is not needed.
It is kind of being inlined.
 
Yes, that sounds obvious. 
Reply all
Reply to author
Forward
0 new messages