The JET system uses patterns. The patterns are stored in a pattern file and loaded into the system during initialization and can also be reloaded by using the JET Console’s menu File | Reload Patterns. The Pattern Viewer views the patterns as a tree based on the structures in which they are organized in the pattern file. It’s also used for tracing pattern matching during execution. The Pattern Graph Viewer views the patterns as a tree based the directed graph the patterns form.
The patterns are defined in a pattern file. The file format is defined elsewhere.
Pattern files are suggested to use the file extension .pat. (If so, the file chooser can use a filter to focus on the pattern files only.)
A pattern file can be loaded into the system during initialization by including a line of the form
Pattern.fileName = filename
in the JET properties file.
Launch the Pattern Viewer from JET Console’s menu Patterns | View Patterns. The patterns shown are from the pattern file defined in the JET properties file. All the patterns are listed in the first subtree “Patterns” with their productions shown as their children. Only the patterns with action(s) are listed in the second subtree “Pattern Sets”, grouped by their pattern sets, and with their actions shown as their children. Action nodes have the icon of a yellow fish.
The Pattern Viewer can also load patterns from another pattern file. Use File | Open to open a pattern file.
Launch the Pattern Graph Viewer from JET Console’s menu Patterns | View Pattern Graphs. The patterns shown are from the pattern file defined in the JET properties file. The patterns form a directed graph. The graph is shown as a tree in the viewer. An edge and its destination vertex are shown as a tree node. Every vertex in the graph is named as “NODE_K”, where K is a unique number for the vertex. Every edge in the graph is named as the production it represents, e.g. [token case=cap]. For simplicity, downstream of a vertex with multiple in-edges is shown only for the first time the vertex is added to the tree. Null edges are introduced when necessary (in case of * and +, see the “pattern classes” file). Action nodes have the icon of a yellow fish.
The Pattern Graph Viewer can also load patterns from another pattern file. Use File | Open to open a pattern file.
Pattern matching during execution can be traced by using tracing options in the JET Console’s Patterns | Pattern Match Trace and Patterns | Pattern Apply Trace. When the trace for certain patterns is on, the trace will be printed in the Console and if a Pattern Viewer is open, the matched patterns will be highlighted in the Pattern Viewer with its node’s icon changed. (Matched patterns have the icon of a pink octopus, shown only in the “Patterns” subtree. Applied patterns have the icon of a red crab, shown only in the “Pattern Sets” subtree.) Reloading a pattern file by File | Reload Patterns will updated the Patterns | Pattern Match Trace and Patterns | Pattern Apply Trace submenus. The Pattern Viewer and Pattern Graph Viewer should be restarted to have the underlying patterns updated.
More tracing and graphical editing functions could be added to the Pattern Graph Viewer in the future but just enjoy the sea food at this time.