The ExpressionCharacterMachine[�] is the principle iterative subroutine in Expression[Branch][input_String] (see below).� The iterative Loop[�] ends by calling either completeExpression or deliverExpression.
When[char] returns False, completeExpression is called.
When the input CharacterStream terminates with Stream[Noop], deliverExpression is called and Noop[?] is returned if the ExpressionStack is not empty.
�before the ExpressionCharacterMachine[�] has detected an end bracket, .
completeExpression is called only when it is positively known that an Expression has been parsed and its last end bracket has been reached. completeExpression is expected to generate a Sequence with the ExpressionBranch structure.� The subContext containing completeExpression and its subprocedures, has kept an account (made the necessary assignments) from which the ExpressionBranch structure can be constructed.
The source code for Expression[Branch][input_String] is an envelope that handles the various errors and possibilities that occur when an Expression-String is rendered (or not) to its ExpressionBranch structure. The ExpressionCharacterMachine[char] implements the Expression-String�s CharacterSet and the RuleList assigned with the CharacterSet.
Name[Expression[Branch][input_String],
Cast[{Name[characterStream, Stream[input]],
����������������������� expressionState, char},
If[Not[Pattern[Type[Stream]][characterStream]], (* The characterStream failed. *)
Noop[Expression[Branch]][0, characterStream, expressionState],
(* The characterStream is good. *)� expressionState = True,
����������������������������������� Loop[
Name[char, Reckon[characterStream]],
Pattern[Stream[Noop]][char],
(* See FN#1. *)���������������������������������������������� Sequence[Noop[characterStream],
����������������������������������������������������������������������������������� If[Pattern[{}][ExpressionStack], ExpressionBranch,
����������������������������������������������������������� ����������������������������������� Noop[Expression[Branch]][Slot[characterStream],
����������������������������������������������������������������������������������� ������� �Missing end bracket detected at character ``.�, input]]],
(*If expressionState is True, Loop[].*) Name[expressionState, ExpressionCharacterMachine[char]], Loop[],
(* the last Character (�end bracket�) of a complete Expression has been reached. *)
Not[expressionState], completeExpression,
(* The ExpressionCharacterMachine[char] is not Boolean so the characterStream is terminated� *)
Sequence[Noop[characterStream],
(* End characterStream and pass the error messages to output� *)
Pattern[Type[Noop[Expression[Branch]]]][char]], char,
True, Noop[Expression[Branch]][
Slot[characterStream], Noop[Noop][expressionState]]]
(* Noop[Noop] is a token for errors that should not occur (if other procedures are working correctly)�*)
]
]]]]
] ] ]
(*
At the end of input� When the input CharacterStream terminates with Stream[Noop], there are no more characters and an Expression is either going to be delivered or not.� If the ExpressionStack is empty the Expression[Branch] structure is returned.� If the ExpressionStack is not empty, Noop[Expression[Branch]][Slot[characterStream], �Missing end bracket detected at character ``.�] is returned.
*)