5 public class StandardCodeWriter implements CodeWriter {
7 boolean linestarted = false;
9 java.io.PrintWriter output;
10 Stack symboltables = new Stack();
12 public StandardCodeWriter(java.io.PrintWriter output) { this.output = output; }
14 public void startblock() {
19 public void endblock() {
24 public void indent() {
28 public void unindent() {
32 private void doindent() {
33 for (int i = 0; i < indent; i++) {
39 public void outputline(String s) {
48 public void output(String s) {
56 public void pushSymbolTable(SymbolTable st) {
57 symboltables.push(st);
60 public SymbolTable popSymbolTable() {
61 return (SymbolTable) symboltables.pop();
64 public SymbolTable getSymbolTable() {
65 if (symboltables.empty()) {
66 throw new IRException();
68 return (SymbolTable) symboltables.peek();