Expression of a Program as a Parse Tree

Stelovsky, Ackermann and Conti [21] have also produced a visual programming environment to help students. They suggested that many of the difficulties that students faced were due to students spending too much time concentrating on correct syntax and having to format their text to reflect the program structure. Furthermore, the text-based systems tended to force students to express their ideas in a linear fashion, whereas a program is more naturally expressed as a tree structure. To solve these difficulties, they created a visual programming environment called Macpeth.

Macpeth gives both a textual and a pictorial view of a program. The pictorial view is of a parse tree structure. An assignment, for example, is a node with two children: one for the variable being calculated, and one for the expression that will be assigned to it. The expression, of course, is likely to have further children (see Figure 2.3). Macpeth allows editing by selecting a node that hasn't been defined, and selecting a construct (while... do, if...then, etc.) from a menu. The central idea is to encourage top-down refinement: the student travels down the tree, adding more and more detail. The variables that are available at each point in the program are listed in a menu--thus the student is able to see the scope of each of the variables. The declaration of any variable can be called up at will, thus saving much of the shuffling around that normally occurs during debugging.

Figure 2.3: A display from Macpeth
\begin{figure}\centerline{\psfig{figure=macpeth.ps,width=13cm}}
\end{figure}

When the program becomes too large to fit on the screen, another pictorial aid is offered. On the left hand side, the scroll bar is widened to contain parallel vertical lines which represent the nesting of the program. From the number of lines in the scrollbar, the user can gain an impression of how deep in the program they are working.

Matthew Exon 2004-05-28