A/<B>Alice</B> Summary for Experienced Users

# A/Alice Summary for Experienced Users

This appendix summarizes Alice for experienced computer users. Of course, the main body of the manual gives a much more complete description of Alice, but we recognize that experienced users often prefer to experiment without bothering to read a lot beforehand. In order to facilitate such experimentation, the following will give ``bare bones'' descriptions of what you need to know first. At the end of each section, we will give a reference to the main part of the manual where a fuller description may be found.

## Templates

Alice builds programs out of templates, i.e. skeletons of source code. All templates have one or more placeholders to be filled in with code. The way placeholders are represented depends on what kind of screen you use. Colour screens show placeholders in blue; monochrome show them more brightly than other source code. Enter source code in placeholders and you often get a template with more placeholders. For example, type for in a `Statement` placeholder and you get the template of a for statement with more placeholders. [Section 1.2.1]

## Tree Structure

Internally, Alice represents the program in a tree structure that represents the logic and grammar of Pascal. For example, a while statement is a tree node that has a number of sub-trees: one for the `Condition` of the while and another for the list of statements contained in the while loop. Both of these sub-trees may themselves be trees. The `Condition` may be an expression represented as a tree, while the statements may have many sub-trees of their own. [Section 1.2.2]

## Menus

Alice uses menus a great deal, especially menus of commands. Menus are often called up by pressing keys or key sequences, e.g. the function keys. The line at the top of the screen tells which menus are associated with which function keys. `[F7]` gives the menu of all menus.

All menu selections are labelled ``A'', ``B'', ``C'', etc. To choose a selection from a menu, press the letter that labels that selection. [Section 1.4]

## On-line Help

`[F9]` is the general purpose Help Key. To get an explanation of a particular menu selection, press the down-arrow keyuntil the selection is highlighted, then press `[F9]`. If you press `[F9]` when there is not a menu on the screen, you will be shown the Help Menu. Of particular interest is on this menu is ``What Can I Type?''. This gives a list of all possible inputs on the current placeholder. Choose one and it will be filled into the placeholder. You can also press `[ALT-T]` to get this input list. [Section 4.5]

## Selecting Code

Sometimes you must select a portion of code before issuing a command. For example, before issuing Alice's DELETE command you usually have to select the portion of code to be deleted. To select a portion of code, move the cursor to any part of the region you want to select and press `[F10]`. Then use the arrow keys to move the cursor over more of the code that you want to select. You will see this code highlighted (in reverse video) on the screen. Selecting the start or end of a logic structure automatically selects the whole of that structure; for example, selecting the first line of a while loop automatically selects everything that is contained in that loop (thanks to the tree structure used to represent the program). Through cursor movements you can ``sweep out'' all the code you want to select.

If you make a mistake, press `[F10]` again. This ``unselects'' the highlighted code and you can start again from scratch. [Section 1.6]

## Getting New Placeholders

To get a new `Statement` or `Declaration` placeholder, move to the line above the place where you want the placeholder and press `[ENTER]`. To insert a placeholder in front of something, move the cursor to the appropriate position and press `[INS]`. To add a new item to a list (e.g. an argument list), just enter a comma. For more information, press `[F4]` to get the Insertion Menu and use `[F9]` to get more information about the menu entries. [Sections 3.7.1, 4.2.1, 4.2.2]

## UNDO

Press `[CTRL-U]` undoes the most recent change you made to your source code. Pressing this again undoes the second most recent change, and so on back several levels. Pressing `[CTRL-R]` ``redoes'' something that you just undid. You can also issue the UNDO and REDO commands from the Changes Menu -- press `[F5]` to get this menu. [Section 4.9.1]

## Editing Expressions

As you type a particular token, you may use backspace to delete the character immediately preceding the cursor. The leftarrow key moves the cursor backwards without deleting. CTRL-D deletes the character under the cursor. The rightarrow key moves the cursor forwards without deleting. CTRL-W deletes the word immediately preceding the cursor.

In general, Alice takes some action as soon as you have completed typing a single token. However, when you are entering expressions, comments, and string constants, Alice takes no action until you do something to move the cursor off the placeholder (e.g. press `[ENTER]`).

Once Alice has taken an action, you cannot edit tokens using backspacing, etc. Instead, you must select the piece of code you want to edit and issue the EDIT command (from the Changes Menu or by pressing `[ALT-E]`). You will then be able to edit what has been selected using backspace, CTRL-D, the arrow keys, etc. [Sections 1.8, 3.2.3, 3.3, 3.7.3, 4.2.5]

## Workspaces

Alice allows you to have several workspaces at one time, each containing a program or part of a program. Commands on the Insert Menu (`[F4]`), Delete Menu (`[F3]`), Changes Menu (`[F5]`), and Miscellaneous Menu (`[SHIFT-F9]`) can change from one workspace to another as well as copy or move code from one workspace to another. Often, workspaces are used as holding areas as you move chunks of code around in your programs. [Sections 1.7, 4.8]

## Errors

Syntax errors are almost impossible to generate, since most syntax is controlled by Alice's templates. Syntax errors can only occur if you enter an expression incorrectly. As soon as you indicate that you have finished typing the expression (by moving the cursor off the expression), Alice will give you an error message and highlight the erroneous expression on the screen.

For the most part, semantic errors are also detected as they are entered. You can typecheck your program with the `Typecheck Program` command from the Debug Menu (obtained by pressing `[F6]`). This is necessary if you change a declaration, since Alice will not automatically typecheck all occurrences of the changed symbol. [Sections 2.4.1, 4.5.5, 4.5.6]

## Non-Intuitive Changes

Some special changes (e.g. while loop to for loop) can be made using the `Special Changes` selection from the Changes Menu (`[F5]`). Other changes can be made by moving code to a workspace and getting it back later on. See the workspace commands mentioned above. [Sections 4.2.8, 4.8]

## Symbol Name Completion

After you have typed the first few characters of a symbol name, press `[END]`. Alice will check all symbols defined in the current scope to find which begin with the characters you have typed. If there is a single name that matches, Alice will complete the name you have started typing. If there is more than one matching name, Alice will give a menu of all such names -- choose a name from this menu and Alice will fill it in where you were typing. This applies to built-in names like `integer` and `writeln` as well as user-defined ones. [Section 1.8.1]

## Other Features

For help on commands, call up a menu, highlight the appropriate selection, and press `[F9]`. You can press `[F9]` practically any time to obtain explanations of various things.