POPLOG INFORMATION

# POPLOG
A multi-language interactive software development environment

Note: "Poplog" is a trade mark of the University of Sussex.

## INTRODUCTION

Much of this file is the style of a Unix man file. It is derived from the man file distributed with Poplog. More detailed information about Poplog can be found at http://www.cs.bham.ac.uk/research/poplog/poplog.info.html

Poplog includes the incrementally compiled (not interpreted) core language Pop-11, and various additional incrementally compiled languages: Prolog, Common Lisp, and Standard ML. Various combinations of the languages, with pre-compiled libraries, are provided as saved images. There are two main modes of starting up one of these saved images, either by running the language system, or by starting up the editor with the language system enabled.

When starting up there are two types of shell commands, depending on whether you have set up the Poplog environment variables or not. If you have not, you can run the generic command "poplog" followed by arguments specifying what exactly you want to run. If you have set up the environment variables (as explained below) you can then directly run the relevant executables, without running the "poplog" command.

These two types of shell commands are now explained.

## SYNOPSIS (1)

The following commands will work if the "poplog" startup script has been installed at your site.

- poplog pop11 [ +saved-image ... ] [ argument ... ] [ :command ]
- poplog xved [ filename ]
- poplog ved [ filename ]
- poplog prolog [ -|+saved-image ]
- poplog clisp [ -|+saved-image ]
- poplog pml [ -|+saved-image ]

## SYNOPSIS(2)

At some sites, e.g. Birmingham, there is a setup command that sets environment variables, so that the following commands will work, after "setup Poplog" at Birmingham or, in some other places,
"source ...poplog/local/setup/bin/poplog", provided that you are running csh or tcsh as your shell):

- pop11 [ +saved-image ... ] [ argument ... ] [ :command ]
- xved [ filename ]
- ved [ filename ]
- prolog [ -|+saved-image ]
- clisp [ -|+saved-image ]
- pml [ -|+saved-image ]

## DESCRIPTION

Poplog is an integrated, interactive, multi-language software development environment. It used to be an expensive commercial product (and by about 1992 total sales were over 5 million dollars). Since July 1992 it has been freely available, including system sources, from this site:

http://www.cs.bham.ac.uk/research/poplog/freepoplog.html
which is partly mirrored at http://www.poplog.org a site developed and mained by two freelance programmers who use Pop-11.

Poplog provides incremental compilers for several powerful languages: POP-11, PROLOG, COMMON LISP and ML. A Poplog-based incremental compiler for Scheme is also available.

Features include a powerful extensible text editor (Ved) which can also be run as a multi-window editor (XVed). There are many hundreds of online documentation files, tailored for use in Ved, or a programmable editor such as Emacs. On Unix/Linux systems there is an interface to the X window system (providing control panels and graphical capabilities). There are also many demonstration and utility libraries including an object oriented extension to Pop-11 known as Objectclass, compiler-building tools, and mechanisms for dynamically linking PASCAL, FORTRAN and C programs so that they can be called from Poplog.

