I am gradually building the libatscc2scm library. Just made the
GameOf24 example work:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/SMALL/GameOf24/Scheme

Note that the scheme implementation used is Guile-scheme.

Now we have the possibility to compile ATS into C and also in Guile; the 
generated C code and
Guile code can actually make direct use of each other :)

On Tuesday, May 31, 2016 at 12:40:34 AM UTC-4, gmhwxi wrote:
>
>
> It is not yet fully functioning. Here is the code for the compiler:
>
>
> https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/CATS-atsccomp/CATS-atscc2scm
>
> As an example, the following code is generated based on
>
> https://github.com/githwxi/ATS-Postiats-contrib/blob/master/projects/MEDIUM/CATS-atsccomp/CATS-atscc2scm/TEST/acker.dats
>
> (define
> (acker arg0 arg1)
> (let(
> ;; knd = 0
>   (tmpret0 #f)
>   (tmp1 #f)
>   (tmp2 #f)
>   (tmp3 #f)
>   (tmp4 #f)
> ;; var Tmplab, Tmplab_scm
> ) ;; in-of-let
>   ;; __patsflab_acker
>   (letrec(
>     (casefnx
>      (lambda(Tmplab)
>       (case Tmplab
>       ;; ATSbranchseq_beg
>       ((1)
>        (if (not (ATSCKpat_int arg0 0))
>          (casefnx 3)
>          (begin
>           (casefnx 2)
>          )
>        )
>       ) ;; end-of-branch
>       ((2)
>        (ats2scmpre_add_int0_int0 arg1 1)
>       ) ;; end-of-branch
>       ;; ATSbranchseq_end
>       ;; ATSbranchseq_beg
>       ((3)
>        (if (not (ATSCKpat_int arg1 0))
>          (casefnx 5)
>          (begin
>           (casefnx 4)
>          )
>        )
>       ) ;; end-of-branch
>       ((4)
>        (set! tmp1 (ats2scmpre_sub_int0_int0 arg0 1))
>        (acker tmp1 1)
>       ) ;; end-of-branch
>       ;; ATSbranchseq_end
>       ;; ATSbranchseq_beg
>       ((5)
>        (set! tmp2 (ats2scmpre_sub_int0_int0 arg0 1))
>        (set! tmp4 (ats2scmpre_sub_int0_int0 arg1 1))
>        (set! tmp3 (acker arg0 tmp4))
>        (acker tmp2 tmp3)
>       ) ;; end-of-branch
>       ;; ATSbranchseq_end
>       ;; _ -> atscc2scm_caseof_deadcode(?FILE, ?LINE)
>       ) ;; end-of-case
>      ) ;; end-of-lambda
>     ) ;; end-of-casefnx
>    ) (casefnx 1)
>   ) ;; end-of-letrec
> ) ;; end-of-let
> ) ;; end-of-fun
>
> When using atscc2scm, one should disable tail-call optimization on the ATS 
> side.
>
> I am on my way to write atscc2clj (ATS to Clojure), and atscc2scm is a 
> convenient
> by-product.
>
> With atscc2clj, we can generate JVM code by going the route: ATS -> 
> Clojure -> JVM.
> Then with lein-droid, we shall be able to write Android apps (partly) in 
> ATS.
>
> 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 [email protected].
To post to this group, send email to [email protected].
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/162a6316-1c3e-41f1-8ff0-534dd6483882%40googlegroups.com.

Reply via email to