2009-05-20
Post date: May 20, 2009 7:04:17 PM
- Compiling and running ATS programs.
- ATS compiles .dats into C code, then invokes GCC to compile the C code to executable.
- ATS is installed on csa2, under /usr/local/ats-lang-anairiats-0.1.4
- Need to set ATSHOME environment variable to point to where ATS is installed.
- See attached atscc shell script for a wrapper. Remember to chmod +x atscc to make it executable.
- Downloading ATS code from course web page.
- filename.dats actually link to filename_dats.html, which shows highlighted syntax.
- Change the URL from filename_dats.html to filename.dats will download the ATS code, not HTML.
- For example, code-2009-05-19.dats links to code-2009-05-19_dats.html, but change the link to http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Summer09/code/code-2009-05-19.dats will give you the source code.
- Printf works like C printf, but is type checked. The error message looks like this: the needed type is vararg, the actual type is ... . Not perfectly informative, but vararg helps pointing out it's an error involving the format string.
- There is a difference between '(x1, x2, ..., xn) and @(x1, x2, ..., xn) tuples.
- To use rational module, add the lines:
- staload "rational.sats" dynload "rational.dats"
- to your code, and pass rational.dats, rational.sats, and your source code file to atscc.
- Implemented print_rat, sub_rat_rat, and mul_rat_rat in rational.dats (see attachment).
- To compile the code, make sure you pass both rational.dats and rational.sats to the command line to atscc.