Since the early 1980s Poplog has included a sophisticated interface, initially based on Sunview then replaced by the X Window System, with facilities for dynamically linking in widget sets (e.g. Motif or Poplog's own X widget set). It can handle toolkit events, and supports remote access to Poplog via X terminals, workstations or a PC running eXceed or linux. It is possible to sit at a terminal supporting X, and interact with Poplog graphical facilities running on a machine on another continent.

On systems that include Motif the default Poplog interface tools use Motif "widgets", e.g. for menus and file browsers. An alternative user interface, developed in Birmingham, which does not depend on Motif is available from the free poplog site:
http://www.cs.bham.ac.uk/research/poplog/rclib.tar.gz
http://www.cs.bham.ac.uk/research/poplog/rcmenu.tar.gz (At Birmingham these are pre-installed by default.) For some examples of what the graphical tools can do see http://www.cs.bham.ac.uk/research/poplog/figs/rclib/

The use of interface tools based on the X window system makes it possible for a user in one building sitting at a workstation, an X terminal or a PC, to interact with sophisticated programs on a powerful Unix or VMS machine in another building, as if using a very powerful graphical workstation on one's desk. Poplog supported such interaction long before the world wide web.

Poplog includes the source code for a large number of library packages, which are usually programs that the user can read, copy and modify. These programs are written in Pop-11, Prolog, Lisp and standard ML. The widest variety of utilities and demonstration programs is in Pop-11.

These include many teaching libraries for students of Artificial Intelligence (and more general programming).

## HOW IT WORKS

At the heart of Poplog is the Poplog Virtual Machine. The Poplog compilers translate program text from the source language (e.g. from Pop-11, Prolog, Lisp, ML or a user-defined language) into a sequence of Poplog Virtual Machine (VM) instructions, that are in turn compiled into real machine code instructions for the host machine. Since the compiler is part of the run time system, new procedures can be compiled and added to the system at any time, or old ones recompiled (after which space occupied by the old machine code instructions will be reclaimed by the Poplog garbage collector).

This "incremental compilation" system provides the programmer with a suitable environment for rapid-prototyping, whilst also ensuring efficient code execution. The provision of the Poplog Virtual Machine as a target for compilers simplifies porting of Poplog languages, and programs written using them, to new machines.

Poplog is available on a variety of Unix and VMS platforms, including Sun, Hewlett Packard, Silicon Graphics and Digital Alpha. A version for a PC running Linux or Solaris is also available. Additional Unix/Linux versions may become available at the Free Poplog site.

There is also a version without graphics and with some restricted facilities for a PC running NT, which also works on windows95/98, also accessible at the Free Poplog site.

In addition there is a growing collection of libraries and teaching documentation and software for AI and programming.

The Poplog Virtual Machine provides support for a large variety of datatypes, including linked lists, arrays, strings, integers, `big' integers, floating point numbers, rational numbers, and complex numbers. The Objectclass extension supports Object Oriented proramming with inheritance. Users can define new datatypes. Poplog variables and constants can either be dynamically or lexically scoped, and are weakly typed. It provides trace and debugging facilities supporting rapid prototyping of complex software.

Poplog has a very efficient storage manager, using a mark-and-sweep copying garbage collector, which is automatically replaced by a non-copying algorithm when there is not enough space for copying.

Thus users do not need to worry about reclaiming inaccessible data areas. Pop-11 processes start from about two megabytes in size (including the Pop-11 compiler, the editor VED, and many utilities). Prolog, Lisp or ML require more, but all start in less than about three megabytes. Poplog processes can grow as required, to whatever size the machine and the operating system will allow.

Poplog is far too complex to describe fully in a manual page entry. This document serves only as a pointer to the large amount of on-line documentation that is available within the Poplog environment. More information about Poplog is available at this location:

http://www.cs.bham.ac.uk/research/poplog/poplog.info.html

## EXTENSIONS AVAILABLE

There are several extensions to Poplog available at the Free Poplog site including tools for building graphical interfaces, a powerful collection of programs for analysing images and implementing neural nets, along with teaching documentation, a toolkit for exploring agent architectures, an expert system shell, and the Pop-11 teaching files and program libraries developed at the Universities of Sussex and Birmingham. There are several companies which sell software implemented in Pop-11 or other Poplog languages, most notably the award winning Clementine Data Mining System developed by Integral Solutions Ltd, bought by SPSS in 1998.

## THE LANGUAGE Pop-11

The core language of Poplog is Pop-11. Pop-11 combines the features found in other AI languages like Lisp with a syntax that is similar in form to Pascal or C. Pop-11 code is easy to read, and includes many familiar control structures. For example, the following Pop-11 code prints the word "hello" out five times, including an end of line comment starting ";;;":

        ;;; print hello out five times
        repeat 5 times

            "hello" =>

        endrepeat;

Pop-11 also includes a high level pattern-based syntax for list manipulation. For instance the following declares two variables middle and list, asks the user to type in a line of words to be made into a list of words and assigned to list, then if the user's list starts with "I" and ends with "you" prints out a new list containing the middle bit, between "We" and "each other".

        ;;; declare two variables
        vars middle, list;

        ;;; assign a list of words typed by user to list
        readline() -> list;

        ;;; Check whether to respond
        if list matches [I ??middle you] then
            [We ^^middle each other] =>
        endif;

So if the user types in

        I like talking to you

The program will respond

        ** [We like talking to each other]

Because the syntax of Pop-11 is very readable, it is relatively easy to learn, and has been found to be very effective as a teaching tool, for beginners, whether for general programming or for AI and Cognitive Science students. However, experienced Pop-11 programmers can also make use of rich syntactic structures, and the large numbers of utilities, to write very complex and diverse packages, such as Poplog itself, which is mostly implemented in Pop-11.

Since the editor, the compiler and the debugging tools are all part of the same environment, programmers are saved from the laborious task of switching between editors and compilers, waiting for error messages from the compilers, and switching back to the editor again.

A lot more information about Pop-11 is available in online documentation files accessible when running Poplog and also at the Free Poplog directory, including the Pop-11 primer, at http://www.cs.bham.ac.uk/research/poplog/primer/

Another source of information is at this web site: http://www.poplog.org Files at that site and at the Free Poplog site contain pointers to additional sites with information about Poplog and Pop-11.

## COMMANDS

Commands to run the poplog languages or packages based on them, come in two formats, either preceded by the word "poplog" or not. In the first format, e.g.

        poplog pop11

        poplog xved myfile.p

"poplog" invokes a shell script which sets up a collection of environment variables, then runs the appropriate Poplog program, passing on the arguments.

In the second format, without the word "poplog", users can invoke the Poplog programs directly, provided they have already set up the environment variables, e.g. in the user's .login file. This will be slightly faster than the first format, as well as being less verbose.

The first format is more suitable for the occasional user, though it depends on the poplog shell script being in a directory included in the user's $PATH. If this appears not to be available at your site, contact your system administrator, who should read this man file.

At Birmingham the second format is made available by means of the command:

        setup Poplog

in the user's .login file. Different startup conventions will be available at different sites.

An alternative way to make the system work in the second format is to put a set of commands in your .login file, e.g. something like the following, depending on where the Poplog system and the poplog local directories are located on your machine:

        setenv usepop /usr/local/poplog/v15.53

        setenv poplocal /usr/local/poplog/

        setenv local $poplocal/local

        source $usepop/pop/com/poplog

        setenv poplib ~/poplib

If your login shell is bash, or ksh, or sh, then you will need the following instead in your .profile file:

        usepop=/usr/local/poplog/v15.53

        poplocal=/usr/local/poplog/

        local=$poplocal/local

        export usepop poplocal local

        . $usepop/pop/com/poplog.sh

        poplib=$HOME/poplib

        export poplib

The last command can be changed to specify the location where you would like to install your personal poplog startup files, init.p, vedinit.p, init.pl, init.lsp, init.ml and other pop-11 files.

## SUMMARIES OF AVAILABLE COMMANDS

In the sections below, the second format is given. Each example can be preceded with the word "poplog" to run in the first format if the poplog startup shell script has been installed in one of your local executable directories on your $PATH search list.

### pop11

Loads the default Poplog system, with only the Pop-11 compiler.

### ved

First loads the default Poplog system, with the Pop-11 compiler, and then loads the Poplog editor, Ved. This command can take one argument (a filename) that is passed to Ved as the name of the initial file to edit.

### xved

As above, but starts the multi-window version of Ved. It can also be given a file name as argument, to cause it to start with that file's contents in the editor buffer.

The following two formats are equivalent:

### prolog,
pop11 +prolog

First loads the default Poplog system, with the Pop-11 compiler, and then starts the Prolog compiler (provided pre-compiled within a saved image).

### clisp
pop11 +lisp

First loads the default Poplog system, with the Pop-11 compiler, and then starts the Common Lisp compiler (provided as a saved image).

### pml,
pop11 +pml

First loads the default Poplog system, with the Pop-11 compiler, and then starts the Standard ML compiler.

It is possible to have additional saved images that start up XVed with two of the language compilers installed. For instance in Birmingham there is a saved image that allows the following

### pop11 +xvedpro

First loads the default Poplog system, with the Pop-11 compiler, and then loads a saved image with prolog precompiled and then starts up the multi-window editor Xved. If given an additional argument which is the name of a file, it will read that file into Xved.

Sample shell scripts for building saved images can be found in the directory $usepop/pop/com and also in this directory http://www.cs.bham.ac.uk/research/poplog/image-scripts

## OPTIONS

For more information on Poplog parameter passing, see the Poplog help file HELP PARAMETERS, or the more detailed specification in REF SYSTEM. The following are among the options which may be combined with the pop11 command to affect the way it starts up.

### +saved-image ...

Loads the Poplog environment and then looks for the specified Poplog saved image. Poplog will search the directories specified in $popsavepath, and in the current directory. The suffix .psv is added to the filename if no suffix is specified. Several incremental saved images can be loaded using the "+saved-image" form. Additional arguments specified using the "-" flag will be passed into the Poplog environment. By default, such arguments are ignored, although the programmer may wish to define interpretations for them. If this option is given the :command option (described below) must be omitted. For more information about saved images and parameter options, see REFSYSTEM.

### :command

Loads the Poplog environment, and then executes the Pop-11 instruction command. E.g. this will cause pop-11 to start up print the square root of 99, then exit

        pop11 ":sqrt(99)=>"

### ved filename

Loads the Poplog environment, sets up the editor (Ved), and reads filename into a ved buffer, ready for editing.

### xved filename

As above, but starts the multi-window version of the editor XVed.

### %x

If this optional parameter is provided, it causes Pop-11, or Prolog, or Lisp or Pml to start up with a control panel providing menu options, and causes the editor to invoke the X window version with multiple windows.

## Other commands that may be available include:

### eliza

loads and runs the demo program Eliza (if available).

## POPLOG INITIALIZATION

Poplog uses environent variables to store information about the location of files, defaults and documentation. These variables are usually initialized using a shell script. For details see your local system administrator or the Poplog files that may be viewed in Ved by giving these commands (followed by the Page Down key to read on):

        poplog help initial
        poplog help initial.ex
        poplog ref system

The first file explains how to use initialization files, such as init.p, vedinit.p, init.pl, init.lsp, and init.ml. Default scripts reside in the pop/com directory of the Poplog tree. These scripts are usually executed as part of the user's .login script. There may be additional "local" startup scripts at your site, e.g. in $poplocal/local/com/poplog and $poplocal/local/com/popenv

As explained above, a typical login script sourced from the .login directory of a user whose login shell is csh or tcsh might contain the following:

        setenv usepop /usr/local/poplog.v15.53 (or whatever)

        source $usepop/pop/com/poplog

It might also set the environment variable $poplib, for the directory containing the user's startup files (e.g. init.p, vedinit.p) and possibly also the variable $poplocal, which defines where the local extensions to poplog are kept. For a user of bash, ksh or sh alternative commands, given above, could be used in the .profile file.

## LOCAL ARRANGEMENTS

(This section may need to be re-written for your site.)

At Birmingham, Poplog is available on the school of Computer Science Sun network, and also on the Digital (Compaq) Alpha servers run by the central Information Service. In the School of Computer science Poplog users should include, in their .login files the line

        setup Poplog

Users of the Alpha Servers at Birmingham (e.g. isdugp, isdugi) should include in their .profile files the command

        . /bham/global/poplogin.ksh

Poplog initialization often prints out a message giving the Poplog version, and adds the Poplog executables to the users PATH.

Sites elsewhere wishing to obtain the facilities used at Birmingham can fetch various packages from the Free Poplog site, e.g. http://www.cs.bham.ac.uk/research/poplog/bhamteach.tar.gz and other things in the same directory.

For more information, contact your system administrator, or see the User Guide, or the online information in

        poplog help initial

## ENVIRONMENT VARIABLES

### $usepop

Holds the path to the root of the Poplog directory tree.

### $poplocal

Holds the path to the root of the Poplog local tree. This is used to store site-specific libraries and documentation. Since by convention all the local libraries are in a subdirectory called local/ in the $poplocal/ directory, you may find it convenient to define an environment variable called $local, equivalent to $poplocal/local.

### $popcom

Set to $usepop/pop/com. This directory holds several csh(1) scripts for making default saved images, and setting up the poplog environment.

### $popsrc

Set to $usepop/pop/src. This directory contains the sources for the Poplog environment, if provided. The sources may be in object file form.

### $popsys

Set to $usepop/pop/pop. Contains the Poplog executable commands, including pop11, prolog, pml, clisp.

### $popautolib, $poplocalauto

Set to $usepop/pop/lib/auto and $poplocal/local/auto respectively. These are used for autoloadable libraries. The compiler searches these directories when it is trying to evaluate an undefined identifier. If a file is found with the same name as the identifier (with '.p' as suffix), it is compiled. This enables the Poplog environment to be invisibly extended, whilst conserving memory usage for those who do not use the utility named by the identifier.

### $poplocalbin

Directory containing local saved images.

### $popliblib, $popdatalib, $poppwmlib, $popsunlib, $popvedlib

Set to directories containing library packages for Pop-11, Pwm, Sun consoles and Ved.

### $popsavelib

Set to $usepop/pop/psv. This directory contains some standard saved images, including the Prolog, Lisp and ML saved images.

### $popsavepath

Lists of directories containing Poplog saved images. Users may add paths to directories containing their own saved images. By default, this is set to $poplib:$poplocalbin:$popsavelib.

### $poplib

User definable. Holds the path to the user's own library directory. It is possible for two or more users to share such a directory if they wish. Poplog will look in this directory for saved images and initialization files (see below).

### $pop_{name}

When Poplog is executed, it checks the name of the command that it was executed by (ie. argv[0]). If this command was not "pop11", Poplog looks for an environment variable starting with "pop_" and ending with argv[0]. If such a variable exists, Poplog treats the contents of the variable as the arguments to Poplog. This is a convenient way of making new commands. To make a command myved, which loads pop11 with the saved image called myved.psv, make a symbolic link between $popsys/pop11 and myved, and set the environment variable pop_myved to "+myved":

        ln -s $popsys/pop11 myved

        setenv pop_myved +myved

## FILES

- $poplib/init.p
  After Poplog is loaded, the Pop-11 code in this file is compiled. Users can use this file to define useful procedures and variables to tailor the Poplog environment to their own tastes, e.g. whether the variable pop_debugging is true or false by default.

- $poplib/vedinit.p
  This Pop-11 file is compiled when the Ved editor is evoked. Users can write programs to tailor the operation of Ved, so that for example it behaves sensibly when different terminals are being used. This file can also be used to define extra VED commands, or to modify the default actions that Ved takes when a new file is edited (see HELP VEDFILETYPES, HELP VEDVEDDEFAULTS).

- $poplib/init.pl
  A file containing PROLOG code that is compiled when Poplog is loaded with the PROLOG compiler.

- $poplib/init.lsp
  A file containing LISP code that is compiled when Poplog is loaded with the LISP compiler.

- $poplib/init.ml
  A file containing ML code that is compiled when Poplog is loaded with the ML compiler.

All of the above files are optional. If Poplog does not find them in the $poplib directory, it searches the current directory.

## BUGS

The Poplog help file HELP NEWS provides the latest information on problems and changes in Poplog. Problems should be notified by posting queries and comments to the comp.lang.pop news group, or by writing to the pop-forum@cs.bham.ac.uk email list.

Lists of known bugs and some bug fixes can be found at this site: http://www.cs.bham.ac.uk/research/poplog/bugfixes/

## A PICTURE OF HOW POPLOG FITS IN TO AN OPERATING SYSTEM

## Useful Poplog HELP files:

If you have a working poplog installation you may find these files useful

HELP INITIAL, DOC SYSPEC, HELP POPLOG, TEACH TEACH, REF SYSTEM

(The primer, mentioned above, also gives information about Pop-11).

There is a lot of tutorial information available at Birmingham in the directory $poplocal/local/teach/, also available externally at http://www.cs.bham.ac.uk/research/poplog/teach/

See also the following Web pages
http://www.cs.bham.ac.uk/research/poplog/poplog.info.html
http://www.poplog.org
http://www.cogs.susx.ac.uk/users/adrianh/poplog.html
http://www.cogs.susx.ac.uk/users/adrianh/pop11.html
http://www.poplog.cs.reading.ac.uk/poplog/

Enthusiastic users often respond to requests for help posted to comp.lang.pop. If the problem involves common lisp, prolog, or ML, copy the file to comp.lang.lisp, comp.lang.prolog or comp.lang.ml as well as to comp.lang.pop.

The FAQ (frequently asked questions) file for the news group and email list can be found at http://www.cs.bham.ac.uk/research/poplog/comp.lang.pop.faq.html

There is also an email list pop-forum@cs.bham.ac.uk which anyone can join by following instructions given in the FAQ file.

## FURTHER INFORMATION

Poplog is the property of the University of Sussex. It is now available free of charge, with full system sources, as explained above. Sussex do not provide support. There is a "copyright notice" included in this file: http://www.cs.bham.ac.uk/research/poplog/new/install.txt

## AUTHOR

Copyright University of Birmingham 2002. All rights reserved.
Copyright University of Sussex 2002. All rights reserved.
This HTML file is derived from the Unix "man" file written by Jonathan Meyer, December 15 1989.
Updated by Aaron Sloman, School of Computer Science, The University of Birmingham, most recently: 11 Apr 2007

--- $poplocal/local/setup/man/man1/poplog.html
--- Copyright University of Birmingham 2007. All rights reserved. ------