Miscellaneous topics related to ATS-Postiats¶
Setting of Environment¶
Please follow the instructions on ATS’ website to install ATS-Postiats as well as
ATS2-contrib. Here I just want to emphasize the setting of environment
variables PATSHOME as well as PATSHOMERELOC. These two variables should be
set in the environment before invoking the ATS compiler (patscc or patsopt).
Also they are commonly referred in Makefile used in ATS projects. The first
one (PATSHOME) should be set to the directory where ATS is installed. Normally I just
download tarball for the source of ATS, decompress it, build ATS, and use
built executables. (Simply put, I don’t do make install
.)
Therefore I just set PATSHOME to the folder resulting from
decompressing the tarball. PATSHOMERELOC should be set to the folder
resulting for decompress the tarball for ATS2-contrib. Also the PATH
variable should be set accordingly so that system can locate the compiler of
ATS. Normally, I put these settings into one script file, say pats.xxx.sh.
Then I do source pats.xxx.sh
when I open a terminal for the first time.
My pats.xxx.sh looks like the following:
# Script for setting environment for ATS-Postiats
PATSHOME=${HOME}/programs/ats2/ATS2-Postiats-0.0.8; export PATSHOME
PATSHOMERELOC=${HOME}/programs/ats2/ATS2-Postiats-contrib-0.0.7; export PATSHOMERELOC
PATH=${PATSHOME}/bin:${PATH}; export PATH
If you use make install
to install ATS at the system level, your script would probably be
like the following:
# Script for setting environment for ATS-Postiats
PATSHOME=/usr/local/lib/ATS2-Postiats-0.0.8; export PATSHOME
PATSHOMERELOC=${HOME}/programs/ats2/ATS2-Postiats-contrib-0.0.7; export PATSHOMERELOC
Note
Since we choose to install ATS at the system level, there’s no need to set PATH.
Standard header files¶
To use the prelude library of ATS, we would include the following code:
#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"
To use the ML library of ATS, we would include the following code:
#include "share/HATS/atspre_staload_libats_ML.hats"
If we want to generate C code used on lower level systems, such as embedded system, we can replace these header files with appropriate ones to fit the targeting platform.
Type conversion¶
Todo
$UNSAFE.cast{natLt(n)}