You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alias_decl: Declare short hand, e.g. digits = '0' or '1' or ...
table_decl: Declare transition table: name and list of transitions.
transition: Transitions from one state to another. From is: state (or choice of states) -> new-state for possible-characters [ do action or actions; ]
action: Actions are:
"emit(kind [, text]): emits a token of kind using the givn text or text from the stream. The token starts at the last mark and ends at the current location.
"push(table)": pushes a transition table to the stack.
"pop" : pops a transition table from the stack.
"pushback": pushes the last character back to the stream.
"mark": marks the current location as the start of the next token.
"emit_indent": Emits zero or more INDENT or DEDENT tokens depending on current indentation.
"newline": Increments the line number and sets the column offset back to zero.
States:
All states are given names.
The state "0" is the start state and always exists.
All other states are implicitly defined when used (this is for Python after all :)
'*' means all states for which a transition is not explicitly defined.
So the transitions:
0 -> end for '\n'
0 -> other for *
0 -> a_b for 'a' or 'b'
mean that '0' will transition to 'other' for all characters other than 'a', 'b' and `\n`.
The order of transitions in the state machine description is irrelevant.