Patsopt as a service

Today I managed to use atscc2php to generate some PHP code to support the
following service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-trial/inputform.html

It is mostly for fun at this moment. Still, you can use the service to
compile short code, trying to see if there
are type-errors.

I added a simple API for Ajax in libatscc2js:

https://github.com/githwxi/ATS-Postiats-contrib/blob/master/contrib/libatscc2js/SATS/Ajax

which I used to implement an improved patsopt-atscc2js service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial2/inputform.htmlOn Tuesday, September 9, 2014 1:57:10 AM UTC-4, gmhwxi wrote:

Now ATS code can be compiled into JavaScript and then evaluated:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

If you paste the following code into the input form, you should see two
alerts generated:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun fact : int → int = “mac#fact”
implement
fact (n) =
if n > 0 then n * fact(n-1) else 1
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

%{$
//
alert("fact(12) = " + fact(12));
alert("acker(3, 8) = " + acker(3, 8));
//
%} // end of [%{$]

On Monday, September 8, 2014 2:32:52 PM UTC-4, gmhwxi wrote:

Now there is a service for generating JavaScript from ATS source:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

For instance, you will get some JS code if you paste the following code
into the input form and submit:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

Naturally, the next step is to get the generated JS code to run in the
browser.

Cheers!

On Monday, September 8, 2014 1:55:04 AM UTC-4, gmhwxi wrote:

Today I managed to use atscc2php to generate some PHP code to support
the following service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-trial/inputform.html

It is mostly for fun at this moment. Still, you can use the service to
compile short code, trying to see if there
are type-errors.

Now there is a service for generating JavaScript from ATS source:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

For instance, you will get some JS code if you paste the following code
into the input form and submit:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

Naturally, the next step is to get the generated JS code to run in the
browser.

Cheers!On Monday, September 8, 2014 1:55:04 AM UTC-4, gmhwxi wrote:

Today I managed to use atscc2php to generate some PHP code to support the
following service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-trial/inputform.html

It is mostly for fun at this moment. Still, you can use the service to
compile short code, trying to see if there
are type-errors.

This one uses the ACE editor:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial2/On Thursday, September 11, 2014 2:35:41 AM UTC-4, gmhwxi wrote:

I added a simple API for Ajax in libatscc2js:

https://github.com/githwxi/ATS-Postiats-contrib/blob/master/contrib/libatscc2js/SATS/Ajax

which I used to implement an improved patsopt-atscc2js service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial2/inputform.html

On Tuesday, September 9, 2014 1:57:10 AM UTC-4, gmhwxi wrote:

Now ATS code can be compiled into JavaScript and then evaluated:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

If you paste the following code into the input form, you should see two
alerts generated:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun fact : int → int = “mac#fact”
implement
fact (n) =
if n > 0 then n * fact(n-1) else 1
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

%{$
//
alert("fact(12) = " + fact(12));
alert("acker(3, 8) = " + acker(3, 8));
//
%} // end of [%{$]

On Monday, September 8, 2014 2:32:52 PM UTC-4, gmhwxi wrote:

Now there is a service for generating JavaScript from ATS source:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

For instance, you will get some JS code if you paste the following code
into the input form and submit:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

Naturally, the next step is to get the generated JS code to run in the
browser.

Cheers!

On Monday, September 8, 2014 1:55:04 AM UTC-4, gmhwxi wrote:

Today I managed to use atscc2php to generate some PHP code to support
the following service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-trial/inputform.html

It is mostly for fun at this moment. Still, you can use the service to
compile short code, trying to see if there
are type-errors.

Now ATS code can be compiled into JavaScript and then evaluated:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

If you paste the following code into the input form, you should see two
alerts generated:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun fact : int → int = “mac#fact”
implement
fact (n) =
if n > 0 then n * fact(n-1) else 1
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

%{$
//
alert("fact(12) = " + fact(12));
alert("acker(3, 8) = " + acker(3, 8));
//
%} // end of [%{$]On Monday, September 8, 2014 2:32:52 PM UTC-4, gmhwxi wrote:

Now there is a service for generating JavaScript from ATS source:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

For instance, you will get some JS code if you paste the following code
into the input form and submit:

(* ****** ****** )
//
#include
“share/atspre_define.hats”
//
(
****** ****** )
//
#define ATS_DYNLOADFLAG 0
//
staload
“{$LIBATSCC2JS}/SATS/integer.sats”
//
(
****** ****** )
//
extern
fun acker : (int, int) → int = “mac#acker”
//
implement
acker (m, n) =
(
case+
(m, n) of
| (0, ) => n + 1
| (
, 0) => acker(m-1, 1)
| (_, _) => acker(m-1, acker(m, n-1))
)
//
(
****** ****** *)

Naturally, the next step is to get the generated JS code to run in the
browser.

Cheers!

On Monday, September 8, 2014 1:55:04 AM UTC-4, gmhwxi wrote:

Today I managed to use atscc2php to generate some PHP code to support the
following service:

http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-trial/inputform.html

It is mostly for fun at this moment. Still, you can use the service to
compile short code, trying to see if there
are type-errors.