03.06.2013 Views

Turbo Prolog

Turbo Prolog

Turbo Prolog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In addition to the version of <strong>Turbo</strong> <strong>Prolog</strong> you are using, the logon message shows you<br />

the configuration for <strong>Turbo</strong> <strong>Prolog</strong> on your computer.<br />

Now press the space bar and the <strong>Turbo</strong> <strong>Prolog</strong> main menu and four system windows<br />

will appear as shown in Figure 2-2.<br />

Figure 2-2 The Main Menu and the Four System Windows<br />

The Main Menu shows you the commands and pull-down menus available. You select<br />

an item on a menu by pressing the associated highlighted capital letter or by first<br />

moving the highlighted bar using the arrow keys, and then pressing lB. The use of<br />

each window is described throughout this chapter.<br />

The bottom line of the screen contains a status message describing the use of the<br />

function or cursor keys. The meaning of these keys changes depending on what you<br />

are doing with the system at a given time: tracing, editing, or running a program, etc.<br />

ENTERING YOUR FIRST<br />

TURBO PROLOG PROGRAM<br />

Consider the following introductory <strong>Turbo</strong> <strong>Prolog</strong> program. We'll be using it to illustrate<br />

how to create, run, and edit <strong>Turbo</strong> <strong>Prolog</strong> programs.<br />

predicates<br />

hello<br />

goal hello.<br />

clauses<br />

hello:makewindow(1,7,7,"My<br />

first program",L;,Sb,lO,22),<br />

nl,write(" Please type your name "),<br />

cursor(L;,S),<br />

readln(Name),nl,<br />

write(" Welcome ",Name).<br />

Select the Edit option either by moving the cursor with the arrow keys until it is over<br />

the word Edit and then pressing IB, or by simply pressing CD. The screen should now<br />

look like Figure 2-3.<br />

8 <strong>Turbo</strong> <strong>Prolog</strong> Owner's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!