Commit 8b742e1b authored by Sebastian Pretscher's avatar Sebastian Pretscher

Added the minijava project

parent 47f19878
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="java-cup-11b-runtime.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MiniJavaPlugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MiniJavaPlugin
Bundle-SymbolicName: MiniJavaPlugin;singleton:=true
Bundle-Version: 1.0.0.alpha
Bundle-Activator: minijavaplugin.Activator
Bundle-Vendor: Michael Petter
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui.editors;bundle-version="3.8.100",
org.eclipse.jface.text;bundle-version="3.8.101",
org.eclipse.ui.views;bundle-version="3.6.100"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
java-cup-11b-runtime.jar
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
java-cup-11b-runtime.jar
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="sampleBuilder"
name="MiniJava Project Builder"
point="org.eclipse.core.resources.builders">
<builder
hasNature="true">
<run
class="minijavaplugin.builder.MiniJavaBuilder">
</run>
</builder>
</extension>
<extension
id="sampleNature"
name="MiniJava Project Nature"
point="org.eclipse.core.resources.natures">
<runtime>
<run
class="minijavaplugin.builder.MiniJavaNature">
</run>
</runtime>
<builder
id="MiniJavaPlugin.sampleBuilder">
</builder>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
name="MiniJava Project Nature commands"
id="MiniJavaPlugin.sampleNature.category">
</category>
<command
name="Add/Remove MiniJava Project Nature"
defaultHandler="minijavaplugin.builder.AddRemoveMiniJavaNatureHandler"
categoryId="MiniJavaPlugin.sampleNature.category"
id="MiniJavaPlugin.addRemoveSampleNature">
</command>
<command
id="MiniJavaPlugin.refactorRename"
name="RefactorRename">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.ui.projectConfigure?after=additions">
<command
commandId="MiniJavaPlugin.addRemoveSampleNature"
label="Disable MiniJava builder"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<and>
<instanceof
value="org.eclipse.core.resources.IProject">
</instanceof>
<test
value="MiniJavaPlugin.sampleNature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</visibleWhen>
</command>
<command
commandId="MiniJavaPlugin.addRemoveSampleNature"
label="Enable MiniJava builder"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<and>
<instanceof
value="org.eclipse.core.resources.IProject">
</instanceof>
<not>
<test
value="MiniJavaPlugin.sampleNature"
property="org.eclipse.core.resources.projectNature">
</test>
</not>
</and>
</iterate>
</with>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:#TextEditorContext?after=additions">
<command
commandId="MiniJavaPlugin.refactorRename"
label="Rename ..."
style="push">
</command>
</menuContribution>
</extension>
<extension
id="xmlProblem"
name="XML Problem"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.problemmarker">
</super>
<persistent
value="true">
</persistent>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="minijavaplugin.MiniJavaEditor"
extensions="minijava"
default="false"
id="minijavaplugin.MiniJavaEditor"
name="MiniJava Editor">
</editor>
</extension>
<extension
id="minijava.MiniJavaError"
name="MiniJava Parsing Error"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.textmarker">
</super>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="minijavaplugin.RefactorRenameAction"
commandId="MiniJavaPlugin.refactorRename">
</handler>
</extension>
</plugin>
package compiler;
import minijava.*;
import java.util.*;
import java.io.*;
public class CFGGenerator extends MinijavaVisitor implements Constants{
PrintWriter writer;
public CFGGenerator(String filename){
try{
writer = new PrintWriter(filename+".cfg.mp");
}catch(IOException ioe){
ioe.printStackTrace();
}
}
public void flush(){
writer.flush();
writer.close();
}
private int boxcounter = 1;
private int verzweigungstiefe=1;
public boolean preVisit(Program p){
writer.println("prologues:=3;");
writer.println("verbatimtex");
writer.println("%&latex");
writer.println("\\documentclass{article}");
writer.println("\\usepackage{graphics}");
writer.println("\\usepackage{color}");
writer.println("\\definecolor{dgreen}{rgb}{0.1,0.5,0.1}");
writer.println("\\begin{document}");
writer.println("etex");
writer.println("input expressg;");
writer.println("beginfig(1);");
writer.println("z0=(0,0);");
writer.println("drawovalbox(0,40,17)(btex \\tt start etex);");
return true;
}
public void postVisit(Program p){
writer.println("z"+boxcounter+"=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawovalbox("+boxcounter+",40,17)(btex \\tt stop etex);");
boxcounter++;
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
writer.println("endfig;");
writer.println("end;");
}
public boolean preVisit(Stmt.Assign i){
String text = " "+i.toString();
int length= (text.length()+1)*5;
writer.println("z"+boxcounter+"c=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawENT("+ boxcounter++ +","+length+",17)(btex \\tt "+text+" etex);");
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
return true;
}
public boolean preVisit(Stmt.Write i){
String text = i.toString();
int length= 5+ (text.length()+1)*5;
writer.println("z"+boxcounter+"c=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawLEVENT("+ boxcounter++ +","+length+",17)(btex \\tt "+i+" etex);");
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
return true;
}
public void visit(Stmt.Read i){
String text = i.toString();
int length= 5+ (text.length()+1)*5;
writer.println("z"+boxcounter+"c=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawLEVENT("+ boxcounter++ +","+length+",17)(btex \\tt "+i+" etex);");
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
}
public boolean preVisit(Stmt.IfThenElse i){
verzweigungstiefe++;
int spreading = 100-verzweigungstiefe*20;
String text = i.cond.toTexString();
int length= 10+ (text.length()+1)*5;
int ifhead = boxcounter;
writer.println("z"+boxcounter+"c=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawdiamondbox("+ boxcounter++ +","+length+",25)(btex \\tt "+text+" etex);");
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
writer.println("z"+boxcounter+"bm=z"+ifhead+" shifted ("+spreading+",0);");
writer.println("z"+boxcounter+"c=z"+(boxcounter)+"bm;");
writer.println("label(btex {\\color{dgreen}\\tt yes} etex,z"+boxcounter+"c);");
writer.println("drawnormal("+ifhead+"mr,"+(boxcounter)+"bm);");
boxcounter++;
i.then.accept(this);
int thenend = boxcounter-1;
writer.println("z"+boxcounter+"bm=z"+ifhead+" shifted (-"+spreading+",0);");
writer.println("z"+boxcounter+"c=z"+(boxcounter)+"bm;");
writer.println("label(btex {\\color{red}\\tt no} etex,z"+boxcounter+"c);");
writer.println("drawnormal("+ifhead+"ml,"+(boxcounter)+"bm);");
boxcounter++;
if(i.els!=null) i.els.accept(this);
int elseend = boxcounter-1;
writer.println("z"+boxcounter+"=1/2[z"+thenend+"c,z"+elseend+"c] shifted (0,-20);");
int join=boxcounter;
boxcounter++;
// writer.println("drawnormal("+thenend+"bm,"+(boxcounter-2)+"c);");
// writer.println("drawnormal("+(boxcounter-4)+"bm,"+(boxcounter-3)+"c);");
writer.println("z"+boxcounter+"=(x"+thenend+"c,y"+join+") shifted(0,-40);");
boxcounter++;
writer.println("z"+boxcounter+"=(x"+elseend+"c,y"+join+") shifted(0,-40);");
boxcounter++;
// writer.println("z"+boxcounter+"bm=(x"+ifhead+",min(y"+thenend+",y"+join+"));");
// writer.println("z"+boxcounter+"c=(x"+ifhead+",y"+(boxcounter)+"bm);");
writer.println("z"+boxcounter+"=z"+join+" shifted(0,-40);");
writer.println("z"+boxcounter+"c=z"+join+" shifted(0,-50);");
writer.println("z"+boxcounter+"bm=z"+boxcounter+";");
writer.println("drawnormalthree("+thenend+"bm,"+(boxcounter-2)+","+(boxcounter)+");");
writer.println("drawnormalthree("+elseend+"bm,"+(boxcounter-1)+","+(boxcounter)+");");
boxcounter++;
//writer.println("z"+boxcounter+"c="+(boxcounter-1)+";");
verzweigungstiefe--;
return false;
}
public boolean preVisit(Stmt.Loop i){
verzweigungstiefe++;
int spreading = 100-verzweigungstiefe*20;
String text = i.cond.toTexString();
int length= 10+ (text.length()+1)*5;
int loophead = boxcounter;
writer.println("z"+boxcounter+"=z"+(boxcounter-1)+"c-(0,"+30+");");
writer.println("drawdiamondbox("+ boxcounter++ +","+length+",25)(btex \\tt "+text+" etex);");
writer.println("drawnormalCA("+(boxcounter-2)+"bm,"+(boxcounter-1)+"tm);");
writer.println("z"+boxcounter+"bm=z"+(boxcounter-1)+" shifted ("+spreading+",0);");
writer.println("z"+boxcounter+"c=z"+(boxcounter)+"bm;");
writer.println("label(btex {\\color{dgreen}\\tt yes} etex,z"+boxcounter+"c);");
writer.println("drawnormal("+(boxcounter-1)+"mr,"+(boxcounter)+"bm);");
boxcounter++;
i.body.accept(this);
writer.println("z"+boxcounter+"=z"+(boxcounter-1)+"c shifted (-70,0);");
writer.println("drawnormalthreeCA("+(boxcounter-1)+"ml,"+boxcounter+","+(loophead)+"bm);");
boxcounter++;
writer.println("z"+boxcounter+"bm=z"+loophead+" shifted (-50,0);");
writer.println("z"+boxcounter+"c=z"+(boxcounter)+"bm;");
writer.println("drawnormal("+loophead+"ml,"+(boxcounter)+"bm);");
writer.println("label(btex {\\color{red}\\tt no} etex,z"+boxcounter+"c);");
boxcounter++;
verzweigungstiefe--;
return false;
}
}
package compiler;
import minijava.*;
import minijavaplugin.builder.MiniJavaErrorHandler;
import java.util.*;
import java.io.*;
public class DeclarationUseVisitor extends MinijavaVisitor implements Constants{
private MiniJavaErrorHandler reporter;
public DeclarationUseVisitor(MiniJavaErrorHandler reporter){
this.reporter=reporter;
}
public Hashtable<String, Expr.Identifier> use2decl = new Hashtable<>();
public boolean preVisit(Stmt.Assign i){
if (!use2decl.containsKey(i.lhs))
reporter.error("LHS-Identifier not declared yet! ", i.left,i.right);
return true;
}
public void visit(Stmt.Read i){
if (!use2decl.containsKey(i.lhs))
reporter.error("LHS-Identifier not declared yet! ", i.left,i.right);
}
public boolean preVisit(Decl d){
for (Expr.Identifier id : d.varlist){
if (use2decl.containsKey(id.i))
reporter.error("Identifier already declared ", id.left,id.right);
else
use2decl.put(id.i,id);
}
return true;
}
public void visit(Expr.Identifier d){
if (!use2decl.containsKey(d.i))
reporter.error("Identifier not declared yet! ", d.left,d.right);
}
}
This diff is collapsed.
package compiler;
import java_cup.runtime.ComplexSymbolFactory;
import java.io.*;
import minijava.*;
public class Main {
/**
* Runs the parser on an input file.
*
*
* @param argv the command line, argv[0] is the filename to run
* the parser on.
*/
public static void main(String argv[])
throws java.io.IOException, java.lang.Exception
{
Lexer scanner = null;
ComplexSymbolFactory csf = new ComplexSymbolFactory();
try {
scanner = new Lexer( new java.io.FileReader(argv[1]),csf );
}
catch (java.io.FileNotFoundException e) {
System.err.println("File not found : \""+argv[1]+"\"");
System.exit(1);
}
catch (java.io.IOException e) {
System.err.println("Error opening file \""+argv[1]+"\"");
System.exit(1);
}
catch (ArrayIndexOutOfBoundsException e) {
System.err.println("Usage : java Main <inputfile>");
System.exit(1);
}
try {
Parser p = new Parser(scanner,csf);
Program result = (Program)p.parse().value;
if (argv[0].equals("-jvm")) {
MiniJVMGenerator jvm = new MiniJVMGenerator(argv[1]);
result.accept(jvm);
jvm.flush();
}
if (argv[0].equals("-syntax")) {
SyntaxTreeGenerator syntax = new SyntaxTreeGenerator(argv[1]);
result.accept(syntax);
syntax.flush();
}
if (argv[0].equals("-cfg")) {
CFGGenerator syntax = new CFGGenerator(argv[1]);
result.accept(syntax);
syntax.flush();
}
//System.out.println(result.toString());
}
catch (java.io.IOException e) {
System.err.println("An I/O error occured while parsing : \n"+e);
System.exit(1);
}
}
}
package compiler;
import minijava.*;
import java.util.*;
import java.io.*;
public class MiniJVMGenerator extends MinijavaVisitor implements Constants{
PrintWriter writer;
public MiniJVMGenerator(OutputStream out){
writer = new PrintWriter(out);
}
public MiniJVMGenerator(String filename){
try{
writer = new PrintWriter(filename+".jvm");
}catch(IOException ioe){
ioe.printStackTrace();
}
}
public void flush(){
writer.flush();
writer.close();
}
int declcounter = 0;
int loopcounter = 0;
int ifcounter = 0;
Map<String,Integer> symtab = new HashMap<String,Integer>();
public void postVisit(Program p){
writer.println("HALT");
}
public boolean preVisit(Stmt.Assign i){
writer.print("// "+i);
return true;
}
public void postVisit(Stmt.Assign i){
writer.println("STORE "+symtab.get(i.lhs));
}
public boolean preVisit(Stmt.Write i){
writer.print("// "+i);
return true;
}
public void postVisit(Stmt.Write i){
writer.println("WRITE");
}
public void visit(Stmt.Read i){
writer.print("// "+i);
writer.println("READ");
writer.println("STORE "+symtab.get(i.lhs));
}
public boolean preVisit(Stmt.IfThenElse i){
int e = ifcounter++;
int end = ifcounter++;
writer.println("// "+i.cond);
i.cond.accept(this);
writer.println("FJUMP IF"+e);
i.then.accept(this);
if (i.els!=null)
writer.println("JUMP IF"+end);
writer.print("IF"+e+":");
if(i.els!=null) {
i.els.accept(this);
writer.println("IF"+end+":");
}
return false;
}
public boolean preVisit(Stmt.Loop i){
int loop = loopcounter++;
int loopexit = loopcounter++;
writer.println("//"+ i.cond+" ??" );
writer.print("L"+ loop +":" );
i.cond.accept(this);
writer.println("FJUMP L"+loopexit);
i.body.accept(this);
writer.println("JUMP L"+loop);
writer.print("L"+loopexit+":");
return false;
}
public boolean preVisit(Decl d){
writer.print("//"+d);
return true;
}
public void postVisit(Decl d){
for (Expr.Identifier s :d.varlist) symtab.put(s.i,declcounter++);
writer.println("ALLOC "+d.varlist.size());
}
public void postVisit(Cond.BUnOp i){
writer.println("NOT");
}
public void postVisit(Cond.BinCond i){
if (i.op==LEQ) writer.println("LEQ");
if (i.op==LE) writer.println("LESS");
if (i.op==GTQ) writer.println("GTQ");
if (i.op==GT) writer.println("GT");
if (i.op==EQ) writer.println("EQ");
if (i.op==NEQ) writer.println("NEQ");
}
public void postVisit(Cond.BBinCond i){
if (i.op==AND) writer.println("AND");
if (i.op==OR) writer.println("OR");
}
public void visit(Cond.BoolConst d){
writer.println("???");
}
public void visit(Expr.Identifier d){
writer.println("LOAD "+symtab.get(d.i));
}
public void visit(Expr.IntConst d){
writer.println("CONST "+d.i);
}
public void postVisit(Expr.Binex i){
if (i.op==PLUS) writer.println("ADD");
if (i.op==MINUS) writer.println("SUB");
if (i.op==MULT) writer.println("MUL");
if (i.op==DIV) writer.println("DIV");
if (i.op==MOD) writer.println("MOD");
}
public void postVisit(Expr.Unex i){
writer.println("NEG");
}
}
This diff is collapsed.
package compiler;
import minijava.*;
import java.util.*;
import java.io.*;
public class SyntaxTreeGenerator extends MinijavaVisitor implements Constants{
PrintWriter writer;
public SyntaxTreeGenerator(String filename){
try{
writer = new PrintWriter(filename+".mp");
}catch(IOException ioe){
ioe.printStackTrace();
}
}
public void flush(){
writer.flush();
writer.close();
}
public boolean preVisit(Program p){
writer.println("prologues:=3;");
writer.println("verbatimtex");
writer.println("%&latex");
writer.println("\\documentclass{article}");
writer.println("\\usepackage{graphics}");
writer.println("\\usepackage{color}");
writer.println("\\definecolor{dgreen}{rgb}{0.1,0.5,0.1}");
writer.println("\\begin{document}");
writer.println("etex");
writer.println("input boxes;");
writer.println("input trees;");
writer.println("beginfig(1);");
writer.println("interim levelsep:=80pt;");
writer.println("interim treesep:=-2pt;");
writer.println("tree.root(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}program}} etex)(");
p.ld.get(0).accept(this);
for (int i = 1; i< p.ld.size();i++) {
writer.print(",");
p.ld.get(i).accept(this);
}
writer.print(",");
p.ls.get(0).accept(this);
for (int i = 1; i< p.ls.size();i++) {
writer.print(",");
p.ls.get(i).accept(this);
}
writer.println(");");
writer.println("drawtrees(root);");
writer.println("endfig;");
writer.println("end;");
return false;
}
public boolean preVisit(Decl d){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}decl}} etex)(");
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}type}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} int} etex))\n");
writer.println(",tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}name}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+d.varlist.get(0)+"} etex))");
for (int i=1; i< d.varlist.size(); i++)
writer.println(",leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} ,} etex),tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}name}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+d.varlist.get(i)+"} etex))");
writer.println(",leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} ;} etex))");
return true;
}
public boolean preVisit(Stmt.Assign a){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}stmt}} etex)(");
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}name}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+a.lhs+"} etex)),leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} =} etex),");
return true;
}
public void postVisit(Stmt.Assign a){
writer.println(",leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} ;} etex))");
}
public boolean preVisit(Expr.Priority p){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}expr}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} $($} etex),");
p.e.accept(this);
writer.println(",leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} $)$} etex))");
return false;
}
public boolean preVisit(Cond.Priority p){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}cond}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} $($} etex),");
p.c.accept(this);
writer.println(",leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} $)$} etex))");
return false;
}
public boolean preVisit(Expr.Binex i){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}expr}} etex)(");
i.e1.accept(this);
String operator=null;
if (i.op==PLUS) operator = "+";
if (i.op==MINUS) operator = "-";
if (i.op==MULT) operator = "*";
if (i.op==DIV) operator = "/";
if (i.op==MOD) operator = "\\%";
writer.println(",tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}binop}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+operator+"} etex)),");
i.e2.accept(this);
writer.println(")");
return false;
}
public void visit(Expr.Identifier d){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}expr}} etex)(tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}name}} etex)(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+d.i+"} etex)))");
}
public void visit(Expr.IntConst d){
writer.println("tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}expr}} etex)(tree(btex \\fcolorbox{blue}{white}{\\tt {\\color{dgreen}number}} etex)");
writer.println("(leaf(btex \\fcolorbox{red}{white}{\\phantom{!g}\\tt\\hspace{-1.2em} "+d.i+"} etex)))");