Part of the reason is that you saw a lot of macros in the C output.
Following is the JS output converted from the C output for the Hello
example.
A lot less scary, right
/*
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2014-12-14: 14h:17m
*/
function
hello()
{
//
// knd = 0
//
// __patsflab_hello
ats2jspre_print_string(“Hello, world!”);
return/_void/;
} // end-of-function
// dynloadflag_init
var _057_tmp_057_patsopt_ccats_OLjWLU__dynloadflag = 0;
function
_057_tmp_057_patsopt_ccats_OLjWLU__dynload()
{
//
// knd = 0
//
// ATSdynload()
// ATSdynloadflag_sta(_057_tmp_057_patsopt_ccats_OLjWLU__dynloadflag(14))
if(ATSCKiseqz(_057_tmp_057_patsopt_ccats_OLjWLU__dynloadflag)) {
_057_tmp_057_patsopt_ccats_OLjWLU__dynloadflag = 1 ; // flag is set
hello();
} // endif
return/_void/;
} // end-of-function
function
my_dynload()
{
//
// knd = 0
//
_057_tmp_057_patsopt_ccats_OLjWLU__dynload();
return/_void/;
} // end-of-function
/* ATSextcode_beg() */
// COMMENT_line
ats2jspre_the_print_store_clear();
my_dynload();
alert(ats2jspre_the_print_store_join());
// COMMENT_line
/* ATSextcode_end() */
/* ****** ****** */
/* end-of-compilation-unit */On Sunday, December 14, 2014 3:53:36 AM UTC-5, Raoul Duke wrote:
is, well, kind of scary. (I have similar feelings of scaryness when I
use haxe to generate other languages as back-end output.)
Do people really have success using GDB on the resulting C to debug
their original ATS program? I’d be a little more comfortable with the
whole “just shut your eyes and pretend C is assembly that you
hopefully will never have to look at as if your life depended on it”
if there were a debugger at the ATS source level.
(I realize that many functional languages often lack a source level
debugger. Though, even Haskell got some debugging work from Neil
Mitchell I think. ML has either PolyML’s debugger, or the Ocaml or F#
route. JVM-targeted languages tend to have debuggers I guess.)
thanks.