Formal specification of ATS2 abstract syntax tree (Template ATS2?)

69 views
Skip to first unread message

Shea Levy

unread,
Oct 23, 2014, 8:28:29 PM10/23/14
to ats-lan...@googlegroups.com
Hi all,

I was wondering, would it be possible to model the ATS2 abstract syntax
tree as ATS2 types, and use that to implement the ATS2 version of
Template Haskell? What would be involved in that kind of project, where
would I start?

Cheers,
Shea

Hongwei Xi

unread,
Oct 23, 2014, 9:17:11 PM10/23/14
to ats-lan...@googlegroups.com
I am very glad that you brought up the issue.

Note that the keywords "`(" and ",(" and "%(" are still kept
in ATS2 in the hope of supporting TH-style of meta-programming :)

I co-authored the following paper about 10 years ago:

http://www.cs.bu.edu/~hwxi/academic/papers/JFPmp.pdf

I actually implemented in ATSproto, the first released version of
ATS, the system formalized in the above paper, which is more
ambitious than Template Haskell (TH) in terms of type-checking.

By the way, ATSproto also supported OOP; it was really messy and bulky :)

If you are interested, I would suggest that you target only the functional core of
ATS at first. There may be complications due to the support for flat data representation
in ATS2.

Static typechecking is wonderful, but it is often too complicated for such a template
system. So trying to support run-time typechecking on generated syntax trees seems
to be sensible way to control complexity.

Lastly, I would like to point out the following paper:

which is about distributed meta-programming. It is a quite interesting idea.




--
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/20141024002825.GB2093%40nixos.hsd1.nh.comcast.net.

Artyom Shalkhakov

unread,
Oct 23, 2014, 11:33:04 PM10/23/14
to ats-lan...@googlegroups.com
Hello Shea,

I don't know. Just wanted to chime in and wish you good luck. :-)

I was recently thinking of using metaprogramming together with external constraint solving to allow for type-safe database queries in ATS, in the style of Ur/Web. Basically, add new external sorts "row" and "field label", and a few external static functions for constructing row sorts, and then implement some data structures that would be indexed by these sorts. The disjointness proofs of record field labels would be handled externally.

At first, I was thinking of using some form of a preprocessor for this. But TH-style metaprogramming would be much easier to deal with, I assume.
 
Cheers,
Shea

Shea Levy

unread,
Oct 27, 2014, 7:07:10 PM10/27/14
to ats-lan...@googlegroups.com
On Thu, Oct 23, 2014 at 09:17:11PM -0400, Hongwei Xi wrote:
> I am very glad that you brought up the issue.
>
> Note that the keywords "`(" and ",(" and "%(" are still kept
> in ATS2 in the hope of supporting TH-style of meta-programming :)
>
> I co-authored the following paper about 10 years ago:
>
> http://www.cs.bu.edu/~hwxi/academic/papers/JFPmp.pdf
>
> I actually implemented in ATSproto, the first released version of
> ATS, the system formalized in the above paper, which is more
> ambitious than Template Haskell (TH) in terms of type-checking.
>
> By the way, ATSproto also supported OOP; it was really messy and bulky :)
>
> If you are interested, I would suggest that you target only the functional
> core of
> ATS at first. There may be complications due to the support for flat data
> representation
> in ATS2.
>

What consists of the 'core' here?
> To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpadySc9iA4FsJ5vsmFvLFEo3GgbpTk5cggMTs43TpUyg%40mail.gmail.com.

gmhwxi

unread,
Oct 27, 2014, 8:23:00 PM10/27/14
to ats-lan...@googlegroups.com
Essentially, the core consists of

lambda-calculus + datatypes + references.

gmhwxi

unread,
Nov 2, 2014, 7:45:24 PM11/2/14
to ats-lan...@googlegroups.com
Today, I located ATS0-proto. It is now available on-line:

https://sourceforge.net/projects/ats-first/

The interpreter for ATS0 is contained in the following file:

https://sourceforge.net/p/ats-first/code/ci/master/tree/atsInterp.ml

It does handle the kind of meta-programming we talked about above.
Reply all
Reply to author
Forward
0 new messages