public override CILInstructionField BuildNode(ParseTreeNode node)
        {
            CILInstructionField result = null;

            var instrFieldParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.INSTR_FIELD);

            var ldfldParseTreeNode = instrFieldParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_ldfld);

            if (ldfldParseTreeNode != null)
            {
                result = new LoadFieldInstruction();
            }

            var ldfldaParseTreeNode = instrFieldParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_ldflda);

            if (ldfldaParseTreeNode != null)
            {
                result = new LoadFieldAddressInstruction();
            }

            var ldsfldParseTreeNode = instrFieldParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_ldsfld);

            if (ldsfldParseTreeNode != null)
            {
                result = new LoadStaticFieldInstruction();
            }

            var stfldParseTreeNode = instrFieldParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_stfld);

            if (stfldParseTreeNode != null)
            {
                result = new SetFieldInstruction();
            }

            var stsfldParseTreeNode = instrFieldParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_stsfld);

            if (stsfldParseTreeNode != null)
            {
                result = new SetStaticFieldInstruction();
            }

            if (result != null)
            {
                var typeParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.type);
                result.FieldType = TypeParseTreeNodeHelper.GetType(typeParseTreeNode);

                var typeSpecParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.typeSpec);
                result.FieldOwnerTypeSpecification = TypeSpecParseTreeNodeHelper.GetValue(typeSpecParseTreeNode);

                var idParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.id);
                result.FieldName = IdParseTreeNodeHelper.GetValue(idParseTreeNode);

                return(result);
            }

            throw new ArgumentException("Cannot recognize CIL instruction field.");
        }
        public override CILInstructionMethod BuildNode(ParseTreeNode node)
        {
            CILInstructionMethod result = null;

            var instrMethodParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.INSTR_METHOD);

            var callParseTreeNode = instrMethodParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_call);

            if (callParseTreeNode != null)
            {
                result = new CallInstruction();
            }

            var callvirtParseTreeNode = instrMethodParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_callvirt);

            if (callvirtParseTreeNode != null)
            {
                result = new CallVirtualInstruction();
            }

            var newobjParseTreeNode = instrMethodParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_newobj);

            if (newobjParseTreeNode != null)
            {
                result = new NewObjectInstruction();
            }

            if (result != null)
            {
                var typeParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.type);
                result.MethodReturnType = TypeParseTreeNodeHelper.GetType(typeParseTreeNode);

                var typeSpecParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.typeSpec);
                result.TypeSpecification = TypeSpecParseTreeNodeHelper.GetValue(typeSpecParseTreeNode);

                var methodNameParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.methodName);
                result.MethodName = MethodNameParseTreeNodeHelper.GetMethodName(methodNameParseTreeNode);

                var sigArgs0ParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.sigArgs0);
                result.MethodArgumentTypes = SigArgs0ParseTreeNodeHelper.GetTypes(sigArgs0ParseTreeNode);

                var callConvParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.callConv);
                result.CallConvention = CallConvParseTreeNodeHelper.GetValue(callConvParseTreeNode);

                return(result);
            }

            throw new ArgumentException("Cannot recognize CIL instruction method.");
        }
        public override CILInstructionType BuildNode(ParseTreeNode node)
        {
            var instrTypeParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.INSTR_TYPE);

            CILInstructionType result = null;

            var boxParseTreeNode = instrTypeParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_box);

            if (boxParseTreeNode != null)
            {
                result = new BoxInstruction();
            }

            var newarrParseTreeNode = instrTypeParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_newarr);

            if (newarrParseTreeNode != null)
            {
                result = new NewArrayInstruction();
            }

            var unboxanyParseTreeNode = instrTypeParseTreeNode?.GetFirstChildWithGrammarName(GrammarNames.keyword_unboxany);

            if (unboxanyParseTreeNode != null)
            {
                result = new UnboxAnyInstruction();
            }

            if (result != null)
            {
                var typeSpecParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.typeSpec);
                result.TypeSpecification = TypeSpecParseTreeNodeHelper.GetValue(typeSpecParseTreeNode);

                return(result);
            }

            throw new ArgumentException("Cannot recognize CIL instruction type.");
        }