Support for tail-call optimization in atscc2erl and atscc2scm

18 views
Skip to first unread message

gmhwxi

unread,
Jul 13, 2016, 7:27:24 PM7/13/16
to ats-lang-users

I took some time to improve atscc2erl and atscc2scm.
Now they both support code generated from patsopt when
tail-call optimization is turned on. Currently, mutually defined
tail-recursive functions are required to have the same number
arguments (in order for this support to work properly):

fnx        
loop0
(_: int, _: int): int = loop1(0, 0)                
and            
loop1
(x: int, _: int): int = loop2(x, 0)            
and
loop2
(x: int, y: int): int = if x > 0 then loop2(x-1, y+y) else y

All of this work is preparation for atscc2clj, which compiles to Clojure.

Raoul Duke

unread,
Jul 14, 2016, 2:50:46 AM7/14/16
to ats-lang-users
nice!
Reply all
Reply to author
Forward
0 new messages