A
Simple FSA Editor
This example has been tested with
version 0.1.0-beta of the CIDER toolkit.
For a quick and easy way to run the example application, download the
file fsa.jar (437,101 bytes), then
type the following
command:
java -jar fsa.jar
You do not need any other files to run the quick example.
To use the editor, use the buttons on the left panel, and the right
and left mouse buttons to manipulate the symbol attributes.
Constraints can be broken by holding down the shift key when
manipulating the symbol attributes.
Using
CIDER to Create the Application
To create this example application,
download and unzip this file (10,226 bytes) which contains the following:
- a Grammar File
- a Transformations File
- a Java class for the functions used
in the grammar specification
- three Java classes implement the
terminal symbols as drawable objects
- a Java class which implements the
FSA editor
Note that this example requires the CIDER
implementation of the QOCA
multi-way constraint solver.
Important
Points
The directory in which the editor is to be
created will be referred to
as the base directory.
Note that all of the Java classes listed above belong to the package fsa_editor
and thus must be placed in a directory of the same name (relative the
base directory). This should happen automatically
when they are unzipped.
The base directory should contain the Grammar and Transformations
files,
the CIDER DTD file, and three CIDER JAR files (the CIDER Compiler, the
CIDER Core Components, and the CIDER Implementation of QOCA).
All JAR files and the DTD file should have the same version number.
Running the CIDER Compiler
To create the grammar specific source code
for the CIDER toolkit, the Grammar and Transformations files must be
processed by the CIDER
Compiler. This is done using the command:
java -classpath CiderCompiler-version.jar:CiderQOCA-version.jar
CiderCompiler
-g fsa.grammar -t fsa.transformations -cc
au.edu.monash.csse.tonyj.cider.qoca.QocaConstraintCompiler
With regard to this command:
- The text version
represents a specific CIDER version number.
- The : character used to
separate the two JAR files in the classpath
will need to be replaced with ; on some platforms (such as
Windows).
If successful, this command will first
translate the Grammar and Transformations files into XML files, and
them process these XML files
to produce CIDER Interpreter source code files (in the directory au/edu/monash/csse/tonyj/cider/interpreter
relative to the base directory).
Compiling
the Application with the Java Compiler
The application source code (both that
produced by the CIDER Compiler and
that contained in the files in the fsa_editor directory)
can now be compiled. This is done using the command:
javac -classpath .:CiderCore-version.jar:CiderQOCA-version.jar
au/edu/monash/csse/tonyj/cider/interpreter/*.java fsa_editor/*.java
With regard to this command:
- The text version
represents a specific CIDER version number.
- The : character used in the
classpath argument will need
to be replaced with ; on some platforms (such as Windows).
- The / character used to
separate directories when specifying a file
location will need to be replaced with \ on some platforms
(such as
Windows).
Running
the FSA Editor
If the application compiled successfully,
it can now be run by using
the following command:
java -classpath .:CiderCore-version.jar:CiderQOCA-version.jar
fsa_editor.FSAEditor
With regard to this command:
- The text version
represents a specific CIDER version number.
- The : character used in the
classpath argument will need
to be replaced with ; on some platforms (such as Windows).
Of course, for many applications it will be
convenient to gather all of
the required .class files into a single JAR file to allow
for
a more succinct command line to be used and to make the application
more
portable. This can be done by using the jar tool.
|
|