private DeterministicParser(
     IProducer <TNode> producer,
     RuntimeGrammar grammar,
     TransitionDelegate actionTable,
     ResourceAllocator allocator,
     ILogging logging,
     TaggedStack <TNode> stateStack)
 {
     this.producer    = producer;
     this.grammar     = grammar;
     this.rules       = grammar.Productions.ToArray();
     this.actionTable = actionTable;
     this.allocator   = allocator;
     this.logging     = logging;
     this.stateStack  = stateStack;
 }
 public DeterministicParser(
     IProducer <TNode> producer,
     RuntimeGrammar grammar,
     TransitionDelegate actionTable,
     ResourceAllocator allocator,
     ILogging logging
     )
     : this(
         producer,
         grammar,
         actionTable,
         allocator,
         logging,
         new TaggedStack <TNode>(InitialValueStackSize))
 {
     this.Reset();
 }
 public RnGlrParser(
     RuntimeGrammar grammar,
     int[]               tokenComplexity,
     TransitionDelegate transition,
     int[]               stateToPriorToken,
     int[]               conflictActionsTable,
     IProducer <T> producer,
     ResourceAllocator allocator,
     ILogging logging)
     : this(
         grammar,
         tokenComplexity,
         transition,
         stateToPriorToken,
         conflictActionsTable,
         producer,
         allocator,
         logging,
         new Gss <T>(stateToPriorToken.Length + grammar.Productions.Count))
 {
 }
        private RnGlrParser(
            RuntimeGrammar grammar,
            int[]               tokenComplexity,
            TransitionDelegate transition,
            int[]               stateToPriorToken,
            int[]               conflictActionsTable,
            IProducer <T> producer,
            ResourceAllocator allocator,
            ILogging logging,
            Gss <T> gss)
        {
            this.grammar              = grammar;
            this.tokenComplexity      = tokenComplexity;
            this.transition           = transition;
            this.stateToPriorToken    = stateToPriorToken;
            this.conflictActionsTable = conflictActionsTable;
            this.gss        = gss;
            this.nodeBuffer = new T[grammar.MaxRuleSize];
            this.producer   = producer;
            this.allocator  = allocator;
            this.logging    = logging;

            this.pendingReductions = new ModifiedReduction[grammar.Productions.Count];

            switch (producer.ReductionOrder)
            {
            case ReductionOrder.Unordered:
            {
                this.R = new ReductionQueue <T>();
                break;
            }

            case ReductionOrder.ByRuleDependency:
            {
                this.R = new ReductionPathQueue <T>(tokenComplexity, grammar);
                break;
            }
            }
        }
Exemple #5
0
 public void Init()
 {
     this.runtimeGrammar = new RuntimeGrammar(grammar);
     this.allocator = new ResourceAllocator(runtimeGrammar);
 }