public static Network BuildNetwork()
        {
            if (_network != null)
                return _network;

            AlloyAtnBuilder builder = new AlloyAtnBuilder();
            var rules = builder.Rules;

            Nfa.BindRule(rules.CompilationUnit, builder.BuildCompilationUnitRule());
            Nfa.BindRule(rules.Specification, builder.BuildSpecificationRule());
            Nfa.BindRule(rules.Module, builder.BuildModuleRule());
            Nfa.BindRule(rules.Open, builder.BuildOpenRule());
            Nfa.BindRule(rules.Paragraph, builder.BuildParagraphRule());
            Nfa.BindRule(rules.FactDecl, builder.BuildFactDeclRule());
            Nfa.BindRule(rules.AssertDecl, builder.BuildAssertDeclRule());
            Nfa.BindRule(rules.FunDecl, builder.BuildFunDeclRule());
            Nfa.BindRule(rules.FunctionName, builder.BuildFunctionNameRule());
            Nfa.BindRule(rules.FunctionReturn, builder.BuildFunctionReturnRule());
            Nfa.BindRule(rules.FunctionParameters, builder.BuildFunctionParametersRule());
            Nfa.BindRule(rules.DeclList, builder.BuildDeclListRule());
            Nfa.BindRule(rules.CmdDecl, builder.BuildCmdDeclRule());
            Nfa.BindRule(rules.CmdScope, builder.BuildCmdScopeRule());
            Nfa.BindRule(rules.CmdScopeFor, builder.BuildCmdScopeForRule());
            Nfa.BindRule(rules.CmdScopeExpect, builder.BuildCmdScopeExpectRule());
            Nfa.BindRule(rules.TypescopeDeclList, builder.BuildTypescopeDeclListRule());
            Nfa.BindRule(rules.Typescope, builder.BuildTypescopeRule());
            Nfa.BindRule(rules.SigDecl, builder.BuildSigDeclRule());
            Nfa.BindRule(rules.NameList, builder.BuildNameListRule());
            Nfa.BindRule(rules.NameDeclList, builder.BuildNameDeclListRule());
            Nfa.BindRule(rules.SigBody, builder.BuildSigBodyRule());
            Nfa.BindRule(rules.EnumDecl, builder.BuildEnumDeclRule());
            Nfa.BindRule(rules.EnumBody, builder.BuildEnumBodyRule());
            Nfa.BindRule(rules.SigQual, builder.BuildSigQualRule());
            Nfa.BindRule(rules.SigExt, builder.BuildSigExtRule());
            Nfa.BindRule(rules.Expr, builder.BuildExprRule());
            Nfa.BindRule(rules.UnOpExpr1, builder.BuildUnOpExpr1Rule());
            Nfa.BindRule(rules.LetDecls, builder.BuildLetDeclsRule());
            Nfa.BindRule(rules.QuantDecls, builder.BuildQuantDeclsRule());
            Nfa.BindRule(rules.BinOpExpr2, builder.BuildBinOpExpr2Rule());
            Nfa.BindRule(rules.BinOpExpr3, builder.BuildBinOpExpr3Rule());
            Nfa.BindRule(rules.BinOpExpr4, builder.BuildBinOpExpr4Rule());
            Nfa.BindRule(rules.ElseClause, builder.BuildElseClauseRule());
            Nfa.BindRule(rules.BinOpExpr5, builder.BuildBinOpExpr5Rule());
            Nfa.BindRule(rules.UnOpExpr6, builder.BuildUnOpExpr6Rule());
            Nfa.BindRule(rules.BinOpExpr7, builder.BuildBinOpExpr7Rule());
            Nfa.BindRule(rules.CompareOp, builder.BuildCompareOpRule());
            Nfa.BindRule(rules.UnOpExpr8, builder.BuildUnOpExpr8Rule());
            Nfa.BindRule(rules.BinOpExpr9, builder.BuildBinOpExpr9Rule());
            Nfa.BindRule(rules.UnOpExpr10, builder.BuildUnOpExpr10Rule());
            Nfa.BindRule(rules.CountOpExpr11, builder.BuildCountOpExpr11Rule());
            Nfa.BindRule(rules.BinOpExpr12, builder.BuildBinOpExpr12Rule());
            Nfa.BindRule(rules.BinOpExpr13, builder.BuildBinOpExpr13Rule());
            Nfa.BindRule(rules.BinOpExpr14, builder.BuildBinOpExpr14Rule());
            Nfa.BindRule(rules.BinOpExpr15, builder.BuildBinOpExpr15Rule());
            Nfa.BindRule(rules.BinOpExpr16, builder.BuildBinOpExpr16Rule());
            Nfa.BindRule(rules.CallExpr17, builder.BuildCallExpr17Rule());
            Nfa.BindRule(rules.BinOpExpr18, builder.BuildBinOpExpr18Rule());
            Nfa.BindRule(rules.UnOpExpr19, builder.BuildUnOpExpr19Rule());
            Nfa.BindRule(rules.PrimaryExpr, builder.BuildPrimaryExprRule());
            Nfa.BindRule(rules.Decl, builder.BuildDeclRule());
            Nfa.BindRule(rules.LetDecl, builder.BuildLetDeclRule());
            Nfa.BindRule(rules.Quant, builder.BuildQuantRule());
            Nfa.BindRule(rules.ArrowMultiplicity, builder.BuildArrowMultiplicityRule());
            Nfa.BindRule(rules.Block, builder.BuildBlockRule());
            Nfa.BindRule(rules.Name, builder.BuildNameRule());
            Nfa.BindRule(rules.Number, builder.BuildNumberRule());
            Nfa.BindRule(rules.Ref, builder.BuildRefRule());

            List<RuleBinding> ruleBindings =
                new List<RuleBinding>()
                {
                    rules.CompilationUnit,
                    rules.Specification,
                    rules.Module,
                    rules.Open,
                    rules.Paragraph,
                    rules.FactDecl,
                    rules.AssertDecl,
                    rules.FunDecl,
                    rules.FunctionName,
                    rules.FunctionReturn,
                    rules.FunctionParameters,
                    rules.DeclList,
                    rules.CmdDecl,
                    rules.CmdScope,
                    rules.CmdScopeFor,
                    rules.CmdScopeExpect,
                    rules.TypescopeDeclList,
                    rules.Typescope,
                    rules.SigDecl,
                    rules.NameList,
                    rules.NameDeclList,
                    rules.SigBody,
                    rules.EnumDecl,
                    rules.EnumBody,
                    rules.SigQual,
                    rules.SigExt,
                    rules.Expr,
                    rules.UnOpExpr1,
                    rules.LetDecls,
                    rules.QuantDecls,
                    rules.BinOpExpr2,
                    rules.BinOpExpr3,
                    rules.BinOpExpr4,
                    rules.ElseClause,
                    rules.BinOpExpr5,
                    rules.UnOpExpr6,
                    rules.BinOpExpr7,
                    rules.CompareOp,
                    rules.UnOpExpr8,
                    rules.BinOpExpr9,
                    rules.UnOpExpr10,
                    rules.CountOpExpr11,
                    rules.BinOpExpr12,
                    rules.BinOpExpr13,
                    rules.BinOpExpr14,
                    rules.BinOpExpr15,
                    rules.BinOpExpr16,
                    rules.CallExpr17,
                    rules.BinOpExpr18,
                    rules.UnOpExpr19,
                    rules.PrimaryExpr,
                    rules.Decl,
                    rules.LetDecl,
                    rules.Quant,
                    rules.ArrowMultiplicity,
                    rules.Block,
                    rules.Name,
                    rules.Number,
                    rules.Ref,
                };

            throw new NotImplementedException();
            _network = new Network(ruleBindings, null);
            return _network;
        }
