JForlan — Java Graphical Editor for Forlan Automata and Trees


Introduction

JForlan is a Java program for creating and editing Forlan automata and trees: finite automata, regular expression finite automata, parse trees, regular expression trees, and program trees. JForlan automatically maintains the connections between the components of automata and trees, as those components are repositioned using the mouse. And it handles the conversion of diagrams from and to Forlan's concrete syntax. JForlan can be invoked directly (as a standalone applications) or from Forlan.

under construction There are substantial differences between the documentation in this web page, and the current version of JForlan.

Installing JForlan

JForlan requires JRE (Java Runtime Environment) to be installed, which can be downloaded for free from www.java.com. Version 1.6 or later of JRE is required. Forlan itself must be installed separately.

Installation on Windows

Download and place the JAR archive JForlan.jar in a folder. Download and place the file jforlan.bat in a folder that's on the shell's search path, e.g., to the folder where sml.bat was installed. Edit jforlan.bat so that the variable jardir is set to the folder where JForlan.jar is located. Finally, create a shortcut to JForlan.jar.

Installation on Mac OS X or Linux

Download and place the JAR archive JForlan.jar in a directory. Download and place the file jforlan in a directory on the shell's search path, e.g., the directory where sml was installed. Edit jforlan so that the variable jardir is set to the directory where JForlan.jar is located.

File Formats

Automata File Formats

JForlan supports three file formats for automata:

JForlan File (*.jfa)
This is JForlan's internal, binary format, which stores the absolute positions of an automaton's states and transitions.
Forlan Syntax (*)
This is a text file, in Forlan's concrete syntax.
PNG (*.png)
Portable Network Graphics is an output format only.

Tree File Formats

JForlan supports three file formats for trees:

JForlan File (*.jft)
This is JForlan's internal, binary format, which stores the absolute positions of a tree's nodes.
Forlan Syntax (*)
This is a text file, in Forlan's concrete syntax.
PNG (*.png)
Portable Network Graphics is an output format only.

Invoking JForlan

Direct Invocation

On Windows, JForlan can be invoked by (double-)clicking on its shortcut, or by running jforlan from the shell (with no arguments). On Mac OS X, JForlan can be invoked by double-clicking on JForlan.jar in the Finder, or by running jforlan from the shell (with no arguments). On Linux, JForlan can be invoked by running jforlan from the shell (with no arguments).

Invocation from Forlan

Creating New Automata and Trees

To create a new finite automaton (FA) using JForlan, use the function

  jforlanNew : unit -> fa

of the FA module, e.g., by typing

  val fa = FA.jforlanNew();

Forlan will launch a new instance of JForlan, with a blank drawing area. After creating your automaton, you must commit it, in order for JForlan to return the automaton to Forlan.

To create a new regular expression finite automaton (RFA) using JForlan, use the function

  jforlanNew : unit -> rfa

of the RFA module, e.g., by typing

  val rfa = RFA.jforlanNew();

Forlan will launch a new instance of JForlan, with a blank drawing area. After creating your automaton, you must commit it, in order for JForlan to return the automaton to Forlan.

To create a new regular expression tree using JForlan, use the function

  jforlanNew : unit -> reg

of the Reg module, e.g., by typing

  val reg = Reg.jorlanNew();

Forlan will launch a new instance of JForlan, with a blank drawing area. After creating your tree, you must commit it, in order for JForlan to return the tree to Forlan.

To create a new parse tree using JForlan, use the function

 jforlanNew : unit -> pt

of the PT module, e.g., by typing

 val pt = PT.jforlanNew();

Forlan will launch a new instance of JForlan, with a blank drawing area. After creating your tree, you must commit it, in order for JForlan to return the tree to Forlan.

To create a new program tree using JForlan, use the function

 jforlanNew : unit -> prog

of the Prog module, e.g., by typing

 val prog = Prog.jforlanNew();

Forlan will launch a new instance of JForlan, with a blank drawing area. After creating your tree, you must commit it, in order for JForlan to return the tree to Forlan.

Editing Existing Automata and Trees

To edit an existing finite automaton (FA) using JForlan, use the function

  jforlanEdit : fa -> fa

of the FA module, e.g., by typing

  val fa' = FA.jforlanEdit fa;

Forlan will launch a new instance of JForlan, which will let you edit the supplied automaton, and commit it back to Forlan.

To edit an existing regular expression finite automaton (RFA) using JForlan, use the function

  jforlanEdit : rfa -> rfa

of the RFA module, e.g., by typing

  val rfa' = RFA.jforlanEdit rfa;

Forlan will launch a new instance of JForlan, which will let you edit the supplied automaton, and commit it back to Forlan.

To edit an existing regular expression tree using JForlan, use the function

  jforlanEdit : reg -> reg

of the Reg module, e.g., by typing

  val reg' = Reg.jforlanEdit reg;

Forlan will launch a new instance of JForlan, which will let you edit the supplied tree, and commit it back to Forlan.

To edit an existing parse tree using JForlan, use the function

  jforlanEdit : pt -> pt

of the PT module, e.g., by typing

  val pt' = PT.jforlanEdit pt;

Forlan will launch a new instance of JForlan, which will let you edit the supplied tree, and commit it back to Forlan.

To edit an existing program tree using JForlan, use the function

  jforlanEdit : prog -> prog

of the Prog module, e.g., by typing

  val prog' = Prog.jforlanEdit prog;

Forlan will launch a new instance of JForlan, which will let you edit the supplied tree, and commit it back to Forlan.

Using JForlan

JForlan appears and works slightly differently depending on whether it was invoked directly or from Forlan.

When invoked directly, users can work on multiple automata and trees simultaneously, each in its own tab.

