Getting Started: GNU Emacs Integration (cont'd)


 

The two windows

After having invoked gbeta on the beer.gb source code file, you get the familiar prompt in one window:

executing~1> _

and the first statement of the program (which happens to reside in the file betaenv.gb) emphasized in the middle of the other window:

 ...
   min: (# i,j: @integer enter (i,j) exit (if i<j then i else j if)#);
   theProgram: @<<SLOT program:merge>>;
do
=> theProgram
#) 

The current imperative is emphasized in two ways. At the leftmost column of the window, an "=>" arrow enables a quick scan to find the line containing the current imperative, and somewhere in the middle of that line, a block is highlighted using the same attributes as the "secondary selection." This might e.g. give the selected region a light blue background color. Here it is shown as a blue foreground color.

Some unchanged features, and a better display

Printing the state of objects or the structure of patterns, or static information about program elements works the same as in the command line environment. Showing a position in the source code works a lot better, because the display command can exploit Emacs to show the given source code position in the source code window. Try:

print theProgram

This produces a rather large response, specifying the state of the object theProgram:

 
object, composite object slice~72~71 = 
   (#`beer.gb:1112
      "line" : pattern =
	 integer pattern slice
	 composite pattern slice = beer.gb:532 in CsOSli~72~71
      ...
   #) 

Then go up and find the annotation at the top of the "state block": it will be a backquote followed by a filename, a colon, and an integer which gives the identity of a node in the abstract syntax tree, in this case `beer.gb:1112. Now give that (without the backquote) as an argument to the display command:

display beer.gb:1112

Actually, double-clicking with the mouse on the text `beer.gb:1112 (or closely after it) has the same effect.

[ click-click! ]

You can use this to inspect the source code (declarations) associated with the program state which "print something" delivers. Try to double-click on beer.gb:532 or similar!

Remember that if you get lost because you have looked at lots of places in the source code browsing the state of the program, you can always display the imperative which will be executed next by:

display

without any arguments.

In the next section we will start executing the program, and begin to use breakpoints.

 


Signed by: eernst@cs.auc.dk. Last Modified: 3-Jul-01