Beispiel #1
0
        private void ParseAddExpression()
        {
            ParseMulExpression();
            while (IsNextTokenAddOp())
            {
                Token addOp = NextToken();
                ParseMulExpression();
                switch (addOp.Value)
                {
                case "+":
                    _codeGenerator.Add();
                    break;

                case "-":
                    _codeGenerator.Sub();
                    break;

                default:
                    ThrowCompilationException("Unexpected add operator " + addOp.Value);
                    break;
                }
            }
        }