A
Simple FSA Editor
This example has been tested with version 0.2.0 of
the CIDER toolkit.
Using CIDER to Create the Application To create this example
application, download and unzip this file
(9,576 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
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 two CIDER JAR files (the CIDER Compiler and the
CIDER Core Components).
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 -jar
CiderCompiler-version.jar -g fsa.grammar -t fsa.transformations
With regard to this command:
- The text version
represents a specific CIDER version number.
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
javac -classpath .:CiderCore-version.jar
au/edu/monash/csse/tonyj/cider/interpreter/*.java fsa_editor/*.java
With regard to this command: directory) can now be compiled.
This is done using
the 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 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.
|
|