The Sway Programming Language

written by: John C. Lusth

Revision Date: September 30, 2010

Printable Version

Sway is a nifty little language that seems quite large. It has a C-like syntax (sans types) and is...

...all at the same time!

Downloads

Latest Sway versions:

sway_1.0.6e-1_i386.tgz
sway_1.0.6e-1_amd64.tgz
 
sway_1.0.6e-1_i386.deb
sway_1.0.6e-1_amd64.deb

Here is an experimental Microsoft Windows version: sway.exe. You will also need readline5.dll and history5.dll. Copy all three files to:

    c:\windows\system32

and you should be good to go. You will need to run Sway in a DOS box (command prompt).

If you want to use the set of Sway libraries (useful functions written in Sway) but don't know how to set up a path on Windows, install the libraries in same directory as your program, if you want to use any of them.

Sway versus other languages

For Java, C, and C++ programmers, here is a list of important differences: quick hits.

Installation Notes

To install Sway from a deb package (using sway_1.0.6e-1_i386.deb as an example), run the command:

    sudo dpkg -i sway_1.0.6e-1_i386.deb

If you are on a system without sudo, run the above command as root without the sudo prefix.

To install Sway from a tarball, perform the following steps (using sway_1.0.6e-1_i386.tgz as an example)...

  1. Save the download to a file
  2. Untar the download:
        tar zxvf sway_1.0.6e-1_i386.tgz
    
  3. Change to the untarred directory:
        cd sway_1.0.6e-1_i386
    
  4. Install the Sway executable and library file:
        make install
    

The install command assumes you have admin privileges. On a Linux distribution that uses sudo, you would run the comand:

    sudo make install

If you do not have root privileges, then copy sway to someplace in your path (usually your personal bin directory) and install the library files in a suitable place. If the library files go somewhere other than /usr/lib/sway or /usr/local/lib/sway, you will need to set an environment variable named SWAY_LIB to point to the alternate location.

If you have trouble installing Sway, send a message to lusth@cs.ua.edu.

Learning more about Sway

There is an Open Source introductory Computer Science textbook that uses Sway as the teaching language. It is called The Calculus of Programming and teaches about Computer Science using Calculus as the backdrop for programming examples and exercises. The goal is to give a gentle, but rigorous, introduction to both Computer Science and Calculus, before students take traditional classes on those subjects.

There is also a companion guide, The Sway Reference Manual. The reference manual is more nuts and bolts on the syntax and semantics of Sway.

About this website

This website is rendered in the Old School style. Old School is known for its somewhat spartan, but clean and crisp, no-nonsense, get-down-to-brass-tacks appearance. Old School was invented by Tim Berners-Lee during the latter part of the last century.

Acknowledgements

This material is based upon work supported by the National Science Foundation, grant numbers #00244269 and #0633290.

Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author and do not necessarily reflect the views of the National Science Foundation.

lusth@cs.ua.edu


lusth@cs.ua.edu