Exemple #1
0
        public Code EvalLiteralWordAtom(ParseTreeNode node, ref CgContext ctx)
        {
            switch (node.Term.Name)
            {
                case "identifier":
                    return new Code(EvalIdentifier(node, ref ctx));

                case "character":
                    return new Code(EvalCharacter(node, ref ctx));

                case "number":
                    return new Code(EvalNumber(node, ref ctx));

                case "DifferenceLiteral":
                    {
                        var @base = ctx.GetCurrentAddress();
                        var target = EvalLiteralWordAtom(node.ChildNodes[0].ChildNodes[0], ref ctx);
                        return ctx.EncodeDifference(new Difference(@base, target));
                    }

                case "DifferenceTo":
                    return EvalLiteralWordAtom(node.ChildNodes[0], ref ctx);

                default:
                    throw new UnexpectedGrammarException();
            }
        }