Zeal.Compiler.Parser.ZealCpuDriver.SecondPass C# (CSharp) Method

SecondPass() public method

public SecondPass ( ) : void
return void
        public void SecondPass()
        {
            if (Vectors == null)
            {
                ErrorMessage error = new ErrorMessage();
                error.SourceFile = SourceFilePath;
                error.Message = "Required vectors statement not found.";
                Errors.Add(error);
            }

            ParseTreeWalker walker = new ParseTreeWalker();
            walker.Walk(new SecondCpuPass(this), _rootTree);

            if (Errors.Count > 0)
            {
                throw new CompilerErrorException();
            }
        }

Usage Example

Example #1
0
        public void ShouldResolveLabelsOutsideScope()
        {
            const string input =
            @"
            vectors
            {
            BRK = EmptyVector
            IRQ = EmptyVector
            NMI = EmptyVector
            Reset = Main
            }

            procedure Main
            {
            jsr Test
            }

            procedure Test
            {
            php
            rep #$30
            pha

            lda #$03

            pla
            plp
            rts
            }

            interrupt EmptyVector
            {
            }
            ";
            ZealCpuDriver driver = new ZealCpuDriver(input.ToMemoryStream());

            driver.Parse();
            driver.SecondPass();

            var mainProcedure = driver.GlobalScope.Children[0];
            Assert.Equal(true, mainProcedure.IsLabelValid("Test"));
            Assert.Equal(3, mainProcedure.AddressFor("Test"));
        }
All Usage Examples Of Zeal.Compiler.Parser.ZealCpuDriver::SecondPass