Teaching‎ > ‎CS320 Summer I 2009 TF‎ > ‎

2009-05-20

posted May 20, 2009, 12:04 PM by Site Admin Role   [ updated May 26, 2009, 8:37 AM ]
  • 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.
  • 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.

ċ
atscc
(0k)
Site Admin Role,
May 20, 2009, 12:20 PM
ċ
main.dats
(0k)
Site Admin Role,
May 20, 2009, 12:21 PM
ċ
rational.dats
(1k)
Site Admin Role,
May 20, 2009, 12:20 PM
ċ
rational.sats
(0k)
Site Admin Role,
May 20, 2009, 12:20 PM
Comments