1package aud.example.expr;
110 public static void main(String[] args) {
112 String input=(args.length>0) ? args[0] :
"a*b*c";
114 System.out.println(
"input = '"+input+
"'");
120 System.out.println(
"output = '"+tree+
"'");
124 System.out.println(tree.
toTikZ());
BinaryTreeTraversal< T >.Postorder postorder()
Get postorder iterator over nodes in tree .
String toTikZ()
get TikZ code for LaTeX export
Implementation of AbstractQueue as a (dynamically resized) circular buffer based on array.
void enqueue(T x)
Enqueue element at end of queue.
boolean is_empty()
Is queue empty?
T dequeue()
Remove front element from queue.
Same as ExpressionParser but using modified grammar to provide the usual left-associative expressions...
ExpressionTree sum(int level)
parse sum
static void main(String[] args)
test and example for usage
ExpressionTree product(int level)
parse product
Simple expression parser.
ExpressionTree parse(String input)
parse input
ExpressionTree factor(int level)
parse factor
void setVerbose(boolean b)
set verbose mode (report state to System.err)
int lookahead()
helper: "lookahead" is the usual phrasing
void verbose(int level, String message)
helper: print out information
void nextToken()
helper: consume current token and advance to next token
Tree representation of arithmetic expression.
Breaks input string into pieces ("tokens").
AuD lecture: Data structures, algorithms, examples.