Download & Install
Pug is the interpreter for PUGofer, a teaching language built on Gofer 2.30a. Everything below is a ready-made program: there is nothing to compile and nothing else to install. Pick your machine, follow three short steps, and you will be running code in a couple of minutes.
Choose the file that matches your computer. If you are not sure whether your Windows or Linux machine is 32-bit or 64-bit, the file below is the right one either way.
Every download contains the same four files: the
pug program itself, plus three prelude files named
pustd.pre, pusimple.pre and
pucc28.pre. Keep all four together in one folder.
Pug looks for pustd.pre in the folder you are
currently in, not the folder the program lives in. The simplest
approach is to move into that folder before starting it. If you
would rather start Pug from anywhere, see
running Pug from any folder.
There is no installer to run. Installing means unzipping the folder somewhere you can find again, then starting the program from a terminal.
Windows
pug_windows.zip using the button above.C:\pug.
Win+R, type cmd and
press Enter to open a Command Prompt.
cd C:\pug
pug.exe
Windows may show a blue Windows protected your PC box, because this program is not code-signed. Click More info, then Run anyway. This is expected for small independent programs and does not mean anything is wrong.
Linux
pug_linux.zip using the button above.~/Downloads), then unzip it and mark the program
runnable:
cd ~/Downloads
unzip pug_linux.zip -d pug
cd pug
chmod +x pug
./pug
Nothing else needs to be installed. The line editor is built into the program, so there are no libraries to add. You need glibc 2.29 or newer, which means Ubuntu 20.04 or later, Debian 11 or later, or RHEL, Rocky and Alma 9 or later.
macOS
pug_macos.zip using the button above.cd ~/Downloads/pug_macos
xattr -d com.apple.quarantine pug
chmod +x pug
./pug
The xattr line is needed because macOS refuses to run
downloaded programs that are not signed by a registered Apple
developer. Without it you will see a message saying the program
cannot be opened.
This build is for Apple Silicon Macs, meaning M1, M2, M3 and M4. Intel Macs are not supported.
When Pug starts it prints a banner, loads the standard prelude and
shows a ? prompt. That prompt is where you type.
Gofer Version 2.30a
Modifications for pugofer Rusi Mody
Copyright (c) Mark P Jones 1991-1994
Copyright (c) Rusi P Mody 1995-2016
Gofer session for:
pustd.pre
?
Type an expression, press Enter, and Pug prints the answer together
with its type. Type :quit to leave.
PUGofer does not use a space to apply a function to its argument. You must write a dot between them. This is deliberate: it makes the structure of an expression explicit.
| Write this | Not this |
|---|---|
length . "hello" |
length "hello" |
sum . [1,2,3,4,5] |
sum [1,2,3,4,5] |
map . (*2) . [1,2,3] |
map (*2) [1,2,3] |
If you see ERROR: Juxtaposition has no meaning. Use .
then you have left out a dot. Ordinary arithmetic needs no dot at
all: 2+3*4 just works.
A complete short session looks like this:
? length . "hello"
5 : Int
? sum . [1,2,3,4,5]
15 : Int
? map . (*2) . [1,2,3]
[2, 4, 6] : [Int]
? 2+3*4
14 : Int
? :quit
[Leaving Gofer]
By default Pug looks for pustd.pre in whichever folder
you started it from, which is why the steps above tell you to move
into the unzipped folder first. If you would rather start Pug from
anywhere, set the PUGOFER environment variable to the
full path of the prelude file. When it is set, Pug loads that file
instead of searching the current folder.
To try it for a single command:
PUGOFER=~/Downloads/pug/pustd.pre ~/Downloads/pug/pug
To make it permanent, add these two lines to ~/.bashrc,
or to ~/.zshrc if you use zsh, then open a new terminal.
The second line lets you type just pug from anywhere.
export PUGOFER="$HOME/Downloads/pug/pustd.pre"
export PATH="$HOME/Downloads/pug:$PATH"
Run this once in Command Prompt, then close the window and open a
new one. setx saves the setting permanently, but it only
takes effect in Command Prompt windows opened afterwards.
setx PUGOFER "C:\pug\pustd.pre"
When it is working, the startup banner shows the full path it loaded rather than a bare filename:
Gofer session for:
/home/you/Downloads/pug/pustd.pre
?
PUGOFER chooses which prelude is loaded, not
just where it lives. Point it at pusimple.pre or
pucc28.pre instead of pustd.pre to start
with one of the other two preludes included in the download.
FATAL ERROR: Unable to load preludeThe whole message looks like this:
ERROR "pustd.pre": Unable to open file
FATAL ERROR: Unable to load prelude
Pug could not find pustd.pre. This is the most common
problem by far, and it means you started Pug from a folder other
than the one holding the unzipped files. Either move into that
folder first, or set the PUGOFER environment variable as
described under
running Pug from any folder.
ERROR: Attempt to redefine syntax of operator
You passed a prelude file on the command line, as in
./pug pustd.pre. Pug already loads it by itself. Start it
with no arguments: just ./pug, or
pug.exe on Windows.
version `GLIBC_2.29' not foundYour distribution is older than this build supports. You need Ubuntu 20.04 or later, Debian 11 or later, or RHEL, Rocky or Alma 9 or later.
bash: ./pug: Permission denied
The runnable flag was not set. Run chmod +x pug in the
folder, then try again.
The quarantine flag is still set. Run
xattr -d com.apple.quarantine pug in the folder holding
the file.
9eea2ac3cd59a4a5863927db8d27228430fe0c5f48ab1315db04a7446875beee pug_linux.zip
14637772b1f54e52eff1f7a60d2cd4d2b5c0b7567ae40177c30e704c9e9765b8 pug_macos.zip
252bff23ca1fd9917d27dba09446d8ac88019352d5aaafb56947e91ec9b74d57 pug_windows.zip
Check one with sha256sum pug_linux.zip on Linux,
shasum -a 256 pug_macos.zip on macOS, or
certutil -hashfile pug_windows.zip SHA256 on Windows.