<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import bali.Compiler;
import bali.Scanner212;
import bali.BaliException;

import java.io.StringWriter;
import java.io.PrintWriter;

/**
 * This is stub-version of a BaliCompiler.  It does not really work.
 */
public class BaliCompiler implements Compiler{
    
    /**
     * Compiles the Bali code into SaM code
     */
    public String compile(Scanner212 scanner) throws BaliException{
        // Create a StringWriter to simplify printing stuff
        StringWriter outstring = new StringWriter();
        // And a new PrintWriter to simplify things even more
        PrintWriter out = new PrintWriter(outstring);
        // Print out some dumb code
        out.println("PUSHIMMSTR \"This compiler does not work\"");
        out.println("WRITESTR");
        out.println("PUSHIMM 0");
        out.println("STOP");
        // And dump it back
        return outstring.toString();
    }
}
</pre></body></html>