Compiler
Compiler
Compiler
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
LiteralAST<br />
public class LiteralAST extends ExprAST {<br />
int v = 0;<br />
public LiteralAST(Token tok) {<br />
v = Integer.parseInt(tok.getText());<br />
}<br />
public int value() {<br />
return v;<br />
}<br />
…<br />
}<br />
public String pretty() {<br />
return ""+v;<br />
}<br />
<strong>Compiler</strong><br />
Abstract Syntax Trees 15