# An example of porting ATS code

**URL:** <https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423>\
**Category:** Google Group\
**Created:** [March 29, 2014, 7:53pm UTC](https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423 "2014-03-29T19:53:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [March 29, 2014, 7:53pm UTC](https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423/1 "2014-03-29T19:53:51Z")

</div>

The following gzipped tarball contains a solution to Assignment 8 in a  
course  
I am teaching  
([http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html](http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html)):

[http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz](http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz)

The C files in the tarball are generated from some ATS source. You need  
GTK±2.0 and libgc to compile it:

make all\_ported

I encourage you to give it a try.

My ATS source uses some ATS library code that are yet not publicly  
available. However, the generated C  
code can be compiled as long as ATS-includes and ATS-contrib-includes are  
available. While this is anticipated,  
seeing it as a reality is still quite exciting 🙂

Cheers!

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [March 30, 2014, 6:33am UTC](https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423/2 "2014-03-30T06:33:42Z")

</div>

I was using tcc-0.9.25.

With tcc-0.9.26, the code can be compiled successfully!On Saturday, March 29, 2014 6:01:34 PM UTC-4, gmhwxi wrote:

> Unfortunately, the code generated by tcc crashes ☹
> 
> On Saturday, March 29, 2014 5:52:45 PM UTC-4, gmhwxi wrote:
> 
> > By the way, I just used TinyCC (tcc) to compile the C code in the tarball:
> > 
> > make PATSCC=tcc CC=tcc MYCCRULE=PORTABLE -f Makefile
> > 
> > It is really lightening fast!
> > 
> > Maybe this opens an avenue to using ATS as a scripting language 🙂
> > 
> > On Saturday, March 29, 2014 3:53:51 PM UTC-4, gmhwxi wrote:
> > 
> > > The following gzipped tarball contains a solution to Assignment 8 in a  
> > > course  
> > > I am teaching (  
> > > [http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html](http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html)):
> > > 
> > > [http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz](http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz)
> > > 
> > > The C files in the tarball are generated from some ATS source. You need  
> > > GTK±2.0 and libgc to compile it:
> > > 
> > > make all\_ported
> > > 
> > > I encourage you to give it a try.
> > > 
> > > My ATS source uses some ATS library code that are yet not publicly  
> > > available. However, the generated C  
> > > code can be compiled as long as ATS-includes and ATS-contrib-includes  
> > > are available. While this is anticipated,  
> > > seeing it as a reality is still quite exciting 🙂
> > > 
> > > Cheers!

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [March 29, 2014, 10:01pm UTC](https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423/3 "2014-03-29T22:01:34Z")

</div>

Unfortunately, the code generated by tcc crashes :(On Saturday, March 29, 2014 5:52:45 PM UTC-4, gmhwxi wrote:

> By the way, I just used TinyCC (tcc) to compile the C code in the tarball:
> 
> make PATSCC=tcc CC=tcc MYCCRULE=PORTABLE -f Makefile
> 
> It is really lightening fast!
> 
> Maybe this opens an avenue to using ATS as a scripting language 🙂
> 
> On Saturday, March 29, 2014 3:53:51 PM UTC-4, gmhwxi wrote:
> 
> > The following gzipped tarball contains a solution to Assignment 8 in a  
> > course  
> > I am teaching (  
> > [http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html](http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html)):
> > 
> > [http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz](http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz)
> > 
> > The C files in the tarball are generated from some ATS source. You need  
> > GTK±2.0 and libgc to compile it:
> > 
> > make all\_ported
> > 
> > I encourage you to give it a try.
> > 
> > My ATS source uses some ATS library code that are yet not publicly  
> > available. However, the generated C  
> > code can be compiled as long as ATS-includes and ATS-contrib-includes are  
> > available. While this is anticipated,  
> > seeing it as a reality is still quite exciting 🙂
> > 
> > Cheers!

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [March 29, 2014, 9:52pm UTC](https://discourse.ats-lang.org/t/an-example-of-porting-ats-code/423/4 "2014-03-29T21:52:45Z")

</div>

By the way, I just used TinyCC (tcc) to compile the C code in the tarball:

make PATSCC=tcc CC=tcc MYCCRULE=PORTABLE -f Makefile

It is really lightening fast!

Maybe this opens an avenue to using ATS as a scripting language :)On Saturday, March 29, 2014 3:53:51 PM UTC-4, gmhwxi wrote:

> The following gzipped tarball contains a solution to Assignment 8 in a  
> course  
> I am teaching (  
> [http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html](http://www.cs.bu.edu/~hwxi/academic/courses/Spring14/CS320.html)):
> 
> [http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz](http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring14/assignments/08/Wormlike-BF-solution.tgz)
> 
> The C files in the tarball are generated from some ATS source. You need  
> GTK±2.0 and libgc to compile it:
> 
> make all\_ported
> 
> I encourage you to give it a try.
> 
> My ATS source uses some ATS library code that are yet not publicly  
> available. However, the generated C  
> code can be compiled as long as ATS-includes and ATS-contrib-includes are  
> available. While this is anticipated,  
> seeing it as a reality is still quite exciting 🙂
> 
> Cheers!
