FSA file format
The file describing an FSA is a series of records, structured as lines of text.
Records
There are 4 different type of records to specify states, transitions, initial-states, final-states, as
well as comments and empty lines.
1 State record
state stateName xPos yPos
Where:
state is the character string “state”.
stateName is the name of the state, a string of characters beginning with a letter, followed
by zero or more letter, digit, or underscore characters. (This is essentially the definition of
“identifier” in Java.)
xPos and yPos are integer values that gives the x- and y-position of the state on the
computer’s display screen. Although you will not need these values for this stage of the
project, you must store and reproduce them correctly.
2 Transition record
transition fromState event toState
Where:
transition is the character string “transition”.
fromState is the name of the state from which this transition begins.
event is the name of the event that causes this transition to occur.
An event name is either character string consisting only of letters, or the character “?” that
indicates an ε-transition.
toState is the name of the state where the transition terminates.
3 Initial record
initial stateName
Where:
stateName specifies an initial state of the FSA. stateName must comply with the rules
described earlier for state-names.
4 Final record
final stateName
Where:
stateName specifies a final state of the FSA. stateName must comply with the rules described
earlier for state-names.
5 Comment line
A line that begins with the character # is a comment, and is ignored.
6 Empty line
A line containing no data is ignored by the system.
Order of records
Records can appear in any order in the file, with one restriction: a state name must have been
defined via a state record before its name can be used in a transition record, initial record,
or final record.
Example
This input file has two states, q0 (initial) and q1 (final) and a transition ev between them
It is equivalent to the following FSA:
# States
state q0 10 10
state q1 20 10
# Transitions
transition q0 ev q1
# Initial
initial q0
# Final
final q1
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp
因为专业,所以值得信
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp