avrora.core.isdl.gen
Class PrettyPrinter

java.lang.Object
  extended byavrora.core.isdl.gen.PrettyPrinter
All Implemented Interfaces:
CodeVisitor, StmtVisitor
Direct Known Subclasses:
InterpreterGenerator

public class PrettyPrinter
extends java.lang.Object
implements StmtVisitor, CodeVisitor


Nested Class Summary
protected  class PrettyPrinter.DefaultMapRep
           
protected static class PrettyPrinter.MapRep
           
 
Nested classes inherited from class avrora.core.isdl.ast.StmtVisitor
StmtVisitor.DepthFirst
 
Nested classes inherited from class avrora.core.isdl.ast.CodeVisitor
CodeVisitor.Default, CodeVisitor.DepthFirst
 
Field Summary
protected  Printer printer
           
 
Constructor Summary
PrettyPrinter(Printer p)
           
 
Method Summary
protected  void binop(java.lang.String op, Expr left, Expr right, int p)
           
protected  PrettyPrinter.MapRep getMapRep(java.lang.String name)
           
protected  java.lang.String getMethod(java.lang.String s)
           
protected  java.lang.String getVariable(Token v)
           
protected  void inner(Expr e, int outerPrecedence)
           
 void visit(Arith.AddExpr e)
           
 void visit(Arith.AndExpr e)
           
 void visit(Arith.CompExpr e)
           
 void visit(Arith.DivExpr e)
           
 void visit(Arith.MulExpr e)
           
 void visit(Arith.NegExpr e)
           
 void visit(Arith.OrExpr e)
           
 void visit(Arith.ShiftLeftExpr e)
           
 void visit(Arith.ShiftRightExpr e)
           
 void visit(Arith.SubExpr e)
           
 void visit(Arith.XorExpr e)
           
 void visit(BitExpr e)
           
 void visit(BitRangeExpr e)
           
 void visit(CallExpr e)
           
 void visit(CallStmt s)
           
 void visit(CommentStmt s)
           
 void visit(ConversionExpr e)
           
 void visit(DeclStmt s)
           
 void visit(IfStmt s)
           
 void visit(Literal.BoolExpr e)
           
 void visit(Literal.IntExpr e)
           
 void visit(Logical.AndExpr e)
           
 void visit(Logical.EquExpr e)
           
 void visit(Logical.GreaterEquExpr e)
           
 void visit(Logical.GreaterExpr e)
           
 void visit(Logical.LessEquExpr e)
           
 void visit(Logical.LessExpr e)
           
 void visit(Logical.NequExpr e)
           
 void visit(Logical.NotExpr e)
           
 void visit(Logical.OrExpr e)
           
 void visit(Logical.XorExpr e)
           
 void visit(MapAssignStmt s)
           
 void visit(MapBitAssignStmt s)
           
 void visit(MapBitRangeAssignStmt s)
           
 void visit(MapExpr e)
           
 void visit(ReturnStmt s)
           
 void visit(VarAssignStmt s)
           
 void visit(VarBitAssignStmt s)
           
 void visit(VarBitRangeAssignStmt s)
           
 void visit(VarExpr e)
           
protected  void visitExprList(java.util.List l)
           
 void visitStmtList(java.util.List l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printer

protected final Printer printer
Constructor Detail

PrettyPrinter

public PrettyPrinter(Printer p)
Method Detail

visit

public void visit(CallExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(MapExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(ConversionExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(VarExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(MapAssignStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(MapBitAssignStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(MapBitRangeAssignStmt s)
Specified by:
visit in interface StmtVisitor

getMethod

protected java.lang.String getMethod(java.lang.String s)

visit

public void visit(CallStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(CommentStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(IfStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(ReturnStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(VarBitAssignStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(VarBitRangeAssignStmt s)
Specified by:
visit in interface StmtVisitor

getVariable

protected java.lang.String getVariable(Token v)

getMapRep

protected PrettyPrinter.MapRep getMapRep(java.lang.String name)

visit

public void visit(DeclStmt s)
Specified by:
visit in interface StmtVisitor

visit

public void visit(VarAssignStmt s)
Specified by:
visit in interface StmtVisitor

inner

protected void inner(Expr e,
                     int outerPrecedence)

binop

protected void binop(java.lang.String op,
                     Expr left,
                     Expr right,
                     int p)

visit

public void visit(Arith.AddExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.AndExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.CompExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.DivExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.MulExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.NegExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.OrExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.ShiftLeftExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.ShiftRightExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.SubExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Arith.XorExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Literal.BoolExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Literal.IntExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.AndExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.EquExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.GreaterEquExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.GreaterExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.LessEquExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.LessExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.NequExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.NotExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.OrExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(Logical.XorExpr e)
Specified by:
visit in interface CodeVisitor

visitStmtList

public void visitStmtList(java.util.List l)

visit

public void visit(BitExpr e)
Specified by:
visit in interface CodeVisitor

visit

public void visit(BitRangeExpr e)
Specified by:
visit in interface CodeVisitor

visitExprList

protected void visitExprList(java.util.List l)