Beispiel #2
0
        public static Network BuildNetwork()
        {
            if (_network != null)
            {
                return(_network);
            }

            AlloyAtnBuilder builder = new AlloyAtnBuilder();
            var             rules   = builder.Rules;

            Nfa.BindRule(rules.CompilationUnit, builder.BuildCompilationUnitRule());
            Nfa.BindRule(rules.Specification, builder.BuildSpecificationRule());
            Nfa.BindRule(rules.Module, builder.BuildModuleRule());
            Nfa.BindRule(rules.Open, builder.BuildOpenRule());
            Nfa.BindRule(rules.Paragraph, builder.BuildParagraphRule());
            Nfa.BindRule(rules.FactDecl, builder.BuildFactDeclRule());
            Nfa.BindRule(rules.AssertDecl, builder.BuildAssertDeclRule());
            Nfa.BindRule(rules.FunDecl, builder.BuildFunDeclRule());
            Nfa.BindRule(rules.FunctionName, builder.BuildFunctionNameRule());
            Nfa.BindRule(rules.FunctionReturn, builder.BuildFunctionReturnRule());
            Nfa.BindRule(rules.FunctionParameters, builder.BuildFunctionParametersRule());
            Nfa.BindRule(rules.DeclList, builder.BuildDeclListRule());
            Nfa.BindRule(rules.CmdDecl, builder.BuildCmdDeclRule());
            Nfa.BindRule(rules.CmdScope, builder.BuildCmdScopeRule());
            Nfa.BindRule(rules.CmdScopeFor, builder.BuildCmdScopeForRule());
            Nfa.BindRule(rules.CmdScopeExpect, builder.BuildCmdScopeExpectRule());
            Nfa.BindRule(rules.TypescopeDeclList, builder.BuildTypescopeDeclListRule());
            Nfa.BindRule(rules.Typescope, builder.BuildTypescopeRule());
            Nfa.BindRule(rules.SigDecl, builder.BuildSigDeclRule());
            Nfa.BindRule(rules.NameList, builder.BuildNameListRule());
            Nfa.BindRule(rules.NameDeclList, builder.BuildNameDeclListRule());
            Nfa.BindRule(rules.SigBody, builder.BuildSigBodyRule());
            Nfa.BindRule(rules.EnumDecl, builder.BuildEnumDeclRule());
            Nfa.BindRule(rules.EnumBody, builder.BuildEnumBodyRule());
            Nfa.BindRule(rules.SigQual, builder.BuildSigQualRule());
            Nfa.BindRule(rules.SigExt, builder.BuildSigExtRule());
            Nfa.BindRule(rules.Expr, builder.BuildExprRule());
            Nfa.BindRule(rules.UnOpExpr1, builder.BuildUnOpExpr1Rule());
            Nfa.BindRule(rules.LetDecls, builder.BuildLetDeclsRule());
            Nfa.BindRule(rules.QuantDecls, builder.BuildQuantDeclsRule());
            Nfa.BindRule(rules.BinOpExpr2, builder.BuildBinOpExpr2Rule());
            Nfa.BindRule(rules.BinOpExpr3, builder.BuildBinOpExpr3Rule());
            Nfa.BindRule(rules.BinOpExpr4, builder.BuildBinOpExpr4Rule());
            Nfa.BindRule(rules.ElseClause, builder.BuildElseClauseRule());
            Nfa.BindRule(rules.BinOpExpr5, builder.BuildBinOpExpr5Rule());
            Nfa.BindRule(rules.UnOpExpr6, builder.BuildUnOpExpr6Rule());
            Nfa.BindRule(rules.BinOpExpr7, builder.BuildBinOpExpr7Rule());
            Nfa.BindRule(rules.CompareOp, builder.BuildCompareOpRule());
            Nfa.BindRule(rules.UnOpExpr8, builder.BuildUnOpExpr8Rule());
            Nfa.BindRule(rules.BinOpExpr9, builder.BuildBinOpExpr9Rule());
            Nfa.BindRule(rules.UnOpExpr10, builder.BuildUnOpExpr10Rule());
            Nfa.BindRule(rules.CountOpExpr11, builder.BuildCountOpExpr11Rule());
            Nfa.BindRule(rules.BinOpExpr12, builder.BuildBinOpExpr12Rule());
            Nfa.BindRule(rules.BinOpExpr13, builder.BuildBinOpExpr13Rule());
            Nfa.BindRule(rules.BinOpExpr14, builder.BuildBinOpExpr14Rule());
            Nfa.BindRule(rules.BinOpExpr15, builder.BuildBinOpExpr15Rule());
            Nfa.BindRule(rules.BinOpExpr16, builder.BuildBinOpExpr16Rule());
            Nfa.BindRule(rules.CallExpr17, builder.BuildCallExpr17Rule());
            Nfa.BindRule(rules.BinOpExpr18, builder.BuildBinOpExpr18Rule());
            Nfa.BindRule(rules.UnOpExpr19, builder.BuildUnOpExpr19Rule());
            Nfa.BindRule(rules.PrimaryExpr, builder.BuildPrimaryExprRule());
            Nfa.BindRule(rules.Decl, builder.BuildDeclRule());
            Nfa.BindRule(rules.LetDecl, builder.BuildLetDeclRule());
            Nfa.BindRule(rules.Quant, builder.BuildQuantRule());
            Nfa.BindRule(rules.ArrowMultiplicity, builder.BuildArrowMultiplicityRule());
            Nfa.BindRule(rules.Block, builder.BuildBlockRule());
            Nfa.BindRule(rules.Name, builder.BuildNameRule());
            Nfa.BindRule(rules.Number, builder.BuildNumberRule());
            Nfa.BindRule(rules.Ref, builder.BuildRefRule());

            List <RuleBinding> ruleBindings =
                new List <RuleBinding>()
            {
                rules.CompilationUnit,
                rules.Specification,
                rules.Module,
                rules.Open,
                rules.Paragraph,
                rules.FactDecl,
                rules.AssertDecl,
                rules.FunDecl,
                rules.FunctionName,
                rules.FunctionReturn,
                rules.FunctionParameters,
                rules.DeclList,
                rules.CmdDecl,
                rules.CmdScope,
                rules.CmdScopeFor,
                rules.CmdScopeExpect,
                rules.TypescopeDeclList,
                rules.Typescope,
                rules.SigDecl,
                rules.NameList,
                rules.NameDeclList,
                rules.SigBody,
                rules.EnumDecl,
                rules.EnumBody,
                rules.SigQual,
                rules.SigExt,
                rules.Expr,
                rules.UnOpExpr1,
                rules.LetDecls,
                rules.QuantDecls,
                rules.BinOpExpr2,
                rules.BinOpExpr3,
                rules.BinOpExpr4,
                rules.ElseClause,
                rules.BinOpExpr5,
                rules.UnOpExpr6,
                rules.BinOpExpr7,
                rules.CompareOp,
                rules.UnOpExpr8,
                rules.BinOpExpr9,
                rules.UnOpExpr10,
                rules.CountOpExpr11,
                rules.BinOpExpr12,
                rules.BinOpExpr13,
                rules.BinOpExpr14,
                rules.BinOpExpr15,
                rules.BinOpExpr16,
                rules.CallExpr17,
                rules.BinOpExpr18,
                rules.UnOpExpr19,
                rules.PrimaryExpr,
                rules.Decl,
                rules.LetDecl,
                rules.Quant,
                rules.ArrowMultiplicity,
                rules.Block,
                rules.Name,
                rules.Number,
                rules.Ref,
            };

            throw new NotImplementedException();
            _network = new Network(ruleBindings, null);
            return(_network);
        }