2. Install ATS compiler

This book is not only for reading, but also trying to write some ATS code. To run ATS code on your computer, you need ATS language compiler.

In this chapter, let’s install the ATS language compiler named ATS/Postiats (ATS2).

Please download source codes of the ATS compiler, before read following sub chapters.

2.1. Linux

As an example, ATS2 installation on Debian GNU/Linux is explained here.

First, install some packages needed to install ATS2.

$ sudo apt-get install gcc libgc-dev libgmp-dev make

Next, uncompress the source codes of the ATS compiler, and set some environment variables.

$ tar xf ATS2-Postiats-X.Y.Z.tgz
$ export PATSHOME=`pwd`/ATS2-Postiats-X.Y.Z
$ export PATH=${PATSHOME}/bin:${PATH}
$ tar xf ATS2-Postiats-contrib-X.Y.Z.tgz
$ export PATSHOMERELOC=`pwd`/ATS2-Postiats-contrib-X.Y.Z

Finally, compile the ATS compiler.

$ cd ${PATSHOME}
$ ./configure
$ make

2.2. Windows

Installing ATS2 on Windows needs Cygwin that should be installed by setup-x86.exe or setup-x86_64.exe program.

First, install following packages needed to install ATS2 with running setup-x86.exe or setup-x86_64.exe again.

  • gcc-core
  • libgc-devel
  • libgmp-devel
  • make

Next, uncompress the source codes of the ATS compiler on Cygwin console, and set some environment variables.

$ tar xf ATS2-Postiats-X.Y.Z.tgz
$ export PATSHOME=`pwd`/ATS2-Postiats-X.Y.Z
$ export PATH=${PATSHOME}/bin:${PATH}
$ tar xf ATS2-Postiats-contrib-X.Y.Z.tgz
$ export PATSHOMERELOC=`pwd`/ATS2-Postiats-contrib-X.Y.Z

Finally, compile the ATS compiler.

$ cd ${PATSHOME}
$ ./configure
$ make

2.3. Mac OS X

First, set up Homebrew and install some packages needed to install ATS2.

$ brew install gmp bdw-gc

Next, uncompress the source codes of the ATS compiler, and set some environment variables.

$ tar xf ATS2-Postiats-X.Y.Z.tgz
$ export PATSHOME=`pwd`/ATS2-Postiats-X.Y.Z
$ export PATH=${PATSHOME}/bin:${PATH}
$ tar xf ATS2-Postiats-contrib-X.Y.Z.tgz
$ export PATSHOMERELOC=`pwd`/ATS2-Postiats-contrib-X.Y.Z

Finally, compile the ATS compiler.

$ cd ${PATSHOME}
$ ./configure
$ make GCFLAG=-D_ATS_NGC