Ejemplo n.º 1
0
    /// <summary>
    /// Verifies that the general structure of the program is correct.
    /// Called by <see cref="Marbles"/>.
    /// </summary>
    void PROGRAM()
    {
        while (la.kind == 18)           // "asset"
        {
            int index = CREATE_ASSET();
            try { MemoryManager.SetAssetInMemory((Asset)Utilities.finalAssetsInCanvas[index]); }
            catch (Exception e) { SemErr(e.Message); }
        }
        AssetIndex = 0;
        while (la.kind == 16)           // "var"
        // receive new variable to be created
        {
            Variable newGlobalVariable = CREATE_VAR();

            // try to add it to globals
            try { MemoryManager.AddGlobalVariable(newGlobalVariable); }
            catch (Exception e) { SemErr(e.Message); }
        }
        while (la.kind == 9)           // "function"
        {
            CREATE_FUNCTION();
        }
        Expect(6);         // "instructions"
        Expect(7);         // '{'
        QuadrupleManager.UpdateBeginQuadruple();
        while (StartOf(1))
        {
            INSTRUCTION();
        }
        Expect(8);         // '}'
    }