// Path: src/main/java/fi/helsinki/cs/ttk91/TTK91CompileException.java
// public class TTK91CompileException extends TTK91Exception {
//     public TTK91CompileException(String message) {
//         super(message);
//     }
// }


import fi.helsinki.cs.ttk91.TTK91CompileException;
import java.util.*;
import fi.helsinki.cs.titokone.devices.DeviceNames;
        code = new Vector<String>();
        symbols = new HashMap<String, Integer>();
        symbolTable = new Vector<String[]>();

        invalidLabels = new HashMap<String, Integer>();
        invalidLabels.putAll(DeviceNames.DEVICES);
        invalidLabels.putAll(SvcNames.SVCS);
    }

    /**
     * This function goes through one line of the code. On the first
     * round, it gathers the symbols and their definitions to a
     * symbol table and conducts syntax-checking, on the second round
     * it transforms each command to its binary format. For the
     * transformations, the CompileConstants class is used. It calls
     * the private methods firstRoundProcess() and
     * secondRoundProcess() to do the actual work, if there is any to
     * do.  The transfer from first round of compilation to the
     * second is done automatically; during it,
     * initializeSecondRound() is called.
     *
     * @return A CompileInfo debug information object, describing
     *         what happened during the compilation of this line and whether
     *         this is the first or second round of compilation or null if
     *         there are no more lines left to process.
     * @throws TTK91CompileException If a) there is a syntax error
     *                               during the first round of checking (error code 101) or b) a
     *                               symbol is still undefined after the first round of compilation
     *                               is finished.
     */
// Path: src/main/java/fi/helsinki/cs/ttk91/TTK91CompileException.java
// public class TTK91CompileException extends TTK91Exception {
//     public TTK91CompileException(String message) {
//         super(message);
//     }
// }


// Path: src/main/java/fi/helsinki/cs/titokone/Compiler.java
import fi.helsinki.cs.ttk91.TTK91CompileException;
import java.util.*;
import fi.helsinki.cs.titokone.devices.DeviceNames;

        code = new Vector<String>();
        symbols = new HashMap<String, Integer>();
        symbolTable = new Vector<String[]>();

        invalidLabels = new HashMap<String, Integer>();
        invalidLabels.putAll(DeviceNames.DEVICES);
        invalidLabels.putAll(SvcNames.SVCS);
    }

    /**
     * This function goes through one line of the code. On the first
     * round, it gathers the symbols and their definitions to a
     * symbol table and conducts syntax-checking, on the second round
     * it transforms each command to its binary format. For the
     * transformations, the CompileConstants class is used. It calls
     * the private methods firstRoundProcess() and
     * secondRoundProcess() to do the actual work, if there is any to
     * do.  The transfer from first round of compilation to the
     * second is done automatically; during it,
     * initializeSecondRound() is called.
     *
     * @return A CompileInfo debug information object, describing
     *         what happened during the compilation of this line and whether
     *         this is the first or second round of compilation or null if
     *         there are no more lines left to process.
     * @throws TTK91CompileException If a) there is a syntax error
     *                               during the first round of checking (error code 101) or b) a
     *                               symbol is still undefined after the first round of compilation
     *                               is finished.
     */
    public CompileInfo compileLine() throws TTK91CompileException {