CS 313 - Installation instructions

As the semester progresses, I will add instructions for installing each of the CS 313 compilers/interpreters for Mac and Windows:


Pascal

We will use "fpc", the Free Pascal Compiler

Mac

Windows

basin

Here’s a sample program to test your installation: hello.p

Save this file, navigate to it in your terminal, and type "fpc hello.p".

This should result in an executable "hello" that you can run.


C

We will use "gcc", the GNU C Compiler.

Mac

gcc --version

xcode-select --install

Windows

choco install mingw

basin

Here’s a sample program to test your installation: hello.c

Save this file, navigate to it in your terminal, and type "gcc -o hello hello.c".

This should result in an executable "hello" that you can run.


Smalltalk

We will use Squeak, an integrated development environment for Smalltalk. You can download Squeak via the buttons near the top of the main Squeak page.

Mac

Windows

basin / Linux


If you start Squeak you should get an environment with a few windows open. See Lecture 10 for a quick intro.

If you want to get a head start, check out Squeak by Example. (See if you can figure out to make it print Hello World! :)


Ruby

We are only taking a brief look at Ruby, so installing it is optional. (You can also run Ruby in your browser.)

To install Ruby on your computer:

Mac

Windows

basin / Linux


Scheme

We will use DrRacket to program in Scheme. More precisely we will program in Racket, which was derived from Scheme and supports several different language flavors. We will stick with the basic Racket language, however, which only has minor differences to Scheme.

To install DrRacket, go to the Racket download page and follow the instructions, which should work for both Mac and PC. Use the default settings – Distribution: Racket and Variant: Regular. This will take a fair bit of space, about 500MB… If you are low on disk space you can try the "Minimal Racket" distribution but this will likely require additional steps to download packages which I haven’t tried.

Once installed, be sure to start the DrRacket app (not Racket or GRacket). You should get a window with two panes. The top pane is for "Definitions", i.e., it’s the editor where you will be defining your functions. The bottom pane is for "Interactions", where you see printed output and also get an interactive prompt.

The first time you start DrRacket, click on "Choose Language" at the bottom and select the first option, "The Racket Language". This will put the line

#lang racket

at the top of your Definitions, which always needs to be the first line in any of your Scheme programs.

Underneath this line, try typing

(display "hello world")

and click on Run at the top. You should see the output in the bottom pane. Next, try typing an expression like

(+ 3 4)

at the interactive prompt in the bottom pane.

You’re ready to go!

Note: when saving your code (from the top pane), use the default extension .rkt. Make sure you don’t have any special characters (like fractions, images, or lambda) in you file, otherwise it will not save your code in plaintext.

basin


ML

We will use "SML/NJ", Standard ML of New Jersey

Mac

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

brew cask install smlnj

sudo ln -s /usr/local/smlnj/bin/sml /usr/local/bin/sml

brew install rlwrap

Windows

basin

If you use Atom as your text editor, you can install the package language-sml.


Prolog

We will use SWI-Prolog

Mac

brew install swi-prolog

Windows

basin

If you use Atom as your text editor, you can install the package language-prolog.

To test loading a file, save family.pl in a folder, e.g. cs313/prolog/. On a Mac, navigate to this folder and type "swipl"; on a PC double-click on the file. At the prompt, type "[family]." It should respond "true."


Haskell

You can get Haskell from haskell.org. Try typing Haskell expressions in the purple box right on the main web page!

If you have enough disk space, install the Haskell Platform

Mac

Windows

basin

Start the interactive Haskell prompt by typing ghci



























































.