Java Reference
In-Depth Information
key concepts
expression tree A tree in which the leaves contain operands and the other
nodes contain operators. (468)
infix expression An expression in which a binary operator has arguments to its
left and right. When there are several operators, precedence and associa-
tivity determine how the operators are processed. (454)
lexical analysis The process of recognizing tokens in a stream of symbols.
(448)
operator precedence parsing An algorithm that converts an infix expression to
a postfix expression in order to evaluate the infix expression. (457)
postfix expression An expression that can be evaluated by a postfix machine
without using any precedence rules. (456)
postfix machine Machine used to evaluate a postfix expression. The algorithm
it uses is as follows: Operands are pushed onto a stack and an operator
pops its operands and then pushes the result. At the end of the evaluation,
the stack should contain exactly one element, which represents the result.
(456)
precedence table A table used to decide what is removed from the operator
stack. Left-associative operators have the operator stack precedence set at
1 higher than the input symbol precedence. Right-associative operators go
the other way. (463)
state machine A common technique used to parse symbols; at any point, the
machine is in some state, and each input character takes it to a new state.
Eventually, the state machine reaches a state at which a symbol has been
recognized. (450)
tokenization The process of generating the sequence of symbols (tokens) from
an input stream. (445)
common errors
In production code, input errors must be handled as carefully as possible.
Being lax in this regard leads to programming errors.
1.
For the balanced symbol routine, handling quotes incorrectly is a com-
mon error.
2.
For the infix to postfix algorithm, the precedence table must reflect the
correct precedence and associativity.
3.
 
 
Search WWH ::




Custom Search