예제 #1
0
 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;
 }
예제 #2
0
 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();
 }
예제 #3
0
 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))
 {
 }
예제 #4
0
        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;
            }
            }
        }
예제 #5
0
 public void Init()
 {
     this.runtimeGrammar = new RuntimeGrammar(grammar);
     this.allocator = new ResourceAllocator(runtimeGrammar);
 }