In contrast, when JForlan is invoked from Forlan, only a single automaton/tree can be created/edited, and the resulting automaton/tree can be saved, abandoned, or committed back to Forlan.

The contents of an automaton or tree tab is not required to be a valid Forlan automaton/tree except when the tab's contents is being saved in Forlan's concrete syntax or committed back to Forlan. E.g.:

When working on either an automaton or a tree, editing operations may be aborted by pressing the escape key.

JForlan's Menu

Menu When Invoked Directly

When invoked directly, JForlan's menu contains:

New
Opens a new automaton or tree tab.
Open
Opens an existing file, initializing a new tab with the automaton/tree that's the file's contents. When the file format of the open operation is Forlan's concrete syntax, if the file's contents isn't a valid automaton/tree, an error message will be displayed in the log, erroneous parts of the automata/tree will be highlighted, and some of the file's contents may be ignored.
Save
Saves the contents of an automaton/tree tab into a file. Saving in Forlan's concrete syntax will only succeed if the tab's contents is valid.
Rename
Renames a tab.
Close
Closes a tab.
Exit
Exits from JForlan.

Menu When Invoked from Forlan

When invoked from Forlan, JForlan's menu contains:

Save
Saves the contents of an automaton/tree tab into a file. Saving in Forlan's concrete syntax will only succeed if the automaton/tree is valid.
Commit
Returns the contents of an automaton/tree tab back to Forlan. This operation will only succeed if the tab's contents is valid.
Abort
Returns to Forlan, signalling that the user aborted the creation or editing of the automaton/tree.

JForlan's Toolbar

The JForlan toolbar consists of three categories of buttons: the general buttons, the automata-specific buttons, and the tree-specific buttons.

The general buttons are:

new project buttonThis button opens a new automaton or tree tab. It is absent when JForlan is invoked from Forlan.

open button This button opens an existing file, initializing a new tab with the automaton/tree that's the file's contents. It is absent when JForlan is invoked from Forlan. When the file format of the open operation is Forlan's concrete syntax, if the file's contents isn't a valid automaton/tree, an error message will be displayed in the log, erroneous parts of the automata/tree will be highlighted, and some of the file's contents may be ignored.

save file
button This button saves an automaton/tree into a file. Saving in Forlan's concrete syntax will only succeed if the automaton/tree is valid.

check button This button checks an automaton/tree for errors. Error messages are displayed in the log, and erroneous parts of the automaton/tree are highlighted.

The close button closes a tab. It is absent when JForlan is invoked from Forlan.

The commit button is present when JForlan is invoked from Forlan, and is used to return the contents of the automaton/tree tab back to Forlan. This operation will only succeed if the tab's contents is valid. Otherwise, JForlan will not exit, and the user must either make the tab's contents into a legal automaton/tree, or abort.

Drawing Automata

Each transition has a dot somewhere on its arc, and the transition's label is displayed near this dot. A transition is either standardized or customized.

Upon creation, transitions are standardized. A standardized transition from one state to another is straight, and its dot is positioned at its midpoint. A standardized transition from a state to itself is curved, and its dot is positioned at its midpoint. When the source or target of a standardized transition is moved using the mouse (in the case of a transition from a state to itself, both the source and target are being moved), the transition remains standardized, and the transition's dot (and label) is automatically moved.

When a transition's dot is moved using the mouse, this doesn't move the transition's source state or target state, and the transition becomes customized. In can only be returned to being standardized by means of a standardization operation. When the source or target state of a customized transition is moved using the mouse, the transition's dot (or label) does not move.

There are three automata-specific buttons:

state mode button This button puts JForlan in state mode. Clicking on an empty spot in the drawing area will create a new state. An existing state can be dragged to a new position with the mouse. Right-clicking on a state will bring up a pop-up menu that will allow you to change the state's label, delete the state, change whether it's accepting or not, and make it the automaton's start state. (On Mac OS X, control-clicking is used instead of right-clicking.)

transition mode button This button puts JForlan in transition mode. You can create new transitions by dragging the mouse pointer from the source state to the target state. A transition's label can be edited by dragging the mouse pointer from its source state to its target state. A transition's dot can be moved using the mouse, making the transition customized, if it wasn't already. Right-clicking on a transition's dot will allow you to edit the label of the transition, reverse or delete the transition, make the transition standardized, or in the case of a regular expression finite automaton, view the transition's label as a tree in a new tab.

snap to grid mode button When the snap to grid mode is selected, states will be positioned, when created or moved, at the lines of an invisible grid, helping a user to format an automaton in a regular way. Snap to grid can be temporarily activated by holding down the shift key.

Drawing Trees

The contents of a tree tab may be a forest (i.e., may have multiple roots), up until the point when a save or commit is done.

To create a node, click once to set the location of the new node and a second time to choose its parent. If the second click is not on a node, the newly created node will be a root node. Nodes can be moved using the mouse.

Right-clicking on a node will bring up a pop-up menu that will allow you to change the node's label, delete the node, and all of its children, or change the node's parent (clicking anywhere other than on a node will make the node a root).

There is only one tree-specific button:

node mode button This button formats the tree in a regular way.

Distribution

JForlan is open source software, released under the GNU General Public License. Its source is included as part of the Forlan distribution.

Authors

Leonard Lee and Jessica Sherrill designed and implemented graphical editors for Forlan finite automata (JFA), and regular expression and parse trees (JTR), respectively. Their work was unified and enhanced (of particular note was the addition of support for program trees) by Srinivasa Aditya Uppu, resulting in an initial version of JForlan. Additional development of JForlan was completed by XXX.


Alley Stoughton (stough@k-state.edu)
Valid XHTML 1.0!   Valid CSS!