\begin{figure}
\begin{boxedminipage}[t]{\textwidth}
\begin{minipage}[l]{0.5\textwidth}
\textbf{A. Abstract Syntax}
\scriptsize
\begin{verbatim}
public class PROGRAM {
  public ListEXP listexp_;
  public PROGRAM(ListEXP p1) { listexp_ = p1; }
}
public abstract class EXP {}
public class EAnd extends EXP {
  public EXP exp_1, exp_2;
  public EAnd(EXP p1, EXP p2) { exp_1 = p1; exp_2 = p2; }
}
public class EOr extends EXP {
  public EXP exp_1, exp_2;
  public EOr(EXP p1, EXP p2) { exp_1 = p1; exp_2 = p2; }
}
public class ETrue extends EXP {
  public ETrue() { }
}
public class EFalse extends EXP {
  public EFalse() { }
}
public class EVar extends EXP {
  public String ident_;
  public EVar(String p1) { ident_ = p1; }
}
public class ListEXP {
  public EXP exp_;
  public ListEXP listexp_; 
  public ListEXP(EXP p1, ListEXP p2)
    { exp_ = p1; listexp_ = p2; }
}
\end{verbatim}
\normalsize
\textbf{B. JLex Lexer}
\scriptsize
\begin{verbatim}
<YYINITIAL>\|\| { return new Symbol(sym._SYMB_0); }
<YYINITIAL>&& { return new Symbol(sym._SYMB_1); }
<YYINITIAL>; { return new Symbol(sym._SYMB_2); }
<YYINITIAL>\( { return new Symbol(sym._SYMB_3); }
<YYINITIAL>\) { return new Symbol(sym._SYMB_4); }
<YYINITIAL>false { return new Symbol(sym._SYMB_5); }
<YYINITIAL>true { return new Symbol(sym._SYMB_6); }
<YYINITIAL>{LETTER}{IDENT}* { 
   return new Symbol(sym._IDENT_, new String(yytext())); }
<YYINITIAL>[ \t\r\n\f] { /* ignore white space. */ }
\end{verbatim}
\normalsize
\textbf{C. CUP Parser}
\scriptsize
\begin{verbatim}
terminal _SYMB_0;    //   ||
terminal _SYMB_1;    //   &&
terminal _SYMB_2;    //   ;
terminal _SYMB_3;    //   (
terminal _SYMB_4;    //   )
terminal _SYMB_5;    //   false
terminal _SYMB_6;    //   true
terminal String _IDENT_;

PROGRAM ::= ListEXP:p_1  {: 
    if (p_1 != null) p_1 = p_1.reverse();
    RESULT = new Absyn.PROGRAM(p_1); :} 
;
EXP ::= EXP:p_1 _SYMB_0 EXP1:p_3  {: 
    RESULT = new Absyn.EOr(p_1, p_3); :} 
  | EXP1:p_1  {:  RESULT = (p_1); :}
;
EXP1 ::= EXP1:p_1 _SYMB_1 EXP2:p_3  {:
  RESULT = new Absyn.EAnd(p_1, p_3); :} 
  | EXP2:p_1  {:  RESULT = (p_1); :}
;
EXP2 ::= _SYMB_6  {:  RESULT = new Absyn.ETrue(); :} 
  | _SYMB_5  {:  RESULT = new Absyn.EFalse(); :}
  | _IDENT_:p_1  {:  RESULT = new Absyn.EVar(p_1); :}
  | _SYMB_3 EXP:p_2 _SYMB_4  {:  RESULT = (p_2); :}
;
ListEXP ::=  /* empty */  {: RESULT = null; :} 
  | ListEXP:p_1 EXP:p_2 _SYMB_2  {:
      RESULT = new Absyn.ListEXP(p_2, p_1); :}
;
\end{verbatim}
\normalsize
\end{minipage}
\hfill
\begin{minipage}[r]{0.5\textwidth}
\textbf{D. Pretty Printer}
\scriptsize
\begin{verbatim}
  private static void pp(Absyn.EXP exp, int _i_) {
    if (exp instanceof Absyn.EOr) {
       Absyn.EOr eor = (Absyn.EOr) exp;
       if (_i_ > 0) render(_L_PAREN);
       pp(eor.exp_1, 0);
       render("||");
       pp(eor.exp_2, 1);
       if (_i_ > 0) render(_R_PAREN);
    }
    if (exp instanceof Absyn.EAnd) {
       Absyn.EAnd eand = (Absyn.EAnd) exp;
       if (_i_ > 1) render(_L_PAREN);
       pp(eand.exp_1, 1);
       render("&&");
    ...
\end{verbatim}
\normalsize
\textbf{E. Abstract Syntax Viewer}
\scriptsize
\begin{verbatim}
  private static void sh(Absyn.EXP exp)
  {
    if (exp instanceof Absyn.EOr) {
       Absyn.EOr eor = (Absyn.EOr) exp;
       render("(");
       render("EOr");
       sh(eor.exp_1);
       sh(eor.exp_2);
       render(")");
    }
    if (exp instanceof Absyn.EAnd) {
       Absyn.EAnd eand = (Absyn.EAnd) exp;
       render("(");
       render("EAnd");
    ...
\end{verbatim}
\normalsize

\textbf{F. Visitor Design Pattern}

\scriptsize
\begin{verbatim}
  public void visitEOr(Absyn.EOr eor) {
    /* Code For EOr Goes Here */
    eor.exp_1.accept(this);
    eor.exp_2.accept(this);
  }
  public void visitEAnd(Absyn.EAnd eand) {
    /* Code For EAnd Goes Here */
    ...
  public void visitListEXP(Absyn.ListEXP listexp) {
    while(listexp!= null) {
      /* Code For ListEXP Goes Here */
      listexp.listexp_.accept(this);
      listexp = listexp.listexp_;
    }
  }
  ...
\end{verbatim}
\normalsize

\textbf{G. Word Counts}
\scriptsize
\begin{verbatim}
   Lines   Words   Bytes
      11      42     285 Absyn/EAnd.java
      10      29     226 Absyn/EFalse.java
      11      42     282 Absyn/EOr.java
      10      29     223 Absyn/ETrue.java
      11      36     266 Absyn/EVar.java
       3      16     129 Absyn/EXP.java
      36      94     720 Absyn/ListEXP.java
      11      34     261 Absyn/PROG.java
      44     148    1131 BoolExp.lex
      75     246    1981 BoolExp.cup
     278     742    6962 PrettyPrinter.java
     117     257    2151 Skeleton.java
      48     131    1320 Test.java
      63     197    1638 VisitSkel.java
       6      11      90 Visitable.java
      19      55     584 Visitor.java
      56     154    1763 Makefile
     809    2263   20012 total
\end{verbatim}
\normalsize
\hfill
\end{minipage}
\end{boxedminipage}
\caption{Java source code fragments generated from Figure \ref{fig:source}}
\label{fig:java}
\end{figure}

