Eclipse IDE

The Amzi! IDE is an extension of the open-source Eclipse IDE project (www.eclipse.org). It is a Java application which provides a friendly GUI interface to Amzi! Prolog (and many other languages). The highlights of the Amzi! Eclipse IDE are:

Some of the features of Eclipse that may interest you (see www.eclipse.org to download):

The Eclipse documentation provides detailed information on how to use it. Here we describe our adaptation for Amzi! Prolog:

The Prolog Perspective

Eclipse supports multiple language development environments. These are called 'Perspectives'. You can open a perspective with the Window | Open Perspective command, or by pressing on the buttons in the vertical bar on the left edge. The Paw button displays the Prolog perspective. The Bug button displays the Debug perspective.

The perspective you are currently working with is shown in the title of the window and in the shortcut bar as a pushed-in icon. A perspective consists of a set of views. For example, the Prolog perspective contains (by default) these views: Navigator, Editor, Outline, Cross Reference, Listener and Tasks. Many views have their own buttons and menus. The buttons are in the upper right of the view and the menu is under the black, down-facing triangle.

You can move views and editors around the workbench by dragging their titlebars. You can also add more views to your current perspective by using Window | Show View. You can expand a view to the full window by double-clicking on the view's title bar.

If you having problems, or cannot find a command or view, reset the perspective to its original state by choosing Window | Reset Perspective.

The Prolog perspective has a project and file navigator on the left. This lets you see the contents of your projects and open files for editing. The navigator also lets you backup to a previous version of your file, check in/out files from source control and import/export files to/from the file system.

The editors are in the middle view and use colors to highlight built-in predicates, strings, comments, et.al. You can set the colors under Window | Preferences | Prolog.

The right hand side shows an outline for the currently open editor. It is also where the Cross Reference (the axrf tool) can be run. Click on the green lightening bolt to generate it. (This may take some time for large projects).

The bottom has the list of problems, notably errors from listening, compiling and linking as well as your own bookmarks and to-do tasks. Also on the bottom is the Prolog Listener.

You can press F1 in any view, or on most buttons and menus to get help.

We recommend that you do not overlay the Listener and Debug Listener views with other views that you need to access while running Prolog programs.

Prolog Projects and Building Executables

Eclipse uses a workspace to keep track of all your files and projects. In order to work on a file, you need to have a Prolog project in the workspace. The contents of the workspace are shown in the Navigator View. One point that can be confusing is that projects and files in the workspace can be located in the workspace directory (under the main eclipse directory) and in other disks or directories. In the latter case the workspace has a link to the project or file, instead of the actual project or file (or a copy thereof).

Eclipse allows you to have multiple projects opened at the same time (which can sometimes be confusing). In order to use a project or a file, you need to import it into the Eclipse workspace (if it already exists), or create it in the workspace. Once in the workspace, a project or file can be opened or closed. To remove a project or file from the Eclipse workspace, you delete it. See Opening, Closing and Deleting Projects below.

A Prolog project consists of all the source files in the project folder. Prolog source files must have a .pro extension. When building a project all the source files are compiled and linked into a .xpl file. By default the binary files are stored in a subdirectory named 'bin'. (Right-click and select 'Build Project' or use the Project menu to build a Prolog project. The automatic build option is turned off when using the Prolog perspective.

Setting Project Properties

You can set the project properties by right-clicking on the project in the navigator view on the right.

Under 'Build Executable/Libraries' you can set the:

Also under project properties, you can refer to other Prolog projects. If you do this, then all the plm files in the referred project will be linked into your xpl file.

Creating Projects

To create a new project, select File | New Project, then Prolog Project. Projects can be created in the Eclipse workspace directory or in a different disk or directory. You can also create a new Prolog Project in an existing directory, in which case all .pro files in that directory will be included in the new project.

When you create a project, amzi.cfg from your amzi/config directory is copied into your project. You can set the size of the heaps and stacks and other parameters in this file. Logic Server Extensions are loaded explicitly and do not need to be set in amzi.cfg.

Opening, Closing and Deleting Projects

To open or re-open an existing project, select File | Import | Existing Project into Workspace. This is a very useful command and is the way to open the Amzi! Samples.

You can close a project in the navigator view by right-clicking on it and choosing Close Project. This stops the project from being rebuilt by Project | Rebuild All and shows the project as a closed folder.

You can delete a project from the navigator view (and the Eclipse workspace) also by right-clicking and selecting Delete. This is a little disconcerting, but delete asks you whether or not to delete the actual project contents. By choosing not to do this, you simply remove the project from the navigator view and it can be re-opened later using Import.

Starting the Listener and Prolog Programs

Starting the Listener

Select Run | Listener to open an empty Prolog Listener.

With a project or editor selected, choose Run | Run As | Interpreted Project to start the listener and consulting the source files in your project and load the libraries and Logic Server Extensions (lsxs).

You can use the up/down arrows to peruse the queue of prior lines that you typed into one of the listeners. You can also edit those lines.

Type 'quit.' to exit the listener.

Launch Configurations

The Run As and Debug As menus provide short-cuts for running interpreted and compiled Prolog projects. These short-cuts build an Eclipse Launch Configuration for the currently selected project. You can build your own Launch Configurations by selecting the Run... and Debug... menu items. A Launch Configuration defines the environment for running a program. It includes things like the project name, the directory to run from, which files to include and other items. See the Source Code Debugger section for details.

You can rerun your last session by selecting the launch configuration from either the Run | Run History menu or from the Run command button.

Running Compiled Programs

To run a compiled/linked xpl file, select Run | Run As | Compiled Project.

Starting the Source Code Debugger

With a project or editor selected, choose Debug | Debug As | Interpreted Project or Interpreted Single File to start the Source Code Debugger. (The 'Remote Prolog' menu option is for debugging xpl files running under other languages/systems such as Java, C++, Web Servers, etc.)

The Debugger will open the Debug Perspective with a Debug Listener at the bottom of the screen. Like the Prolog Perspective you can add, resive and move views. For example, you can add the Basic | Navigator view in the same place as the Outline view.

The goal you type is the goal that will be debugged. (So typing 'listing' will run under the debugger.) The buttons on the upper left view let you single-step or run your program.

The upper left also shows the call stack. The upper right shows the binding of the Prolog variables at each level of the call stack. You can peruse them by clicking on any entry in the call stack. In the middle your source file is opened read-only (a second time if it is already open) and the current line is highlighted in a color to indicate whether it is a Prolog call, redo, fail or exit.

See Source Code Debugger for detailed documentation.

Copyright ©1987-2011 Amzi! inc. All Rights Reserved. Amzi! is a registered trademark and Logic Server is a trademark of Amzi! inc.