next up previous contents
Next: Feature StructuresTypes Up: No Title Previous: Introduction

Prolog Preliminaries

While it is not absolutely necessary, some familiarity with logic programming in general, and Prolog in particular, is helpful in understanding the definite clause portion of ALE. Similarly, experience with unification grammar systems such as PATR-II, DCGs, or FUG is helpful in understanding the phrase structure component of the system. In particular, writing efficient programs and grammars in ALE involves the same kinds of strategies necessary for writing efficient programs in Prolog or PATR-II. For those not familiar with Prolog, the sequence of two books by Sterling and Shapiro (1986) and by O'Keefe (1990) are excellent general introductions to the theory and practice of logic programming. For those not familiar with unification-based grammar formalisms, Shieber (1986), Gazdar and Mellish (1987) and Pereira and Shieber (1987) are useful resources.

For those not familiar with Prolog, we need to point out the salient features of the language which will be assumed throughout this report. This section contains all of the information necessary about Prolog required to run ALE.

Terms

A Prolog constant is composed of either a sequence of characters and/or under-scores, beginning with a lower case letter, a number, or any sequence of symbols surrounded by apostrophes. So, abc, johnDoe, b_17, 123, 'JohnDoe', '65$', and '_65a.' are constants, but A19, JohnDoe, B_112, _au8, and [dd,e] are not (although see the warning at the end of this section). A variable, on the other hand, is any string of letters, underscores or numbers beginning with a capital letter. Thus C, C_foo, and TR5ab are variables, but 1Xa, aXX, and _Xy gif are not.

In general, it is a bad idea to have constants or variables which are only distinguished by the capitalization of some of their letters. For instance, while aBa and aba are different constants, they should not both be used in one program. One reason for this in the context of ALE is that the output routines adopt standard capitalization conventions which hide the differences between such constants.

Warning: As pointed out to us by Ingo Schroeder, constants or atoms beginning with a capital letter are not treated properly by the compiler. Thus constants such as 'Foo' should not be used.

Space and Comments

In your own program and grammar files, extra whitespace between symbols beyond that needed to separate constants or variables is ignored. Whitespace consists of either spaces, blank lines or line breaks are ignored. This allows you to format your programs in a manner that is readable. Furthermore, any symbols on a line appearing after a % symbol are treated as comments and ignored.

Running Prolog

To fire up Prolog locally, you should contact your systems administrator. You should have either SICStus or Quintus Prolog, or a Prolog compiler compatible with one of these. Once Prolog is fired up, you will see a prompt. The Prolog prompt should look like:

  | ?-

It is important that Prolog be invoked from a directory for which the user has write permission. ALE, in the process of compiling user programs, writes a number of local files.

Queries

What you type after the prompt is called a query. Queries should always end with a period and be followed by a carriage return. In fact, all of the grammar rules, definite clauses, macros and lexical entries in your programs should also end with periods. Most of the interface in ALE is handled directly by top-level Prolog queries. Many of these will return yes or no after they are called, the significance of which within ALE is explained on a query by query basis.

Running ALE

To run ALE, it is only necessary to type the following query:

| ?- compile( File). 
where File is the file in which the file ale.pl resides. Note that File does not have to be local to the directory from which Prolog was invoked.

Exiting Prolog and Breaking

To exit from Prolog, you can type halt  at any prompt (followed by a period, of course).

If you find Prolog hanging at some point, and you are working on a standard Unix implementation, typing control-c  should produce something like the following message:

  Prolog interruption (h for help)?
You should reply with the character a, with or without a following period, followed by a carriage return. If this doesn't work, typing control-z  should take you out of Prolog altogether.

Saved States

All information concerning an ALE state is encoded in the current Prolog state. Thus, any options presented by the local system to save Prolog states should be able to save ALE states.



next up previous contents
Next: Feature StructuresTypes Up: No Title Previous: Introduction



Bob Carpenter
Wed Jul 26 14:25:05 EDT 1995