step8
Class reg

java.lang.Object
  extended by step8.reg
All Implemented Interfaces:
Visitor

public class reg
extends Object
implements Visitor

output register machine code for mixed-mode expr tree.


Field Summary
protected  HashMap _rules
          maps class to array of Rule.
protected  PrintStream out
          print action stream.
 
Constructor Summary
reg()
           
 
Method Summary
static void main(String[] args)
          read an expression from standard input and generate register machine code.
protected  PrintStream out()
          returns print action stream.
 Object visit(int _action, Object _object)
          visits an object.
 Object visit(Object object)
          visits an object.
 Object visit0(Object object)
          visits an object, ignoring possible descendants.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected transient PrintStream out
print action stream. Can be replaced to reroute output. BUG: should be a self-flushing PrintWriter.


_rules

protected final HashMap _rules
maps class to array of Rule.

Constructor Detail

reg

public reg()
Method Detail

out

protected PrintStream out()
returns print action stream. Defaults to System.out.


visit

public Object visit(Object object)
             throws Exception
visits an object. This is a facade for the class search.

Specified by:
visit in interface Visitor
Parameters:
object - to be visited, not null.
Returns:
result of action.
Throws:
NoRuleException - if no rule can be found.
Exception
See Also:
Rule.visit(jag.Visitor, java.util.HashMap, java.lang.Object, int, java.util.List)

visit0

public Object visit0(Object object)
              throws Exception
visits an object, ignoring possible descendants. This is a facade for the class search with degree zero.

Specified by:
visit0 in interface Visitor
Parameters:
object - to be visited, not null.
Returns:
result of action.
Throws:
NoRuleException - if no rule can be found.
Exception
See Also:
Rule.visit(jag.Visitor, java.util.HashMap, java.lang.Object, int, java.util.List)

visit

public Object visit(int _action,
                    Object _object)
             throws Exception
visits an object.

Specified by:
visit in interface Visitor
Parameters:
_action - index.
_object - to be visited, not null.
Returns:
result of action.
Throws:
NoRuleException - if no rule can be found.
Exception

main

public static void main(String[] args)
                 throws Exception
read an expression from standard input and generate register machine code.

Throws:
Exception