Tools can be choosen from the Torero Toolbar as shown below. When a tool is active the cursor is changed to a small icon, showing the tool's state. The cursor icon for each tool shown in the tool's description.
Please note that the Toolbar is only visible while editing an attribute grammar (after import of a yacc file, or after opening an attribute grammar).
![]() |
Attribute Tool |
After activating this tool in the toolbar, it can be used by clicking on a Nonterminal Symbol in a Derivation Window.
First use the Active Nonterminal Combobox to choose the desired nonterminal.
The New Attribute Button can be used to define new attribute names.
Use the Attribute Type ComboBox to specify the attribute's type (none,
autoinherit, autosynthesized). This can be done by simply selecting
an attribute (the currently defined type is shown by the ComboBox) and then
changing the combobox value.
All currently defined attributes are shown in the Defined Attributes List,
this list supports multiple selection (use the Strg-Button).
The Assign Attribute Button is used to assign all selected attributes to the active nonterminal, all currently assigned attributes are shown in the Assigned Attributes List. From there they can be removed using the Remove Assigned Attributes Button.
The currently selected attribute from the Defined Attributes List ist
shown in the textfield, if more than one is selected the first (in the list's
ordering) is shown. There are some action that are only useful with one attribute
at one time (renaming, changing the attribute's type), if there is a multiple
selection only the first attribute is affected.
To remove a selection use Strg-Click (in both lists).
![]() |
Traversal Tool |
After activating this tool in the toolbar, it can be used by clicking on a
nonterminal symbol in a Derivation Window. This tool is only used for
definition of new traversal names and assigning them to productions. The source
code for the traversal can be written with another tool (Function Editor)
described later. Note that a traversal always is assigned to a whole production
and can be assigned only to an expanded nonterminal/node.
First use the Active Production ComboBox to select the active production.
Click the New Traversal Button, overwrite the word "New" in
the Traversal Name Textfield with the desired traversal name and hit
the return key. Another way to create a new traversal is just typing the desired
name into the (empty) Traversal Name Textfield and pressing the return
key twice.
The traversals properties order type and direction type can be set using
the Traversal Order Type ComboBox (default, preorder, postorder) and the
Traversal Direction Type Combobox (default, lefttoright, righttoleft).
The Disable Checkbox temporarly disables the traversal and has the same
meaning as the disable keyword in ox. It is mostly used for debugging purpose.
All currently defined traversals are listed in the Defined Traversals List.
To remove a traversal completely select it in the Defined Traversals List
and press the Remove Traversal Button.
Select the traversal(s) in the Defined Traversals List and click the Assign Traversal Button. All traversals assigned to the active production are listed in the Assigned Traversals List. To remove a traversal from the active production select it in the Assigned Traversals List and press the Remove Assigned Attributes Button.
![]() |
![]() |
![]() |
Connect Tool |
This tool is used to connect attributes which is necessary before functions
can be defined between them. The Connect tool works slightly different from
other tools, it does not have an own window - only the cursor changes after
activating it in the toolbar. The first icon shows the tool in the Select
Source State and the second icon shows the Select Destination State.
A connection describes the relations between attributes, saying that (as in
the example below) one attribute is dependent on one ore more other attributes.
But it only defines dependencies and not the exact (mathematical) function
between them.
Example: the derivation window below shows a connection between A.value, B.value
and S.sum where S.sum is dependent on A.value and B.value. Therefore A.value
and B.value are called Sources and S.sum is called Destination
of this connection.
After activating the tool it is in the Select Source State, now the
source and destination are selected by clicking on the source and the destination
attribute. A line is drawn between them and the f(x) symbol next to the destination
attribute turns from grey to black (for details about f(x) see the function
editor's section).
Multiple sources can be defined by simply repeating the actions above with different
source attributes.
A connection can be removed in the same manner, first click the source that
should be removed and then the destination attribute.
![]() |
Function Editor |
After activating this tool in the toolbar, it can be used by clicking on an attribute or a traversal (the Destination Attribute) in a Derivation Window. The tool can be used to define exact (mathematical) functions between attributes (traversals) previously connected with the connect tool and to define traversal code. The defined text is written "as it is" into the output file, therefore it has to be in the correct target language (ox and C in most cases).
Using this tool is simple. To insert the previously "connected" attributes into the ox-code, click on the Destination Attribute Button and/or the Source Attribute Buttons - a complete ox notation with the surrounding @ ... @ is inserted. As mentioned above the text is taken into the output file "as it is", after clicking the OK Button a few checks are done on the Defined Function: All used attribute (traversal) names must be either the Destination Attribute or be in the list of Source Attributes. The Destination Attribute and all Source Attributes have to be used to define a correct function. Note that any text enclosed by @'s is considered to be an Attribute.
OK Button: The entered functiontext is checked and the window is closed
if the check was successful.
Cancel Button: Modifications are discarded and the window is closed.
Clear Button: The whole functiontext and the connections to this destination
attribute are cleared and therefore the Function Symbol
(in the derivation window) changes to no function defined.
For the exact meanings of the different Function Symbols (in the derivation
window) see the function symbols in the derivation
window section.
![]() |
Swap Tool (only in debug mode, -v -vv) |
There is an additional tool that was implemented to illustrate the power of Torero's grammar model.That's the only tool that allows modifications to the underlying grammar. It is only available if Torero is started in debug mode with the command line option -v, -vv given.
After the Swap Tool is activated in the Torero Toolbar the cursor changes. With this tool you can swap two grammar symbols in a production by clicking them with the left mouse button.
Torero Reference |