{-# LANGUAGE TupleSections #-}

module Boolean2TM (boolean2tm, boolean2tm') where

import GrammarType
import DebuggingTMTypes
import qualified Boolean2TMConstants as Constants
import qualified Boolean2TMHelpers as Helpers

import qualified Data.Set as Set
import qualified Data.Map as Map
import Data.List
import Data.Maybe
import TuringMachine (TuringMachine)

boolean2tm :: MonadFail m => Grammar -> m TuringMachine
boolean2tm :: Grammar -> m TuringMachine
boolean2tm Grammar
grammar = DebuggingTuringMachine -> m TuringMachine
forall (m :: * -> *).
MonadFail m =>
DebuggingTuringMachine -> m TuringMachine
convertToTuringMachine (DebuggingTuringMachine -> m TuringMachine)
-> DebuggingTuringMachine -> m TuringMachine
forall a b. (a -> b) -> a -> b
$ Grammar -> DebuggingTuringMachine
boolean2tm' Grammar
grammar

boolean2tm' :: Grammar -> DebuggingTuringMachine
boolean2tm' :: Grammar -> DebuggingTuringMachine
boolean2tm' Grammar
grammar = let
        quadruples1 :: DebuggingQuadruples
quadruples1 = Grammar -> DebuggingQuadruples
generateBlockForFolding Grammar
grammar
        quadruples2 :: DebuggingQuadruples
quadruples2 = Grammar -> DebuggingQuadruples
generateBlockForMovingToNextConjunction Grammar
grammar
        quadruples3 :: DebuggingQuadruples
quadruples3 = Grammar -> DebuggingQuadruples
generateBlockForSubstitution Grammar
grammar
        quadruples4 :: DebuggingQuadruples
quadruples4 = Grammar -> DebuggingQuadruples
generateBlockForCountWordLength Grammar
grammar
        quadruples5 :: DebuggingQuadruples
quadruples5 = Grammar -> DebuggingQuadruples
generateBlockForWritingSigns Grammar
grammar
        quadruples7 :: DebuggingQuadruples
quadruples7 = Grammar -> DebuggingQuadruples
generateBlockForScanResults Grammar
grammar
        quadruples8 :: DebuggingQuadruples
quadruples8 = Grammar -> DebuggingQuadruples
generateBlockForPreparingForSubstitution Grammar
grammar
        quadruples9 :: DebuggingQuadruples
quadruples9 = Grammar -> DebuggingQuadruples
generateBlockForFolding Grammar
grammar
        quadruples10 :: DebuggingQuadruples
quadruples10 = Grammar -> DebuggingQuadruples
generateBlockForFindingNewSubstitution Grammar
grammar
        quadruples11 :: DebuggingQuadruples
quadruples11 = Grammar -> DebuggingQuadruples
generateBlockForRefiningConjunctionDetails Grammar
grammar
        quadruples12 :: DebuggingQuadruples
quadruples12 = Grammar -> DebuggingQuadruples
generateBlockCheckIfWordsSplitCanBeChanged Grammar
grammar
        quadruples13 :: DebuggingQuadruples
quadruples13 = Grammar -> DebuggingQuadruples
generateBlockForChangingWord Grammar
grammar
        quadruples14 :: DebuggingQuadruples
quadruples14 = Grammar -> DebuggingQuadruples
generateTransitionFromConjunctionResult Grammar
grammar
        quadruples15 :: DebuggingQuadruples
quadruples15 = Grammar -> DebuggingQuadruples
generateBlockForGettingAccepted Grammar
grammar in
        (DebuggingQuadruples -> DebuggingTuringMachine
DTM (DebuggingQuadruples -> DebuggingTuringMachine)
-> DebuggingQuadruples -> DebuggingTuringMachine
forall a b. (a -> b) -> a -> b
$ [DebuggingQuadruples] -> DebuggingQuadruples
unionQuadruples [DebuggingQuadruples
quadruples1, DebuggingQuadruples
quadruples2, DebuggingQuadruples
quadruples3, DebuggingQuadruples
quadruples4,
        DebuggingQuadruples
quadruples5, DebuggingQuadruples
quadruples7, DebuggingQuadruples
quadruples8, DebuggingQuadruples
quadruples9, DebuggingQuadruples
quadruples10, DebuggingQuadruples
quadruples11,
        DebuggingQuadruples
quadruples12, DebuggingQuadruples
quadruples13, DebuggingQuadruples
quadruples14, DebuggingQuadruples
quadruples15])

-- naming for blocks of TM?
generateBlockForFindingNewSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForFindingNewSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForFindingNewSubstitution grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
  qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
  qCheckIfNotCompleted :: [Char]
qCheckIfNotCompleted = [Char]
"qCheckIfNotCompleted"
  qSubstituteOrFold :: [Char]
qSubstituteOrFold = [Char]
"qSubstituteOrFold"
  qSkipCompletedNonterminal :: [Char]
qSkipCompletedNonterminal = [Char]
"qSkipCompletedNonterminal"
  qCountWordLength' :: [Char]
qCountWordLength' = [Char]
"qCountWordLength'"
  qCountWordLength :: [Char]
qCountWordLength = [Char]
"qCountWordLength"
  qMoveToEndToScanResults1 :: [Char]
qMoveToEndToScanResults1 = [Char]
"qMoveToEndToScanResults1"
  qFold' :: [Char]
qFold' = [Char]
"qFold'"
  done :: [Char]
done = [Char]
"Done"

  terminalsList :: [Terminal]
terminalsList = Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
  nonterminalsList :: [Nonterminal]
nonterminalsList = Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
  signsList :: [[Char]]
signsList = [[Char]]
Constants.signs
  negation :: [[Char]]
negation = [[Char]
Constants.negation]
  indices :: [[Char]]
indices= (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumberOfRules Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]

  maxNumberOfRules :: Int
maxNumberOfRules = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar

  -- BLOCK for qFindNewSubstitution
  list :: [[Char]]
list = [[[Char]]] -> [[Char]]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[[Char]]
indices, (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue [Terminal]
terminalsList, [[Char]]
signsList, [[Char]]
negation, [[Char]]
Constants.brackets]
  -- there is no necessity in insertWithKey, since TM is deterministic
  symbolsInQFindNewSubstitutionQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFindNewSubstitutionQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qFindNewSubstitution, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFindNewSubstitution))) [[Char]]
list
  -- in TMTypes EmptySymbol is 0
  symbolsFromQFindNewSubstitutionToAcceptQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQFindNewSubstitutionToAcceptQdrs = [(([Char] -> DebuggingState
DState [Char]
qFindNewSubstitution, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
done))]
  symbolsWhichChangeStateQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsWhichChangeStateQdrs =
    (Nonterminal
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [Nonterminal]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map ((\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qFindNewSubstitution, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qCheckIfNotCompleted))) ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> (Nonterminal -> [Char])
-> Nonterminal
-> ((DebuggingState, DebuggingSymbol),
    (DebuggingMove, DebuggingState))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nonterminal -> [Char]
nonterminalValue) [Nonterminal]
nonterminalsList

  -- BLOCK for qCheckIfNotCompleted
  symbolsToQSubstituteOrFoldQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSubstituteOrFoldQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> 
    (([Char] -> DebuggingState
DState [Char]
qCheckIfNotCompleted, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qSubstituteOrFold))) [[Char]]
indices
  symbolsToQSkipCompletedNonterminalQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSkipCompletedNonterminalQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map 
    (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qCheckIfNotCompleted, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSkipCompletedNonterminal))) [[Char]]
signsList
  symbolsFromQCheckIfNotCompletedToAcceptQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQCheckIfNotCompletedToAcceptQdrs = [(([Char] -> DebuggingState
DState [Char]
qCheckIfNotCompleted, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
done))]

  -- BLOCK for qSubstituteOrFold
  symbolsInQSubstituteOrFoldQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSubstituteOrFoldQdrs = [(([Char] -> DebuggingState
DState [Char]
qSubstituteOrFold, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qSubstituteOrFold))]
  symbolsToCountWordLength'Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCountWordLength'Qdrs = (Terminal
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [Terminal]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
    ((\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSubstituteOrFold, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qCountWordLength'))) ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> (Terminal -> [Char])
-> Terminal
-> ((DebuggingState, DebuggingSymbol),
    (DebuggingMove, DebuggingState))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Terminal -> [Char]
terminalValue) [Terminal]
terminalsList
  symbolsToQFold'Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFold'Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map 
    (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSubstituteOrFold, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFold'))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue [Nonterminal]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
negation

  -- BLOCK for qCountWordLength'
  symbolsToCountWordLengthQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCountWordLengthQdrs = [(([Char] -> DebuggingState
DState [Char]
qCountWordLength', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qCountWordLength))]

  -- BLOCK for qFold'
  symbolsToQMoveToEndToScanResults1 :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndToScanResults1 = [(([Char] -> DebuggingState
DState [Char]
qFold', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults1))]

  -- BLOCK for qSkipCompletedNonterminal
  symbolsToQFindNewSubstitutionQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitutionQdrs = (Nonterminal
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [Nonterminal]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map 
    ((\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSkipCompletedNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFindNewSubstitution))) ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> (Nonterminal -> [Char])
-> Nonterminal
-> ((DebuggingState, DebuggingSymbol),
    (DebuggingMove, DebuggingState))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nonterminal -> [Char]
nonterminalValue) [Nonterminal]
nonterminalsList

  quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFindNewSubstitutionQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQFindNewSubstitutionToAcceptQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsWhichChangeStateQdrs 
    [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSubstituteOrFoldQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSkipCompletedNonterminalQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQCheckIfNotCompletedToAcceptQdrs
    [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSubstituteOrFoldQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCountWordLength'Qdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFold'Qdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCountWordLengthQdrs 
    [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndToScanResults1 [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitutionQdrs
  in Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples ([((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForScanResults :: Grammar -> DebuggingQuadruples
generateBlockForScanResults :: Grammar -> DebuggingQuadruples
generateBlockForScanResults grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    qMoveToEndToScanResults1 :: [Char]
qMoveToEndToScanResults1 = [Char]
"qMoveToEndToScanResults1"
    qMoveToEndToScanResults2 :: [Char]
qMoveToEndToScanResults2 = [Char]
"qMoveToEndToScanResults2"
    qStart' :: [Char]
qStart' = [Char]
"qStart'"
    qSecPos :: [Char]
qSecPos = [Char]
"qSecPos"
    qSecNeg :: [Char]
qSecNeg = [Char]
"qSecNeg"
    qBothPos :: [Char]
qBothPos = [Char]
"qBothPos"
    qSomeNeg :: [Char]
qSomeNeg = [Char]
"qSomeNeg"
    qWordsChangingMoveToBringSymbol :: [Char]
qWordsChangingMoveToBringSymbol = [Char]
"qWordsChangingMoveToBringSymbol"
    -- parts for set of states q1FindNegation, q2FindNegation...qkFindNegation
    q :: [Char]
q = [Char]
"q"
    findNegation :: [Char]
findNegation = [Char]
"FindNegation"

    maxNumberOfRules :: Int
maxNumberOfRules = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar

    -- BLOCK for qMoveToEndAndScanResults
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    indices :: [[Char]]
indices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumberOfRules Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]

    symbols :: [[Char]]
symbols = [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
indices [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets
    -- BLOCK for qMoveToEndToScanResults1Qdrs
    symbolsInQMoveToEndToScanResults1Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndToScanResults1Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults1, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
            (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults1))) [[Char]]
symbols
    symbolsToQMoveToEndToScanResults2Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndToScanResults2Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults1, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults2))) [[Char]]
Constants.signs

    -- BLOCK for qMoveToEndToScanResults2Qdrs
    symbolsInQMoveToEndToScanResults2Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndToScanResults2Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults2, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults2)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList
    symbolsToQStart'Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQStart'Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qMoveToEndToScanResults2, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qStart'))) [[Char]]
Constants.signs

    -- BLOCK for qStart'
    symbolsInQStart'Qdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQStart'Qdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qStart', [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qStart'))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList
    symbolsToQSecPosQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSecPosQdrs = [(([Char] -> DebuggingState
DState [Char]
qStart', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.plus),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSecPos))]
    symbolsToQSecNegQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSecNegQdrs = [(([Char] -> DebuggingState
DState [Char]
qStart', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.minus),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSecNeg))]

    -- BLOCK for qSecPos
    symbolsInQSecPosQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSecPosQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSecPos, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSecPos))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList
    symbolsToQBothPosQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQBothPosQdrs = [(([Char] -> DebuggingState
DState [Char]
qSecPos, [Char] -> DebuggingSymbol
DSymbol [Char]
"+"),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qBothPos))]
    symbolsFromQSecPosToQSomeNegQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQSecPosToQSomeNegQdrs = [(([Char] -> DebuggingState
DState [Char]
qSecPos, [Char] -> DebuggingSymbol
DSymbol [Char]
"-"),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSomeNeg))]

    -- BLOCK for qSecNeg: there is possibility to remove this state and move to qSomeNeg state
    symbolsInQSecNegQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSecNegQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSecNeg, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSecNeg))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList
    symbolsFromQSecNegToQSomeNegQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQSecNegToQSomeNegQdrs =
      [(([Char] -> DebuggingState
DState [Char]
qSecNeg, [Char] -> DebuggingSymbol
DSymbol [Char]
"+"),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSomeNeg)),
      (([Char] -> DebuggingState
DState [Char]
qSecNeg, [Char] -> DebuggingSymbol
DSymbol [Char]
"-"),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSomeNeg))]

    -- BLOCK for qBothPos
    symbolsInQBothPosQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQBothPosQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qBothPos, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qBothPos)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList
    symbolsToQ_ithFindNegationQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQ_ithFindNegationQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qBothPos, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
findNegation))) [[Char]]
indices

    -- BLOCK for qSomeNeg
    symbolsInSomeNegQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInSomeNegQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSomeNeg, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSomeNeg)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList
    symbolsToQWordsChangingMoveToBringSymbolQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWordsChangingMoveToBringSymbolQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qSomeNeg, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qWordsChangingMoveToBringSymbol))) [[Char]]
indices

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndToScanResults1Qdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndToScanResults2Qdrs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++  [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndToScanResults2Qdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQStart'Qdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQStart'Qdrs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSecPosQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSecNegQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSecPosQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQBothPosQdrs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQSecPosToQSomeNegQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSecNegQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQSecNegToQSomeNegQdrs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQBothPosQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQ_ithFindNegationQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInSomeNegQdrs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWordsChangingMoveToBringSymbolQdrs

    in Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples ([((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForRefiningConjunctionDetails :: Grammar -> DebuggingQuadruples
generateBlockForRefiningConjunctionDetails :: Grammar -> DebuggingQuadruples
generateBlockForRefiningConjunctionDetails Grammar
grammar = let
    maxNumberOfRules :: Int
maxNumberOfRules = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar
    indices :: [[Char]]
indices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumberOfRules Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
    quadruplesList :: [DebuggingQuadruples]
quadruplesList = ([Char] -> DebuggingQuadruples)
-> [[Char]] -> [DebuggingQuadruples]
forall a b. (a -> b) -> [a] -> [b]
map (Grammar -> [Char] -> DebuggingQuadruples
generateBlockForQKFindNegation Grammar
grammar) [[Char]]
indices
    in [DebuggingQuadruples] -> DebuggingQuadruples
unionQuadruples [DebuggingQuadruples]
quadruplesList

unionQuadruples :: [DebuggingQuadruples] -> DebuggingQuadruples
unionQuadruples :: [DebuggingQuadruples] -> DebuggingQuadruples
unionQuadruples [DebuggingQuadruples
quadruple] = DebuggingQuadruples
quadruple
unionQuadruples [DebuggingQuadruples]
quadruples = Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples ([Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall (f :: * -> *) k a.
(Foldable f, Ord k) =>
f (Map k a) -> Map k a
Map.unions ([Map
    (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)]
 -> Map
      (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState))
-> [Map
      (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall a b. (a -> b) -> a -> b
$ (DebuggingQuadruples
 -> Map
      (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState))
-> [DebuggingQuadruples]
-> [Map
      (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)]
forall a b. (a -> b) -> [a] -> [b]
map (\(DQuadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
x) -> Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
x) [DebuggingQuadruples]
quadruples)

generateBlockForQKFindNegation :: Grammar -> String -> DebuggingQuadruples
generateBlockForQKFindNegation :: Grammar -> [Char] -> DebuggingQuadruples
generateBlockForQKFindNegation grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
relations, Nonterminal
_)) [Char]
k' = let
    -- parts for set of states q1FindNegation, q2FindNegation...qkFindNegation
    q :: [Char]
q = [Char]
"q"
    qkFindNegation :: [Char]
qkFindNegation = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"FindNegation"
    qkMoveToStart :: [Char]
qkMoveToStart = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"MoveToStart"
    qkMoveToStartNeg :: [Char]
qkMoveToStartNeg = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"MoveToStartNegation"
    qRuleKFindNonterminal :: [Char]
qRuleKFindNonterminal = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"KFindNonterminal"

    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    relsList :: [Relation]
relsList = Set Relation -> [Relation]
forall a. Set a -> [a]
Set.toList Set Relation
relations

    -- BLOCK for qkFindNegation
    symbolsInQkFindNegation :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQkFindNegation = [(([Char] -> DebuggingState
DState [Char]
qkFindNegation, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qkFindNegation))]
    symbolsToQkMoveToStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStart = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qkFindNegation, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qkMoveToStart))) [[Char]]
nonterminalsList
    symbolsToQkMoveToStartNegation :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStartNegation = [(([Char] -> DebuggingState
DState [Char]
qkFindNegation, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.negation),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qkMoveToStartNeg))]

    -- BLOCK for qkMoveToStart/qkMoveToStartNeg
    symbolsInQkMoveToStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQkMoveToStart = [(([Char] -> DebuggingState
DState [Char]
qkMoveToStart, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qkMoveToStart))]
    symbolsToQRulekFindNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulekFindNonterminal = [(([Char] -> DebuggingState
DState [Char]
qkMoveToStart, [Char] -> DebuggingSymbol
DSymbol [Char]
k'),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qRuleKFindNonterminal))]

    -- BLOCK for qRulekFindNonterminal
    nonterminalsWithKthRel :: [[Char]]
nonterminalsWithKthRel = ([Char] -> Bool) -> [[Char]] -> [[Char]]
forall a. (a -> Bool) -> [a] -> [a]
filter (\[Char]
t -> [Relation] -> [Char] -> [Char] -> Bool
Helpers.kthRelForNonterminalLong [Relation]
relsList [Char]
t [Char]
k') [[Char]]
nonterminalsList
    symbolsToQRulekNonterminalFindFst :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulekNonterminalFindFst = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
            (([Char] -> DebuggingState
DState [Char]
qRuleKFindNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findFst")))
            [[Char]]
nonterminalsWithKthRel

    -- BLOCK for qRulektFindFst
    symbolsInQRulektFindFst :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRulektFindFst = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s ->
            (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findFst", [Char] -> DebuggingSymbol
DSymbol [Char]
s),
            (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findFst")))
            ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
k' [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]
Constants.negation]) [[Char]]
nonterminalsList

    triplets :: [([Char], [Char], [Char])]
triplets = Grammar -> [Char] -> [[Char]] -> [([Char], [Char], [Char])]
Helpers.calculateTriplets Grammar
grammar [Char]
k' [[Char]]
nonterminalsWithKthRel

    symbolsToQRulektjFindSnd :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulektjFindSnd = (([Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\([Char]
k, [Char]
t, [Char]
j) -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findFst", [Char] -> DebuggingSymbol
DSymbol [Char]
j),
            (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findSnd"))) [([Char], [Char], [Char])]
triplets

    -- BLOCK for qRulektjFindSnd
    quads :: [([Char], [Char], [Char], [Char])]
quads = Grammar -> [([Char], [Char], [Char], [Char])]
Helpers.calculateAllQuads Grammar
grammar
    symbolsInRulektjFindSnd :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInRulektjFindSnd = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
s ->
        (([Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j) ->
            (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findSnd", [Char] -> DebuggingSymbol
DSymbol [Char]
s),
             (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findSnd"))
            ) [([Char], [Char], [Char])]
triplets) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets

    symbolsToQRulektjs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulektjs = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k,[Char]
t,[Char]
j,[Char]
f) -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"findSnd", [Char] -> DebuggingSymbol
DSymbol [Char]
f),
            (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Rule" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f))) [([Char], [Char], [Char], [Char])]
quads

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulekFindNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulekNonterminalFindFst
            [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRulektFindFst [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulektjFindSnd [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInRulektjFindSnd [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRulektjs
            [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQkMoveToStart
    commonQuadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
commonQuadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQkFindNegation [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStart
            [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStartNegation

    quadruplesMap :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty
    quadruplesNegMap :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesNegMap = Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
generateCaseForNegConj Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap
    commonQuadruplesMap :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
commonQuadruplesMap = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
commonQuadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty

    in Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
commonQuadruplesMap (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> Map
      (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState))
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall a b. (a -> b) -> a -> b
$ Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesNegMap)

generateCaseForNegConj :: Map.Map (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
                       -> Map.Map (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
generateCaseForNegConj :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
generateCaseForNegConj Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruples = let
    quadruples' :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruples' = ((DebuggingState, DebuggingSymbol)
 -> (DebuggingState, DebuggingSymbol))
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys (\(DState [Char]
state, DSymbol [Char]
symbol) -> ([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Negation", [Char] -> DebuggingSymbol
DSymbol [Char]
symbol)) Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruples
    in ((DebuggingMove, DebuggingState)
 -> (DebuggingMove, DebuggingState))
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map (\(DebuggingMove
move, DState [Char]
state) -> (DebuggingMove
move, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Negation")) Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruples'

--BLOCK for moving from conjunction results to next blocks
generateTransitionFromConjunctionResult :: Grammar -> DebuggingQuadruples
generateTransitionFromConjunctionResult :: Grammar -> DebuggingQuadruples
generateTransitionFromConjunctionResult grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    q :: [Char]
q = [Char]
"q"
    rewrite :: [Char]
rewrite = [Char]
"Rewrite"
    transition :: [Char]
transition = [Char]
"Transition"
    skipParentNonterminal :: [Char]
skipParentNonterminal = [Char]
"SkipParentNonterminal"
    rule :: [Char]
rule = [Char]
"Rule"
    negation :: [Char]
negation = [Char]
"Negation"
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals

    quads :: [([Char], [Char], [Char], [Char])]
quads = Grammar -> [([Char], [Char], [Char], [Char])]
Helpers.calculateAllQuads Grammar
grammar

    -- BLOCK FOR qRulektjs
    quadruplesInRulektjs' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs' = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k,[Char]
t,[Char]
j,[Char]
f) -> ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
s ->
        [(([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f, [Char] -> DebuggingSymbol
DSymbol [Char]
s),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f)),
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation, [Char] -> DebuggingSymbol
DSymbol [Char]
s),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation))])
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList) [([Char], [Char], [Char], [Char])]
quads

    quadruplesInRulektjs'' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs'' = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k,[Char]
t,[Char]
j,[Char]
s) ->
        [(([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation, [Char] -> DebuggingSymbol
DSymbol [Char]
k),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation)),
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation, [Char] -> DebuggingSymbol
DSymbol [Char]
k),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation))]) [([Char], [Char], [Char], [Char])]
quads

    quadruplesInRulektjs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs''

    -- BLOCK, which generates transitions to next subprograms - move to next rule, folding conj with sign, changing words
    -- fold and put +
    lastConjsWithoutNeg :: [([Char], [Char], [Char], [Char])]
lastConjsWithoutNeg = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char], [Char], [Char])
t -> let
        hasNeg :: Bool
hasNeg = Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char], [Char], [Char], [Char])
t
        pair :: SymbolsPair
pair = ([Char], [Char], [Char], [Char]) -> Bool -> SymbolsPair
Helpers.constructSymbolsPairByQuad ([Char], [Char], [Char], [Char])
t Bool
hasNeg
        in Maybe SymbolsPair -> Bool
forall a. Maybe a -> Bool
isNothing (Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateNextConjunctionInSameRule Grammar
grammar SymbolsPair
pair)) [([Char], [Char], [Char], [Char])]
quads
    quadruplesToRewritePlus :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToRewritePlus = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k,[Char]
t,[Char]
j,[Char]
s) -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s, [Char] -> DebuggingSymbol
DSymbol [Char]
k),
                    (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rewrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.plus))) [([Char], [Char], [Char], [Char])]
lastConjsWithoutNeg

    -- move to next conjunction
    midConjsWihoutNeg :: [([Char], [Char], [Char], [Char])]
midConjsWihoutNeg = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char], [Char], [Char])
t -> let
        hasNeg :: Bool
hasNeg = Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char], [Char], [Char], [Char])
t
        pair :: SymbolsPair
pair = ([Char], [Char], [Char], [Char]) -> Bool -> SymbolsPair
Helpers.constructSymbolsPairByQuad ([Char], [Char], [Char], [Char])
t Bool
hasNeg
        in Maybe SymbolsPair -> Bool
forall a. Maybe a -> Bool
isJust (Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateNextConjunctionInSameRule Grammar
grammar SymbolsPair
pair)) [([Char], [Char], [Char], [Char])]
quads
    quadruplesToNextConj :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToNextConj = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k,[Char]
t,[Char]
j,[Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s
        newState :: [Char]
newState = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
skipParentNonterminal [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
k),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char])]
midConjsWihoutNeg

    -- move to next relation
    conjsInMidRuleWithNeg :: [([Char], [Char], [Char], [Char])]
conjsInMidRuleWithNeg = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char], [Char], [Char])
t -> let
        hasNeg :: Bool
hasNeg = Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char], [Char], [Char], [Char])
t
        pair :: SymbolsPair
pair = ([Char], [Char], [Char], [Char]) -> Bool -> SymbolsPair
Helpers.constructSymbolsPairByQuad ([Char], [Char], [Char], [Char])
t Bool
hasNeg
        in Maybe SymbolsPair -> Bool
forall a. Maybe a -> Bool
isJust (Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateFirstConjunctionInNextRule Grammar
grammar SymbolsPair
pair)) [([Char], [Char], [Char], [Char])]
quads
    quadruplesToNextRel :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToNextRel = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k,[Char]
t,[Char]
j,[Char]
s) -> let
        inc :: DebuggingSymbol
inc = [Char] -> DebuggingSymbol
DSymbol (Int -> [Char]
forall a. Show a => a -> [Char]
show (Int -> [Char]) -> Int -> [Char]
forall a b. (a -> b) -> a -> b
$ ([Char] -> Int
forall a. Read a => [Char] -> a
read [Char]
k :: Int) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
        oldState :: [Char]
oldState = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation
        newState :: [Char]
newState = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
skipParentNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
k), (DebuggingSymbol -> DebuggingMove
D DebuggingSymbol
inc, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, DebuggingSymbol
inc),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))])
        [([Char], [Char], [Char], [Char])]
conjsInMidRuleWithNeg

    -- fold and put -
    conjsInLastRuleWithNeg :: [([Char], [Char], [Char], [Char])]
conjsInLastRuleWithNeg = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char], [Char], [Char])
t -> let
        hasNeg :: Bool
hasNeg = Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char], [Char], [Char], [Char])
t
        pair :: SymbolsPair
pair = ([Char], [Char], [Char], [Char]) -> Bool -> SymbolsPair
Helpers.constructSymbolsPairByQuad ([Char], [Char], [Char], [Char])
t Bool
hasNeg
        in Maybe SymbolsPair -> Bool
forall a. Maybe a -> Bool
isNothing (Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateFirstConjunctionInNextRule Grammar
grammar SymbolsPair
pair)) [([Char], [Char], [Char], [Char])]
quads
    quadruplesToRewriteMinus :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToRewriteMinus = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k,[Char]
t,[Char]
j,[Char]
s) ->
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rule [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negation, [Char] -> DebuggingSymbol
DSymbol [Char]
k),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
rewrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.minus))) [([Char], [Char], [Char], [Char])]
conjsInLastRuleWithNeg

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesInRulektjs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToRewritePlus [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToRewriteMinus
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToNextConj [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruplesToNextRel 

    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

-- Block for figuring if conjunction has one of nonterminals with "-" sign and
-- it is possible to split a word into two in a different way for the same conjunction
generateBlockCheckIfWordsSplitCanBeChanged :: Grammar -> DebuggingQuadruples
generateBlockCheckIfWordsSplitCanBeChanged :: Grammar -> DebuggingQuadruples
generateBlockCheckIfWordsSplitCanBeChanged grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    qWordsChanging :: [Char]
qWordsChanging = [Char]
"qWordsChanging"
    moveToBringSymbol :: [Char]
moveToBringSymbol = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"MoveToBringSymbol"
    metFstNonterminal :: [Char]
metFstNonterminal = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"MetFstNonterminal"
    metSndNonterminal :: [Char]
metSndNonterminal = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"MetSndNonterminal"
    checkIfSndIsWord :: [Char]
checkIfSndIsWord = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"CheckIfSndIsWord"
    sndIsWord :: [Char]
sndIsWord = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"SndIsWord"
    returnToParentNonterminal :: [Char]
returnToParentNonterminal = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"ReturnToParentNonterminal"
    bringSymbol :: [Char]
bringSymbol = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"BringSymbol"
    failedPrefix :: [Char]
failedPrefix = [Char]
"Failed"
    negationWord :: [Char]
negationWord = [Char]
"Negation"
    failedCheckNegation :: [Char]
failedCheckNegation = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
failedPrefix [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Check" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negationWord
    failedNegation :: [Char]
failedNegation = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
failedPrefix [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negationWord
    failed :: [Char]
failed = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
failedPrefix
    moveToStart :: [Char]
moveToStart = [Char]
"MoveToStart"

    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    maxNumberOfRules :: Int
maxNumberOfRules = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar
    indices :: [[Char]]
indices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumberOfRules Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]

    --BLOCK for qWordsChangingMoveToBringSymbol
    symbolsInMoveToBringSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMoveToBringSymbol = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
moveToBringSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
moveToBringSymbol)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
Constants.brackets
    symbolsToMetFstNonterminalQdrs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMetFstNonterminalQdrs = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
moveToBringSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
metFstNonterminal))) [[Char]]
nonterminalsList

    --BLOCK for qWordsChangingMetFstNonterminal
    symbolsInMetFstNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMetFstNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
metFstNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
metFstNonterminal)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList
    symbolsToMetSndNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMetSndNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
metFstNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
metSndNonterminal))) [[Char]]
nonterminalsList

    --BLOCK for qWordsChangingMetSndNonterminal
    symbolsInMetSndNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMetSndNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
metSndNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
metSndNonterminal))) [[Char]]
Constants.signs
    symbolsToCheckIfSndIsWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCheckIfSndIsWord = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
metSndNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
checkIfSndIsWord))) [[Char]
Constants.leftBracket]

    --BLOCK for qWordsChangingCheckIfSndIsWord
    symbolsToSndIsWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToSndIsWord = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
checkIfSndIsWord, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
sndIsWord))) [[Char]]
terminalsList

    --BLOCK for qWordsChangingSndIsWord
    symbolsToReturnToParentNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToReturnToParentNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
sndIsWord, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
returnToParentNonterminal))) [[Char]
Constants.rightBracket]
    symbolsToBringSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBringSymbol = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
sndIsWord, [Char] -> DebuggingSymbol
DSymbol [Char]
t), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
bringSymbol))) [[Char]]
terminalsList

    --BLOCK for qWordsChangingReturnToParentNonterminal
    notCounters :: [[Char]]
notCounters = [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs
    symbolsInReturnToParentNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInReturnToParentNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
returnToParentNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
returnToParentNonterminal))) [[Char]]
notCounters
    symbolsToWordsChangingFailed :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailed = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
counter ->  (([Char] -> DebuggingState
DState [Char]
returnToParentNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
counter),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedCheckNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter))) [[Char]]
indices

    --BLOCK for qWordsChangingFailedCheckNegationK
    symbolsInWordsChangingFailed :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInWordsChangingFailed = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
counter -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedCheckNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedCheckNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter))) [[Char]]
indices
    symbolsToWordsChangingFailedNegationK :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailedNegationK = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
counter -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedCheckNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.negation),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter))) [[Char]]
indices
    symbolsToWordsChangingFailedK :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailedK = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap
        (\[Char]
counter -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
nonterm -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedCheckNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter, [Char] -> DebuggingSymbol
DSymbol [Char]
nonterm),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failed [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter))) [[Char]]
nonterminalsList) [[Char]]
indices

    --BLOCK for qWordsChangingFailedK
    symbolsToQkMoveToStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStart = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
counter -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failed [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
"q" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
moveToStart [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
negationWord))) [[Char]]
indices

    --BLOCK for qWordsChangingFailedNegationK
    symbolsToQkMoveToStartNegation :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStartNegation = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map
        (\[Char]
counter -> (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
failedNegation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
"q" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
counter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
moveToStart))) [[Char]]
indices

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = --symbolsInQWordsChangingMoveToBringSymbol ++ symbolsToQMoveToBringSymbol
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMoveToBringSymbol [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMetFstNonterminalQdrs [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMetFstNonterminal
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMetSndNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMetSndNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCheckIfSndIsWord [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToSndIsWord
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToReturnToParentNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBringSymbol [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInReturnToParentNonterminal
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailed [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInWordsChangingFailed [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailedNegationK
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWordsChangingFailedK [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStart [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQkMoveToStartNegation

    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForChangingWord :: Grammar -> DebuggingQuadruples
generateBlockForChangingWord :: Grammar -> DebuggingQuadruples
generateBlockForChangingWord (Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    qWordsChanging :: [Char]
qWordsChanging = [Char]
"qWordsChanging"
    bringSymbol :: [Char]
bringSymbol = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"BringSymbol"
    broughtSymbol :: [Char]
broughtSymbol = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"BroughtSymbol"
    write :: [Char]
write = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"Write"
    transition :: [Char]
transition = [Char]
"transition"
    writeBroughtSymbol :: [Char]
writeBroughtSymbol = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"WriteBroughtSymbol"
    createCounterForFstNonterminal :: [Char]
createCounterForFstNonterminal = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"CreateCounterForFstNonterminal"
    createCounterForSndNonterminal :: [Char]
createCounterForSndNonterminal = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"CreateCounterForSndNonterminal"
    moveToEnd :: [Char]
moveToEnd = [Char]
qWordsChanging [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"moveToEnd"
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
    fstCounter :: [Char]
fstCounter = [Char]
"0"

    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals

    --BLOCK for qWordsChangingBringSymbol
    symbolsToBroughtSymbolt :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBroughtSymbolt = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
bringSymbol
        newState :: [Char]
newState = [Char]
broughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))
        ]) [[Char]]
terminalsList
    --BLOCK for qWordsChangingBringSymbolt (list of states generated for each terminal t)
    symbolsInBroughtSymbolt :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInBroughtSymbolt = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
broughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
broughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t)))
        [[Char]]
terminalsList
    remembered :: [[Char]]
remembered = [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets
    pairs :: [([Char], [Char])]
pairs = ([Char] -> [([Char], [Char])]) -> [[Char]] -> [([Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char] -> ([Char], [Char])) -> [[Char]] -> [([Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
t,) [[Char]]
remembered) [[Char]]
terminalsList
    symbolsToWritetk :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWritetk = (([Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
t, [Char]
k) -> let
        oldState :: [Char]
oldState = [Char]
broughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        newState :: [Char]
newState = [Char]
write [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
k),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char])]
pairs
    --BLOCK for qWordsChangingWritetk
    remembered' :: [[Char]]
remembered' = [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.leftBracket]
    pairs' :: [([Char], [Char])]
pairs' = ([Char] -> [([Char], [Char])]) -> [[Char]] -> [([Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char] -> ([Char], [Char])) -> [[Char]] -> [([Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
t,) [[Char]]
remembered') [[Char]]
terminalsList
    symbolsToBroughtSymbolt' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBroughtSymbolt' = (([Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
t, [Char]
k) -> let
        oldState :: [Char]
oldState = [Char]
write [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k
        newState :: [Char]
newState = [Char]
broughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
k, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
k),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))
        ]) [([Char], [Char])]
pairs'
    -- special case for )
    symbolsToWriteBroughtSymbolt :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWriteBroughtSymbolt = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
write [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket
        newState :: [Char]
newState = [Char]
writeBroughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [[Char]]
terminalsList

    --BLOCK for qWordsChangingWriteBroughtSymbolt
    symbolsToCreateCounterForFstNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCreateCounterForFstNonterminal = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
writeBroughtSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        newState :: [Char]
newState = [Char]
createCounterForFstNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
t, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [[Char]]
terminalsList

    --BLOCK for qWordsChangingCreateCounterForFstNonterminal
    symbolsInCreateCounterForFstNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInCreateCounterForFstNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
createCounterForFstNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
createCounterForFstNonterminal)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList
    symbolsToCreateCounterForSndNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCreateCounterForSndNonterminal = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
            oldState :: [Char]
oldState = [Char]
createCounterForFstNonterminal
            newState :: [Char]
newState = [Char]
createCounterForSndNonterminal
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
fstCounter, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
fstCounter),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))
            ]) [[Char]]
Constants.signs
    symbolsInCreateCounterForSndNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInCreateCounterForSndNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
         (([Char] -> DebuggingState
DState [Char]
createCounterForSndNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
         (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
createCounterForSndNonterminal)))
         ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [Char]
Constants.rightBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList
    symbolsToMoveToEnd :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMoveToEnd = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
createCounterForSndNonterminal
        newState :: [Char]
newState = [Char]
moveToEnd
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
fstCounter, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
fstCounter),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))
        ]) [[Char]]
Constants.signs

    --BLOCK for qWordsChangingMoveToEnd
    symbols :: [[Char]]
symbols = [Char]
fstCounter  [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList
    symbolsInMoveToEnd :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMoveToEnd = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
moveToEnd, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
moveToEnd))) [[Char]]
symbols
    symbolsToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> 
        (([Char] -> DebuggingState
DState [Char]
moveToEnd, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFindNewSubstitution))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
Constants.signs

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBroughtSymbolt [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInBroughtSymbolt [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWritetk
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToBroughtSymbolt' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToWriteBroughtSymbolt [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCreateCounterForFstNonterminal
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInCreateCounterForFstNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToCreateCounterForSndNonterminal 
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInCreateCounterForSndNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToMoveToEnd [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInMoveToEnd
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution

    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForWritingSigns :: Grammar -> DebuggingQuadruples
generateBlockForWritingSigns :: Grammar -> DebuggingQuadruples
generateBlockForWritingSigns grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
_, Set Relation
rels,Nonterminal
_)) = let
    qRewrite :: [Char]
qRewrite = [Char]
"qRewrite"
    qRewriteWithMinus :: [Char]
qRewriteWithMinus = [Char]
"qRewriteWithMinus"
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
    transition :: [Char]
transition = [Char]
"transition"
    qSkipParentNonterminal :: [Char]
qSkipParentNonterminal = [Char]
"qSkipParentNonterminal"
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals

  --BLOCK for qRewriteNWithWord (N - nonterminal)
  -- case, when current rule has one terminal in right part: applying this rule to word with more
  -- than 1 symbol is impossible
    nonterminalsWithIndices :: [(Nonterminal, [[Char]])]
nonterminalsWithIndices = Map Nonterminal [[Char]] -> [(Nonterminal, [[Char]])]
forall k a. Map k a -> [(k, a)]
Map.toList (Map Nonterminal [[Char]] -> [(Nonterminal, [[Char]])])
-> Map Nonterminal [[Char]] -> [(Nonterminal, [[Char]])]
forall a b. (a -> b) -> a -> b
$ Grammar -> Map Nonterminal [[Char]]
Helpers.getNumbersOfShortRelations Grammar
grammar
    symbolsToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution = ((Nonterminal, [[Char]])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [(Nonterminal, [[Char]])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(nonterm' :: Nonterminal
nonterm'@(Nonterminal [Char]
nonterm), [[Char]]
indices) -> ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
i -> let
        oldState :: [Char]
oldState = [Char]
qRewriteWithMinus [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
nonterm
        newState :: [Char]
newState = [Char]
qFindNewSubstitution
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        relsForNonterm :: [[Conj]]
relsForNonterm = [Relation] -> Map Nonterminal [[Conj]]
Helpers.calculateGroupRelationsByNonterminals (Set Relation -> [Relation]
forall a. Set a -> [a]
Set.toList Set Relation
rels) Map Nonterminal [[Conj]] -> Nonterminal -> [[Conj]]
forall k a. Ord k => Map k a -> k -> a
Map.! Nonterminal
nonterm'
        in
        if ([Char] -> Int
forall a. Read a => [Char] -> a
read [Char]
i :: Int) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== [[Conj]] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [[Conj]]
relsForNonterm Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1
            then
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.minus, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.minus),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]
            else
            let nextI :: [Char]
nextI = Int -> [Char]
forall a. Show a => a -> [Char]
show (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ [Char] -> Int
forall a. Read a => [Char] -> a
read [Char]
i :: Int) in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
nextI, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
nextI),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))])
         [[Char]]
indices) [(Nonterminal, [[Char]])]
nonterminalsWithIndices

    --BLOCK for qRewriteMinus or qRewritePlus
    pairs :: [([Char], [Char])]
pairs = ([Char] -> [([Char], [Char])]) -> [[Char]] -> [([Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
sign -> ([Char] -> ([Char], [Char])) -> [[Char]] -> [([Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
sign,) [[Char]]
nonterminalsList) [[Char]]
Constants.signs
    symbolsToQRewriteNSign :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRewriteNSign = (([Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
sign, [Char]
nonterm) -> let
        newState :: [Char]
newState =  [Char]
qRewrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
nonterm [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign in
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRewrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign, [Char] -> DebuggingSymbol
DSymbol [Char]
nonterm),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char])]
pairs

    --BLOCK for qRewriteNSign
    maxNumber :: Int
maxNumber = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar
    possibleIndices :: [[Char]]
possibleIndices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumber Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
    symbolsToQSkipParentNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSkipParentNonterminal = (([Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
sign, [Char]
nonterm) -> let
        oldState :: [Char]
oldState = [Char]
qRewrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
nonterm [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign
        newState :: [Char]
newState = [Char]
qSkipParentNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
index ->
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
index),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
sign, [Char] -> DebuggingState
DState [Char]
stateTransition)),
             (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
sign),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))])
             [[Char]]
possibleIndices) [([Char], [Char])]
pairs

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRewriteNSign [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSkipParentNonterminal
    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForFolding :: Grammar -> DebuggingQuadruples
generateBlockForFolding :: Grammar -> DebuggingQuadruples
generateBlockForFolding (Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    transition :: [Char]
transition = [Char]
"transition"
    qSkipParentNonterminal :: [Char]
qSkipParentNonterminal = [Char]
"qSkipParentNonterminal"
    qRemoveSymbols :: [Char]
qRemoveSymbols = [Char]
"qRemoveSymbols"
    qRemoveBracketsAroundFstWord :: [Char]
qRemoveBracketsAroundFstWord = [Char]
"qRemoveBracketsAroundFstWord"
    qRemoveBracketsAroundSndWord :: [Char]
qRemoveBracketsAroundSndWord = [Char]
"qRemoveBracketsAroundSndWord"
    qMoveToStart :: [Char]
qMoveToStart = [Char]
"qMoveToStart"
    qFold :: [Char]
qFold = [Char]
"qFold"
    qCheckLast :: [Char]
qCheckLast = [Char]
"qCheckLastRightBracket"
    lookForNewPlace :: [Char]
lookForNewPlace = [Char]
"LookForNewPlace"
    qFoldRightBracketLast' :: [Char]
qFoldRightBracketLast' = [Char]
"qFoldRightBracketLast'"
    qFoldRightBracketLast :: [Char]
qFoldRightBracketLast = [Char]
"qFoldRightBracketLast"
    qFoldRightBracket :: [Char]
qFoldRightBracket = [Char]
"qFoldRightBracket"
    qFoldRightBracket' :: [Char]
qFoldRightBracket' = [Char]
"qFoldRightBracket'"
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"

    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals

    --BLOCK for qSkipParentNonterminal
    symbolsToQRemoveSymbols :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveSymbols = [(([Char] -> DebuggingState
DState [Char]
qSkipParentNonterminal, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qRemoveSymbols))]

    --BLOCK for qRemoveSymbols
    symbolsInQRemoveSymbols :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveSymbols = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        stateTransition :: [Char]
stateTransition = [Char]
qRemoveSymbols [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition in
        [(([Char] -> DebuggingState
DState [Char]
qRemoveSymbols, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qRemoveSymbols))]) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.negation [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList
    symbolsToQRemoveBracketAroundFstWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveBracketAroundFstWord = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
sign -> let
        stateTransition :: [Char]
stateTransition = [Char]
qRemoveSymbols [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
qRemoveBracketsAroundFstWord in
        [(([Char] -> DebuggingState
DState [Char]
qRemoveSymbols, [Char] -> DebuggingSymbol
DSymbol [Char]
sign),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qRemoveBracketsAroundFstWord))]) [[Char]]
Constants.signs

    --BLOCK for qRemoveBracketsAroundFstWord
    symbolsInQRemoveBracketsAroundFstWord' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord' = let
        state :: [Char]
state = [Char]
qRemoveBracketsAroundFstWord
        stateTransition :: [Char]
stateTransition = [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
state
        in [(([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))]
    symbolsInQRemoveBracketsAroundFstWord'' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord'' = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> let
            state :: [Char]
state = [Char]
qRemoveBracketsAroundFstWord in
            (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))) [[Char]]
terminalsList
    symbolsInQRemoveBracketsAroundFstWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord =
      [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord''
    symbolsToQRemoveBracketsAroundSndWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveBracketsAroundSndWord = let
        oldState :: [Char]
oldState = [Char]
qRemoveBracketsAroundFstWord
        newState :: [Char]
newState = [Char]
qRemoveBracketsAroundSndWord
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]

    --BLOCK for qRemoveBracketsAroundSndWord
    symbolsInQRemoveBracketsAroundSndWord' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord' = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        state :: [Char]
state = [Char]
qRemoveBracketsAroundSndWord
        stateTransition :: [Char]
stateTransition = [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
state
        in [(([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))])
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.leftBracket]
    symbolsInQRemoveBracketsAroundSndWord'' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord'' = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> let
        state :: [Char]
state = [Char]
qRemoveBracketsAroundSndWord in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))) [[Char]]
terminalsList
    symbolsInQRemoveBracketsAroundSndWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord =
      [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord''
    symbolsToQMoveToStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToStart = let
        oldState :: [Char]
oldState = [Char]
qRemoveBracketsAroundSndWord
        newState :: [Char]
newState = [Char]
qMoveToStart
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]

    --BLOCK for qMoveToStart
    symbolsInQMoveToStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToStart = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
qMoveToStart, [Char] -> DebuggingSymbol
DSymbol [Char]
t),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qMoveToStart))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.space]
    symbolsToQFold :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFold = [(([Char] -> DebuggingState
DState [Char]
qMoveToStart, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qFold))]

    --BLOCK for qFold
    symbolsInQFold :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFold = [(([Char] -> DebuggingState
DState [Char]
qFold, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qFold))]
    symbolsToQFoldSLookForNewPlace :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldSLookForNewPlace = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
qFold
        newState :: [Char]
newState = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
lookForNewPlace
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))])
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs
    symbolsToQFoldRightBracketLookForNewPlace :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLookForNewPlace = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
qFold
        newState :: [Char]
newState = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
lookForNewPlace in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))) [[Char]
Constants.rightBracket]

    --BLOCK for qFoldSLookForNewPlace - it common for all symbols except ")"
    symbols :: [[Char]]
symbols = [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs
    symbolsInQFoldSLookForNewPlace :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldSLookForNewPlace = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> let
        state :: [Char]
state = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
lookForNewPlace in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
state))) [[Char]]
symbols

    --BLOCK for qFoldNonterminalLookForNewPlace
    symbolsToQFoldNonterminalWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldNonterminalWrite = [[Char]]
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' [[Char]
Constants.rightBracket] [[Char]]
nonterminalsList
    --BLOCK for qFoldTerminalLookForNewPlace
    symbolsToQFoldTerminalWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldTerminalWrite = [[Char]]
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' ([[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.leftBracket]) [[Char]]
terminalsList

    --BLOCK for qFoldSignLookForNewPlace
    symbolsToQFoldSignWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldSignWrite = [[Char]]
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' [[Char]]
nonterminalsList [[Char]]
Constants.signs

    --BLOCK for qFold(LookForNewPlace
    symbolsToQFoldLeftBracketWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldLeftBracketWrite = [[Char]]
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' [[Char]]
Constants.signs [[Char]
Constants.leftBracket]

    --BLOCK for qFold)LookForNewPlace
    qFoldRightBracketLookForNewPlace :: [Char]
qFoldRightBracketLookForNewPlace = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
lookForNewPlace
    symbolsInQFoldRightBracketLookForNewPlace :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracketLookForNewPlace =
        [(([Char] -> DebuggingState
DState [Char]
qFoldRightBracketLookForNewPlace, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),
            (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qFoldRightBracketLookForNewPlace))]
    symbolsToQCheckLastRightBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCheckLastRightBracket = let
        oldState :: [Char]
oldState = [Char]
qFoldRightBracketLookForNewPlace
        newState :: [Char]
newState = [Char]
qCheckLast
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]

    --BLOCK for qCheckLast)
    symbolsToQFoldRightBracketLast' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLast' = [(([Char] -> DebuggingState
DState [Char]
qCheckLast, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast'))]
    symbolsToQFoldRightBracket' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracket' = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qCheckLast, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFoldRightBracket'))
        ) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList

    --BLOCK for case, when bracket is not last
    symbolsInQFoldRightBracket' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracket' = [(([Char] -> DebuggingState
DState [Char]
qFoldRightBracket', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFoldRightBracket'))]
    symbolsToQFoldRightBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracket = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qFoldRightBracket', [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qFoldRightBracket))
        ) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.rightBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList
    symbolsFromRightBracketToQFold :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketToQFold = let
        oldState :: [Char]
oldState = [Char]
qFoldRightBracket
        newState :: [Char]
newState = [Char]
qFold
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]

    --BLOCK for case, when bracket is last
    symbolsInQFoldRightBracketLast' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracketLast' =
      [(([Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast', [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast'))]
    symbolsToQFoldRightBracketLast :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLast = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast', [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.rightBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList
    symbolsFromRightBracketLastToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketLastToQFindNewSubstitution = let
        oldState :: [Char]
oldState = [Char]
qFoldRightBracketLast
        newState :: [Char]
newState = [Char]
qFindNewSubstitution
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveSymbols [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveSymbols [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveBracketAroundFstWord
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundFstWord [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemoveBracketsAroundSndWord
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRemoveBracketsAroundSndWord
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToStart [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToStart [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFold [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFold
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldSLookForNewPlace [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLookForNewPlace
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldSLookForNewPlace [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldNonterminalWrite [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldTerminalWrite
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldSignWrite [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldLeftBracketWrite
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracketLookForNewPlace
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCheckLastRightBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLast' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracket'
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracket' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQFoldRightBracketLast'
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFoldRightBracketLast [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketToQFold
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketLastToQFindNewSubstitution
    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)


generateToQFoldSymbolWrite' :: [String] -> [String]
    -> [((DebuggingState, DebuggingSymbol), (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' :: [[Char]]
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
generateToQFoldSymbolWrite' [[Char]]
inputSymbols [[Char]]
stateSymbols = let
    qFold :: [Char]
qFold = [Char]
"qFold"
    lookForNewPlace :: [Char]
lookForNewPlace = [Char]
"LookForNewPlace"
    write :: [Char]
write = [Char]
"write"
    transition :: [Char]
transition = [Char]
"transition"
    symbolsToQSymbolWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSymbolWrite = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
lookForNewPlace
        newState :: [Char]
newState = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
write in
        ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s -> (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
s),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState)))
            [[Char]]
inputSymbols) [[Char]]
stateSymbols
    symbolsInQSymbolWrite :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSymbolWrite = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
qFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
write
        newState :: [Char]
newState = [Char]
qFold
        transitionState :: [Char]
transitionState = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
t, [Char] -> DebuggingState
DState [Char]
transitionState)),
        (([Char] -> DebuggingState
DState [Char]
transitionState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [[Char]]
stateSymbols
    in [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSymbolWrite [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSymbolWrite

generateBlockForCountWordLength :: Grammar -> DebuggingQuadruples
generateBlockForCountWordLength :: Grammar -> DebuggingQuadruples
generateBlockForCountWordLength grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
relations, Nonterminal
_)) = let
    qWriteStartCounter :: [Char]
qWriteStartCounter = [Char]
"qWriteStartCounter"
    qCountWordLength :: [Char]
qCountWordLength = [Char]
"qCountWordLength"
    qCheckSymbol :: [Char]
qCheckSymbol = [Char]
"qCheckSymbol"
    qSymbol :: [Char]
qSymbol = [Char]
"qSymbol"
    qWord :: [Char]
qWord = [Char]
"qWord"
    qStart :: [Char]
qStart =[Char]
"qStart"
    qChooseRelation :: [Char]
qChooseRelation = [Char]
"qChooseRelation"
    qRememberStart :: [Char]
qRememberStart = [Char]
"qRememberStart"
    qRewriteWithMinus :: [Char]
qRewriteWithMinus = [Char]
"qRewriteWithMinus"
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
    q :: [Char]
q = [Char]
"q"
    transition :: [Char]
transition = [Char]
"transition"
    one :: [Char]
one = [Char]
"0"
    maxNumber :: Int
maxNumber = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar
    indices :: [[Char]]
indices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumber Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    relationsList :: [Relation]
relationsList = Set Relation -> [Relation]
forall a. Set a -> [a]
Set.toList Set Relation
relations

    symbolsToQWriteStartCounterK :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteStartCounterK = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        st :: DebuggingState
st@(DState [Char]
oldState) = DebuggingState
startDState
        newState :: [Char]
newState = [Char]
qWriteStartCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [((DebuggingState
st, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
one, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
one),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))
        ]) [[Char]]
nonterminalsList

    --BLOCK for qWriteStartCounterK
    symbolsToQCountWordLength :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCountWordLength = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        oldState :: [Char]
oldState = [Char]
qWriteStartCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t
        newState :: [Char]
newState = [Char]
qCountWordLength
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
t, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))
        ]) [[Char]]
nonterminalsList

    --BLOCK for qCountWordLength
    symbolsInQCountWordLength :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQCountWordLength = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qCountWordLength, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qCountWordLength)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
indices [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList
    symbolsToQCheckSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCheckSymbol = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qCountWordLength, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
qCheckSymbol))) [[Char]]
terminalsList

    --BLOCK for qCheckSymbol
    symbolsToQSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSymbol = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qCheckSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSymbol))) [[Char]
Constants.rightBracket]
    symbolsToQWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWord = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
            (([Char] -> DebuggingState
DState [Char]
qCheckSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qWord))) [[Char]]
terminalsList

    --BLOCK for qSymbol
    symbolsInQSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSymbol = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qSymbol))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.leftBracket]
    symbolsToQStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQStart = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qSymbol, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qStart))) [[Char]]
indices
    
    --BLOCK for qStart
    symbolsToQNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQNonterminal = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qStart, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t))) [[Char]]
nonterminalsList

    --BLOCK for qNonterminal
    symbolsInQNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQNonterminal = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> let
        symbols :: [[Char]]
symbols = [[Char]]
indices [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]
Constants.leftBracket]
        in ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s ->
            (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t, [Char] -> DebuggingSymbol
DSymbol [Char]
s),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t)))
            [[Char]]
symbols) [[Char]]
nonterminalsList
    symbolsToQNonterminalSign :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQNonterminalSign = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s ->
        if Grammar -> [Char] -> [Char] -> Bool
Helpers.symbolAcceptedByNonterminal Grammar
grammar [Char]
t [Char]
s
            then (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t, [Char] -> DebuggingSymbol
DSymbol [Char]
s),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.plus))
            else (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t, [Char] -> DebuggingSymbol
DSymbol [Char]
s),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.minus))
        ) [[Char]]
terminalsList) [[Char]]
nonterminalsList

    --BLOCK for qNonterminal
    -- if there is no terminals, which is accepted by given nonterminal, there will be unreachable
    -- state qNonterminal+
    symbolsInQNonterminalSign :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQNonterminalSign = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
sign ->
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign)))
        [[Char]]
Constants.signs) [[Char]]
nonterminalsList
    symbolsToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
t -> ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
sign -> let
        oldState :: [Char]
oldState = [Char]
q [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sign
        newState :: [Char]
newState = [Char]
qFindNewSubstitution
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
i -> [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
sign, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
sign),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [[Char]]
indices
        ) [[Char]]
Constants.signs) [[Char]]
nonterminalsList

    --BLOCK for qWord
    symbolsInQWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWord = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qWord, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
qWord))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList
    symbolsToQChooseRelationI :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQChooseRelationI = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
        (([Char] -> DebuggingState
DState [Char]
qWord, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qChooseRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t))) [[Char]]
indices

    --BLOCK for qChooseRelationI
    symbolsToQRemember :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemember = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
k -> let
        nonterminals' :: [[Char]]
nonterminals' = ([Char] -> Bool) -> [[Char]] -> [[Char]]
forall a. (a -> Bool) -> [a] -> [a]
filter (\[Char]
n -> [Relation] -> [Char] -> [Char] -> Bool
Helpers.kthRelForNonterminalLong [Relation]
relationsList [Char]
n [Char]
k) [[Char]]
nonterminalsList
        oldState :: [Char]
oldState = [Char]
qChooseRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k
        in ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> let
            (SymbolsPair (Nonterminal
_, Int
number, Bool
_, Symbol
nonterm1, Symbol
nonterm2)) = Grammar -> [Char] -> [Char] -> SymbolsPair
Helpers.getFstConjInKthRel Grammar
grammar [Char]
t [Char]
k
            nonterm1Val :: [Char]
nonterm1Val = Symbol -> [Char]
Helpers.refineSymbolInConjunctionToNonterminal Symbol
nonterm1
            nonterm2Val :: [Char]
nonterm2Val = Symbol -> [Char]
Helpers.refineSymbolInConjunctionToNonterminal Symbol
nonterm2
            newState :: [Char]
newState = [Char]
qRememberStart [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
number [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
nonterm1Val [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
nonterm2Val
            in
            (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState)))
            [[Char]]
nonterminals') [[Char]]
indices

    symbolsToQRewriteWithMinusNonterminal :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRewriteWithMinusNonterminal = ([Char]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[Char]
k -> let
        nonterminals' :: [[Char]]
nonterminals' = ([Char] -> Bool) -> [[Char]] -> [[Char]]
forall a. (a -> Bool) -> [a] -> [a]
filter (\[Char]
n -> [Relation] -> [Char] -> [Char] -> Bool
Helpers.kthRelForNonterminalLong [Relation]
relationsList [Char]
n [Char]
k) [[Char]]
nonterminalsList
        rest :: [[Char]]
rest = [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. Eq a => [a] -> [a] -> [a]
\\ [[Char]]
nonterminals'
        oldState :: [Char]
oldState = [Char]
qChooseRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k
        in ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t ->
            (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRewriteWithMinus [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t)))
            [[Char]]
rest) [[Char]]
indices


    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteStartCounterK [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCountWordLength [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQCountWordLength
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQCheckSymbol [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQSymbol [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWord [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQSymbol
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQStart [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWord [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQChooseRelationI [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRemember
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRewriteWithMinusNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQNonterminal [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQNonterminal
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQNonterminalSign [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQNonterminalSign [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution
    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForPreparingForSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForPreparingForSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForPreparingForSubstitution grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    qRememberStart :: [Char]
qRememberStart = [Char]
"qRememberStart"
    qRemember :: [Char]
qRemember = [Char]
"qRemember"
    markEnd :: [Char]
markEnd = [Char]
"MarkEnd"
    qShiftWord :: [Char]
qShiftWord = [Char]
"qShiftWord"
    qWriteSymbol :: [Char]
qWriteSymbol = [Char]
"qWriteSymbol"
    qWriteRemembered :: [Char]
qWriteRemembered = [Char]
"qWriteRemembered"
    qWriteCounter :: [Char]
qWriteCounter = [Char]
"qWriteCounter"
    qMoveToEnd :: [Char]
qMoveToEnd = [Char]
"qMoveToEnd"
    qUnmarkEnd :: [Char]
qUnmarkEnd = [Char]
"qUnmarkEnd"
    qWritingRelation :: [Char]
qWritingRelation = [Char]
"qWritingRelation"

    transition :: [Char]
transition = [Char]
"transition"
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    maxNumberOfRels :: Int
maxNumberOfRels = Grammar -> Int
Helpers.calculateMaxNumberOfRulesForNonterminal Grammar
grammar
    indices :: [[Char]]
indices = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
0..Int
maxNumberOfRels Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]

    quads :: [([Char], [Char], [Char], [Char])]
quads = Grammar -> [([Char], [Char], [Char], [Char])]
Helpers.calculateAllQuads Grammar
grammar
    --BLOCK for qRememberStartCounterNonterm1Nonterm2Nonterm3
    rememberedSymbols :: [[Char]]
rememberedSymbols = [Char]
Constants.rightBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList
    quintets :: [([Char], [Char], [Char], [Char], [Char])]
quintets = (([Char], [Char], [Char], [Char])
 -> [([Char], [Char], [Char], [Char], [Char])])
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char] -> ([Char], [Char], [Char], [Char], [Char]))
-> [[Char]] -> [([Char], [Char], [Char], [Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
k, [Char]
t, [Char]
j, [Char]
f,) [[Char]]
rememberedSymbols) [([Char], [Char], [Char], [Char])]
quads

    symbolsInQRememberStartLeftKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberStartLeftKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
symbol ->
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRememberStart  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol),
        (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRememberStart  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList)
        [([Char], [Char], [Char], [Char])]
quads

    symbolsInQRememberStartRightKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberStartRightKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
symbol ->
        (([Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRememberStart  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol),
        (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
qRememberStart  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f))) ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.leftBracket [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
indices)
        [([Char], [Char], [Char], [Char])]
quads
    symbolsToQRememberSymbolMarkEndKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRememberSymbolMarkEndKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
symbol) -> let
        oldState :: [Char]
oldState = [Char]
qRememberStart  [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qRemember [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
symbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
markEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char])]
quintets

    --BLOCK for qRememberSymbolMarkEndKTJF
    symbolsInQRememberSymbolMarkEndKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberSymbolMarkEndKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
symbol -> let
        state :: [Char]
state = [Char]
qRemember [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
markEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state)))
         ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList) [([Char], [Char], [Char], [Char], [Char])]
quintets
    symbolsToQShiftWordSymbolKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQShiftWordSymbolKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qRemember [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
markEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.hash, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.hash), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char])]
quintets

    --BLOCK for qShiftWordSymbolKTJF
    symbolsInQShiftWordSymbolKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQShiftWordSymbolKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        state :: [Char]
state = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        [(([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
state))]) [([Char], [Char], [Char], [Char], [Char])]
quintets

    symbolsWithSimilarStatesForTerms :: [[Char]]
symbolsWithSimilarStatesForTerms = [Char]
Constants.hash [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++
        [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets

    tuple6 :: [([Char], [Char], [Char], [Char], [Char], [Char])]
tuple6 = (([Char], [Char], [Char], [Char], [Char])
 -> [([Char], [Char], [Char], [Char], [Char], [Char])])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char], [Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> ([Char] -> ([Char], [Char], [Char], [Char], [Char], [Char]))
-> [[Char]] -> [([Char], [Char], [Char], [Char], [Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s,)
        [[Char]]
symbolsWithSimilarStatesForTerms) [([Char], [Char], [Char], [Char], [Char])]
quintets
    symbolsToQWriteSymbolKTJFsymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFsymbol = (([Char], [Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s, [Char]
s') -> let
        oldState :: [Char]
oldState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWriteSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s'
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
s'), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]
        ) [([Char], [Char], [Char], [Char], [Char], [Char])]
tuple6

    -- case for star for terminals and bracket
    symbolsToQWriteSymbolKTJFStar :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFStar = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWriteRemembered [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char], [Char])]
quintets

    --FIXME add docs to size of shift dependence
    shift :: Int
shift = Int
6
    shifts :: [[Char]]
shifts = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
1..Int
shift]
    shiftNeg :: Int
shiftNeg = Int
7
    shiftsNeg :: [[Char]]
shiftsNeg = (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show [Int
1..Int
shiftNeg]
    -- case for shifts for terminals
    terminalQuintets :: [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets = (([Char], [Char], [Char], [Char])
 -> [([Char], [Char], [Char], [Char], [Char])])
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) ->
        ([Char] -> ([Char], [Char], [Char], [Char], [Char]))
-> [[Char]] -> [([Char], [Char], [Char], [Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
k, [Char]
t, [Char]
j, [Char]
f,) [[Char]]
terminalsList) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQWriteSymbolKTJFshift :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFshift = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) ->
        if Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char]
k, [Char]
t, [Char]
j, [Char]
f) then
            ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
i -> let
            oldState :: [Char]
oldState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
            (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [[Char]]
shiftsNeg
        else
            ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
i -> let
            oldState :: [Char]
oldState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
            (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [[Char]]
shifts
            ) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets

    --BLOCK for qWriteSymbolKTJFs'
    symbolsFromQWriteSymbolKTJFs'ToQShiftWordSymbolKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWriteSymbolKTJFs'ToQShiftWordSymbolKTJF = (([Char], [Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s, [Char]
s') -> let
        oldState :: [Char]
oldState = [Char]
qWriteSymbol [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s'
        newState :: [Char]
newState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
s', [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
s'), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char], [Char])]
tuple6

    --BLOCK for qWriteRememberedsKTJF
    shiftsPairs :: [([Char], [Char])]
shiftsPairs = Int -> [Char] -> [([Char], [Char])]
Helpers.getShiftsDecrements Int
shift [Char]
Constants.star
    shiftsPairsNeg :: [([Char], [Char])]
shiftsPairsNeg = Int -> [Char] -> [([Char], [Char])]
Helpers.getShiftsDecrements Int
shiftNeg [Char]
Constants.star
    symbolsToQWriteCountersKTJFterminals :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteCountersKTJFterminals = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qWriteRemembered [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
        in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
s, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets
    -- BLOCK for qWriteCounterSymbolKTJF (terminals)
    symbolsInQWriteCountersKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteCountersKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
oldState))) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets

    -- pair ("1", "*") = pair of end of shifting, there is special transition, this pair called endShift
    -- rest of pairs called midPairs
    endShift :: ([Char], [Char])
endShift = [([Char], [Char])] -> ([Char], [Char])
forall a. [a] -> a
head ([([Char], [Char])] -> ([Char], [Char]))
-> [([Char], [Char])] -> ([Char], [Char])
forall a b. (a -> b) -> a -> b
$ (([Char], [Char]) -> Bool)
-> [([Char], [Char])] -> [([Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char])
t -> ([Char], [Char]) -> [Char]
forall a b. (a, b) -> b
snd ([Char], [Char])
t [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
Constants.star) [([Char], [Char])]
shiftsPairs
    midShifts :: [([Char], [Char])]
midShifts = [([Char], [Char])]
shiftsPairs [([Char], [Char])] -> [([Char], [Char])] -> [([Char], [Char])]
forall a. Eq a => [a] -> [a] -> [a]
\\ [([Char], [Char])
endShift]
    endShiftNeg :: ([Char], [Char])
endShiftNeg = [([Char], [Char])] -> ([Char], [Char])
forall a. [a] -> a
head ([([Char], [Char])] -> ([Char], [Char]))
-> [([Char], [Char])] -> ([Char], [Char])
forall a b. (a -> b) -> a -> b
$ (([Char], [Char]) -> Bool)
-> [([Char], [Char])] -> [([Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char], [Char])
t -> ([Char], [Char]) -> [Char]
forall a b. (a, b) -> b
snd ([Char], [Char])
t [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
Constants.star) [([Char], [Char])]
shiftsPairsNeg
    midShiftsNeg :: [([Char], [Char])]
midShiftsNeg = [([Char], [Char])]
shiftsPairsNeg [([Char], [Char])] -> [([Char], [Char])] -> [([Char], [Char])]
forall a. Eq a => [a] -> [a] -> [a]
\\ [([Char], [Char])
endShiftNeg]

    symbolsToQUnmarkEndKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQUnmarkEndKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) ->
        if Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char]
k, [Char]
t, [Char]
j, [Char]
f) then let
            oldState :: [Char]
oldState =  [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
            oldSymbol :: [Char]
oldSymbol = ([Char], [Char]) -> [Char]
forall a b. (a, b) -> a
fst ([Char], [Char])
endShiftNeg
            newSymbol :: [Char]
newSymbol = ([Char], [Char]) -> [Char]
forall a b. (a, b) -> b
snd ([Char], [Char])
endShiftNeg in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
oldSymbol), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
newSymbol, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
newSymbol), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]
        else let
            oldState :: [Char]
oldState =  [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState
            oldSymbol :: [Char]
oldSymbol = ([Char], [Char]) -> [Char]
forall a b. (a, b) -> a
fst ([Char], [Char])
endShift
            newSymbol :: [Char]
newSymbol = ([Char], [Char]) -> [Char]
forall a b. (a, b) -> b
snd ([Char], [Char])
endShift in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
oldSymbol), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
newSymbol, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
newSymbol), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]
        ) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets
    symbolsToQMoveToEndsKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndsKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) ->
        if Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char]
k, [Char]
t, [Char]
j, [Char]
f) then
            (([Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\ ([Char]
i, [Char]
iDecr) -> let
            oldState :: [Char]
oldState =  [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qMoveToEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
iDecr, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
iDecr), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char])]
midShiftsNeg
         else
            (([Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\ ([Char]
i, [Char]
iDecr) -> let
            oldState :: [Char]
oldState =  [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qMoveToEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
i), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
iDecr, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
iDecr), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char])]
midShifts
        ) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets

    --BLOCK for qMoveToEndsKTJF
    symbolsInQMoveToEndKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
symbol -> let
        state :: [Char]
state = [Char]
qMoveToEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets
    symbolsFromQMoveToEndToQShiftWordSymbolKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQMoveToEndToQShiftWordSymbolKTJF = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qMoveToEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qShiftWord [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.hash), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char], [Char])]
terminalQuintets

    -- BLOCK for star (bracket - special case)
    symbolsInQWriteRememberedBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteRememberedBracket = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWriteRemembered [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
oldState
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQUnmarkEndKTJFBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQUnmarkEndKTJFBracket = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWriteRemembered [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]
        ) [([Char], [Char], [Char], [Char])]
quads

    symbolsInQUnmarkEndKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQUnmarkEndKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s -> let
        state :: [Char]
state = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQWritingRelationKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWritingRelationKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
            oldState :: [Char]
oldState = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            newState :: [Char]
newState = [Char]
qWritingRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
            stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
            [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.hash), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
            (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    symbolsInQUnmarkEndKTJFBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQUnmarkEndKTJFBracket = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s -> let
        state :: [Char]
state = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
terminalsList) [([Char], [Char], [Char], [Char])]
quads
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
    symbolsToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qUnmarkEnd [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket
        newState :: [Char]
newState = [Char]
qFindNewSubstitution
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.hash), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberStartRightKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberStartLeftKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQRememberSymbolMarkEndKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQRememberSymbolMarkEndKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQShiftWordSymbolKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQShiftWordSymbolKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFsymbol
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFStar [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteSymbolKTJFshift
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWriteSymbolKTJFs'ToQShiftWordSymbolKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteCountersKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQMoveToEndsKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteCountersKTJFterminals  [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteRememberedBracket
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQUnmarkEndKTJFBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQUnmarkEndKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWritingRelationKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQMoveToEndKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQMoveToEndToQShiftWordSymbolKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQUnmarkEndKTJF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQUnmarkEndKTJFBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQFindNewSubstitution
    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForSubstitution :: Grammar -> DebuggingQuadruples
generateBlockForSubstitution grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_) ) = let
    qWritingRelation :: [Char]
qWritingRelation = [Char]
"qWritingRelation"
    qWrite :: [Char]
qWrite = [Char]
"qWrite"
    transition :: [Char]
transition = [Char]
"transition"
    qWriteCounter :: [Char]
qWriteCounter = [Char]
"qWriteCounter"
    qLetterWriting :: [Char]
qLetterWriting = [Char]
"qLetterWriting"
    preparation :: [Char]
preparation = [Char]
"Preparation"
    letter :: [Char]
letter = [Char]
"Letter"
    shiftWord :: [Char]
shiftWord = [Char]
"ShiftWord"
    qRememberStart :: [Char]
qRememberStart = [Char]
"qRememberStart"

    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals

    quads :: [([Char], [Char], [Char], [Char])]
quads = Grammar -> [([Char], [Char], [Char], [Char])]
Helpers.calculateAllQuads Grammar
grammar

    quadsNeg :: [([Char], [Char], [Char], [Char])]
quadsNeg = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar) [([Char], [Char], [Char], [Char])]
quads
    quadsPos :: [([Char], [Char], [Char], [Char])]
quadsPos = [([Char], [Char], [Char], [Char])]
quads [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. Eq a => [a] -> [a] -> [a]
\\ [([Char], [Char], [Char], [Char])]
quadsNeg

    --BLOCK for qWritingRelationKTJF
    symbols :: [[Char]]
symbols = [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs
    symbolsInQWritingRelationKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWritingRelationKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
symbol ->
        let state :: [Char]
state = [Char]
qWritingRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
state))) [[Char]]
symbols) [([Char], [Char], [Char], [Char])]
quads

    fstNonterminal :: [Char]
fstNonterminal = [Char]
"1"
    sndNonterminal :: [Char]
sndNonterminal = [Char]
"2"
    -- block for case when conj (k, t, j, f) has neg
    symbolsFromQWritingRelationToQWriteKTJFT :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWritingRelationToQWriteKTJFT = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWritingRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.negation, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.negation), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quadsNeg
    symbolsFromQWriteKTJFJtoQWriteCounterKTJFJ :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWriteKTJFJtoQWriteCounterKTJFJ = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j
        newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
j, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
j), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quadsNeg

    -- block for case when conj (k, t, j, f) does not have neg
    -- writing initial value to counter
    symbolsFromQWritingRelationToQWriteCounterKTJFT :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWritingRelationToQWriteCounterKTJFT = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWritingRelation [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.star), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
j, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
j), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quadsPos

    -- block for qWriteKTJFJCounter
    one :: [Char]
one = [Char]
"0"
    symbolsToQWriteKTJFJleftBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJleftBracket = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.leftBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
one, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
one), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    -- block for qWriteKJFJSymbol
    symbolsToQWriteKTJFJSymbol :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJSymbol = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.leftBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
letter
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

     -- block for qWriteKTJFJSymbol
     -- creating empty space for first word letter, which will move here after
    symbolsToQWriteKTJFJRightBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJRightBracket = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
letter
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char])]
quads

    -- block for qWriteKTJFJRightBracket
    symbolsToQKTJFJletterWriting :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFJletterWriting = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
fstNonterminal
        newState :: [Char]
newState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    -- block for qLetterWritingKTJFJs'
    quintets :: [([Char], [Char], [Char], [Char], [Char])]
quintets = (([Char], [Char], [Char], [Char])
 -> [([Char], [Char], [Char], [Char], [Char])])
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char], [Char])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char] -> ([Char], [Char], [Char], [Char], [Char]))
-> [[Char]] -> [([Char], [Char], [Char], [Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ([Char]
k, [Char]
t, [Char]
j, [Char]
f,) [[Char]]
terminalsList) [([Char], [Char], [Char], [Char])]
quads
    symbolsInQLetterWritingKTJFJ :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQLetterWritingKTJFJ = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        state :: [Char]
state = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQletterWritingKTJFJs' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQletterWritingKTJFJs' = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j
        newState :: [Char]
newState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.comma
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char])]
quintets

    -- block for qLetterWritingKTJFJs'
    skipSymbols :: [[Char]]
skipSymbols = [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]
Constants.rightBracket]
    symbolsInQLetterWritingKTJFJs' :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQLetterWritingKTJFJs' = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
skipSymbol -> let
        state :: [Char]
state = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.comma in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
skipSymbol), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
state))) [[Char]]
skipSymbols) [([Char], [Char], [Char], [Char], [Char])]
quintets
    symbolsToQletterWritingKTJFJs :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQletterWritingKTJFJs = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.comma
        newState :: [Char]
newState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char], [Char])]
quintets

    -- block for qLetterWritingKTJF
    symbolsToQWriteKTJFF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFF = (([Char], [Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qLetterWriting [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
s
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
s, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char], [Char])]
quintets

    -- block for qWriteKTJFF
    symbolsInQWriteKTJFF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteKTJFF = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        state :: [Char]
state = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQWriteCounterKTJFF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteCounterKTJFF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
f, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
f), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    --block for qWriteCounterKTJFF
    symbolsToQWriteKTJFFleftBracket :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFFleftBracket = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWriteCounter [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.leftBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sndNonterminal
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
one, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
one), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    --block for qWriteKTJFFleftBracket
    symbolsToQWriteKTJFFRightBracketPreparation :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFFRightBracketPreparation = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.leftBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sndNonterminal
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sndNonterminal [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
preparation
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space), (DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.leftBracket), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    --block for qWriteKTJFFRightBracketPreparation
    symbolsInQWriteKTJFFRightBracketPreparation :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteKTJFFRightBracketPreparation = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        state :: [Char]
state = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sndNonterminal [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
preparation in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
state))) [([Char], [Char], [Char], [Char], [Char])]
quintets
    symbolsToQKTJFFRightBracketShiftWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFFRightBracketShiftWord = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
sndNonterminal [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
preparation
        newState :: [Char]
newState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
shiftWord in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket), (DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char])]
quads
    
    --block for qWriteKTJFFRightBracketShiftWord -- transition state for moving to qRememberStartKTJF block
    -- we've generated in previous block case for shifting ')' on one cell, now we use it to move all
    -- symbols, which are more right then letters of word, to put ')' after word
    symbolsToQKTJFShiftWord :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFShiftWord = (([Char], [Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f, [Char]
s) -> let
        oldState :: [Char]
oldState = [Char]
qWrite [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.rightBracket [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
shiftWord
        newState :: [Char]
newState = [Char]
qRememberStart [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
s), (DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char], [Char])]
quintets

    quadruples :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWritingRelationKTJF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWritingRelationToQWriteKTJFT
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWriteKTJFJtoQWriteCounterKTJFJ
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromQWritingRelationToQWriteCounterKTJFT
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJleftBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJSymbol
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFJRightBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFJletterWriting
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQletterWritingKTJFJs' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQLetterWritingKTJFJ
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQLetterWritingKTJFJs' [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQletterWritingKTJFJs
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteKTJFF [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteCounterKTJFF
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFFleftBracket [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQWriteKTJFFRightBracketPreparation
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQWriteKTJFFRightBracketPreparation [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFFRightBracketShiftWord
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFShiftWord
    in (Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
quadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty)

generateBlockForMovingToNextConjunction :: Grammar -> DebuggingQuadruples
generateBlockForMovingToNextConjunction :: Grammar -> DebuggingQuadruples
generateBlockForMovingToNextConjunction grammar :: Grammar
grammar@(Grammar (Set Nonterminal
nonterminals, Set Terminal
terminals, Set Relation
_, Nonterminal
_)) = let
    transition :: [Char]
transition = [Char]
"Transition"
    qShiftingFromFold :: [Char]
qShiftingFromFold = [Char]
"qShiftingKTJFFromFold"
    qRememberStart :: [Char]
qRememberStart = [Char]
"qRememberStart"

    terminalsList :: [[Char]]
terminalsList = (Terminal -> [Char]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Terminal -> [Char]
terminalValue ([Terminal] -> [[Char]]) -> [Terminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Terminal -> [Terminal]
forall a. Set a -> [a]
Set.toList Set Terminal
terminals
    nonterminalsList :: [[Char]]
nonterminalsList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    -- helper calculations of quads
    --qauds in this block - all conjs, which has next conj
    quads' :: [([Char], [Char], [Char], [Char])]
quads' = Grammar -> [([Char], [Char], [Char], [Char])]
Helpers.calculateAllQuads Grammar
grammar
    -- if conj has next conj, then function calculateNextConjunctionInSameRule gives (Just s),
    -- where s - next conj (SymbolsPair)
    quads :: [([Char], [Char], [Char], [Char])]
quads = (([Char], [Char], [Char], [Char]) -> Bool)
-> [([Char], [Char], [Char], [Char])]
-> [([Char], [Char], [Char], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> if Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char]
k, [Char]
t, [Char]
j, [Char]
f)
        then let
            pair :: SymbolsPair
pair = (Nonterminal, Int, Bool, Symbol, Symbol) -> SymbolsPair
SymbolsPair ([Char] -> Nonterminal
Nonterminal [Char]
t, [Char] -> Int
forall a. Read a => [Char] -> a
read [Char]
k :: Int, Bool
True,
                Nonterminal -> Symbol
N (Nonterminal -> Symbol) -> Nonterminal -> Symbol
forall a b. (a -> b) -> a -> b
$ [Char] -> Nonterminal
Nonterminal [Char]
j, Nonterminal -> Symbol
N (Nonterminal -> Symbol) -> Nonterminal -> Symbol
forall a b. (a -> b) -> a -> b
$ [Char] -> Nonterminal
Nonterminal [Char]
f) in
            case Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateNextConjunctionInSameRule Grammar
grammar SymbolsPair
pair of
            Just SymbolsPair
_ -> Bool
True
            Maybe SymbolsPair
Nothing -> Bool
False
        else let
            pair :: SymbolsPair
pair = (Nonterminal, Int, Bool, Symbol, Symbol) -> SymbolsPair
SymbolsPair ([Char] -> Nonterminal
Nonterminal [Char]
t, [Char] -> Int
forall a. Read a => [Char] -> a
read [Char]
k :: Int, Bool
False,
                Nonterminal -> Symbol
N (Nonterminal -> Symbol) -> Nonterminal -> Symbol
forall a b. (a -> b) -> a -> b
$ [Char] -> Nonterminal
Nonterminal [Char]
j, Nonterminal -> Symbol
N (Nonterminal -> Symbol) -> Nonterminal -> Symbol
forall a b. (a -> b) -> a -> b
$ [Char] -> Nonterminal
Nonterminal [Char]
f) in
            case Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateNextConjunctionInSameRule Grammar
grammar SymbolsPair
pair  of
            Just SymbolsPair
_ -> Bool
True
            Maybe SymbolsPair
Nothing -> Bool
False) [([Char], [Char], [Char], [Char])]
quads'
    qFoldRightBracketLast :: [Char]
qFoldRightBracketLast = [Char]
"qFoldRightBracketLast"
    qFindNewSubstitution :: [Char]
qFindNewSubstitution = [Char]
"qFindNewSubstitution"
    stateTransitionOld :: [Char]
stateTransitionOld = [Char]
qFoldRightBracketLast [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
qFindNewSubstitution
    -- whole transition is ((DState qFoldRightBracketLast, DSymbol " "),(D $ DSymbol rightBracket, DState stateTransition))
    differentTransition1Key :: (DebuggingState, DebuggingSymbol)
differentTransition1Key = ([Char] -> DebuggingState
DState [Char]
qFoldRightBracketLast, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space)
    -- whole transition is ((DState stateTransition, DSymbol rightBracket),(DebuggingTMTypes.R, DState qFindNewSubstitution))
    differentTransition2Key :: (DebuggingState, DebuggingSymbol)
differentTransition2Key = ([Char] -> DebuggingState
DState [Char]
stateTransitionOld, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket)
    (DQuadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap'') = Grammar -> DebuggingQuadruples
generateBlockForFolding Grammar
grammar
    quadruplesMap' :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap' = (DebuggingState, DebuggingSymbol)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => k -> Map k a -> Map k a
Map.delete (DebuggingState, DebuggingSymbol)
differentTransition1Key Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap''
    quadruplesMap :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap = (DebuggingState, DebuggingSymbol)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => k -> Map k a -> Map k a
Map.delete (DebuggingState, DebuggingSymbol)
differentTransition2Key Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap'

    generatedQuadruples :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
generatedQuadruples = Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> [([Char], [Char], [Char], [Char])]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall a.
Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
-> [([Char], [Char], [Char], [Char])]
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
generateFoldingForMidCongs Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
quadruplesMap [([Char], [Char], [Char], [Char])]
quads

    -- generate special case for transition1 and transition2
    symbolsFromRightBracketLastToQFindNewSubstitution :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketLastToQFindNewSubstitution = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qFoldRightBracketLast [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        newState :: [Char]
newState = [Char]
qShiftingFromFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        stateTransition :: [Char]
stateTransition = [Char]
oldState [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
transition [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
newState in
        [(([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.space),(DebuggingSymbol -> DebuggingMove
D (DebuggingSymbol -> DebuggingMove)
-> DebuggingSymbol -> DebuggingMove
forall a b. (a -> b) -> a -> b
$ [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket, [Char] -> DebuggingState
DState [Char]
stateTransition)),
        (([Char] -> DebuggingState
DState [Char]
stateTransition, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.rightBracket),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))]) [([Char], [Char], [Char], [Char])]
quads

    symbolsInQShiftingFromFoldKTJF :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQShiftingFromFoldKTJF = (([Char], [Char], [Char], [Char])
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
s -> let
        state :: [Char]
state = [Char]
qShiftingFromFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
        (([Char] -> DebuggingState
DState [Char]
state, [Char] -> DebuggingSymbol
DSymbol [Char]
s),(DebuggingMove
DebuggingTMTypes.L, [Char] -> DebuggingState
DState [Char]
state)))
        ([[Char]]
 -> [((DebuggingState, DebuggingSymbol),
      (DebuggingMove, DebuggingState))])
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> a -> b
$ [[Char]]
nonterminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [Char]
Constants.space [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[Char]]
terminalsList [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.brackets [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
Constants.signs) [([Char], [Char], [Char], [Char])]
quads
    symbolsToQKTJFRememberStart :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFRememberStart = (([Char], [Char], [Char], [Char])
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [([Char], [Char], [Char], [Char])]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\quad :: ([Char], [Char], [Char], [Char])
quad@([Char]
k, [Char]
t, [Char]
j, [Char]
f) -> let
        oldState :: [Char]
oldState = [Char]
qShiftingFromFold [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f
        hasNeg :: Bool
hasNeg = Grammar -> ([Char], [Char], [Char], [Char]) -> Bool
Helpers.checkIfConjHasNeg Grammar
grammar ([Char], [Char], [Char], [Char])
quad
        pair :: SymbolsPair
pair = ([Char], [Char], [Char], [Char]) -> Bool -> SymbolsPair
Helpers.constructSymbolsPairByQuad ([Char], [Char], [Char], [Char])
quad Bool
hasNeg
        (SymbolsPair (Nonterminal [Char]
t', Int
k', Bool
_, Symbol
j', Symbol
f')) =
          case Grammar -> SymbolsPair -> Maybe SymbolsPair
Helpers.calculateNextConjunctionInSameRule Grammar
grammar SymbolsPair
pair of
            Just SymbolsPair
p -> SymbolsPair
p
            Maybe SymbolsPair
Nothing -> [Char] -> SymbolsPair
forall a. HasCallStack => [Char] -> a
error [Char]
"Next pair does not exist, though original was in list of mid conjs."
        j'' :: [Char]
j'' = Symbol -> [Char]
Helpers.refineSymbolInConjunctionToNonterminal Symbol
j'
        f'' :: [Char]
f'' = Symbol -> [Char]
Helpers.refineSymbolInConjunctionToNonterminal Symbol
f'
        newState :: [Char]
newState = [Char]
qRememberStart [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
k' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j'' [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f'' in
        (([Char] -> DebuggingState
DState [Char]
oldState, [Char] -> DebuggingSymbol
DSymbol [Char]
k),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
newState))) [([Char], [Char], [Char], [Char])]
quads
    newQuadruples :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
newQuadruples = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap
        ([((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsFromRightBracketLastToQFindNewSubstitution
        [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToQKTJFRememberStart [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInQShiftingFromFoldKTJF)
        Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty
    allQuadruplesMap :: Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
allQuadruplesMap = Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
generatedQuadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
newQuadruples
    in Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
allQuadruplesMap

generateBlockForGettingAccepted :: Grammar -> DebuggingQuadruples
generateBlockForGettingAccepted :: Grammar -> DebuggingQuadruples
generateBlockForGettingAccepted (Grammar (Set Nonterminal
nonterminals, Set Terminal
_, Set Relation
_, Nonterminal
_)) = let
    done :: [Char]
done = [Char]
"Done"
    nonterminalslList :: [[Char]]
nonterminalslList = (Nonterminal -> [Char]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Nonterminal -> [Char]
nonterminalValue ([Nonterminal] -> [[Char]]) -> [Nonterminal] -> [[Char]]
forall a b. (a -> b) -> a -> b
$ Set Nonterminal -> [Nonterminal]
forall a. Set a -> [a]
Set.toList Set Nonterminal
nonterminals
    symbolsInDone :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInDone = ([Char]
 -> ((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState)))
-> [[Char]]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a b. (a -> b) -> [a] -> [b]
map (\[Char]
t -> (([Char] -> DebuggingState
DState [Char]
done, [Char] -> DebuggingSymbol
DSymbol [Char]
t),(DebuggingMove
DebuggingTMTypes.R, [Char] -> DebuggingState
DState [Char]
done))) [[Char]]
nonterminalslList
    symbolsToAccepted :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToAccepted = [(([Char] -> DebuggingState
DState [Char]
done, [Char] -> DebuggingSymbol
DSymbol [Char]
Constants.plus),(DebuggingMove
DebuggingTMTypes.L, DebuggingState
finalDState))]
    symbols :: [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbols = [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsInDone [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
-> [((DebuggingState, DebuggingSymbol),
     (DebuggingMove, DebuggingState))]
forall a. [a] -> [a] -> [a]
++ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbolsToAccepted
    in Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
DQuadruples (Map
   (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
 -> DebuggingQuadruples)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> DebuggingQuadruples
forall a b. (a -> b) -> a -> b
$ [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
-> Map
     (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Ord k => [(k, a)] -> Map k a -> Map k a
Helpers.addCollectionToMap [((DebuggingState, DebuggingSymbol),
  (DebuggingMove, DebuggingState))]
symbols Map
  (DebuggingState, DebuggingSymbol) (DebuggingMove, DebuggingState)
forall k a. Map k a
Map.empty

generateFoldingForMidCongs :: Map.Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
        -> [([Char], [Char], [Char], [Char])]
        -> Map.Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
generateFoldingForMidCongs :: Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
-> [([Char], [Char], [Char], [Char])]
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
generateFoldingForMidCongs Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
quadruples [([Char], [Char], [Char], [Char])]
quads = let
    quadruplesList :: [Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)]
quadruplesList = (([Char], [Char], [Char], [Char])
 -> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState))
-> [([Char], [Char], [Char], [Char])]
-> [Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)]
forall a b. (a -> b) -> [a] -> [b]
map (\([Char]
k, [Char]
t, [Char]
j, [Char]
f) ->
        ((a, DebuggingState) -> (a, DebuggingState))
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map (\(a
move, DState [Char]
state) -> (a
move, [Char] -> DebuggingState
DState ([Char] -> DebuggingState) -> [Char] -> DebuggingState
forall a b. (a -> b) -> a -> b
$ [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f))
            (((DebuggingState, DebuggingSymbol)
 -> (DebuggingState, DebuggingSymbol))
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys (\(DState [Char]
state, DSymbol [Char]
symbol) ->
                let updatedState :: [Char]
updatedState = [Char]
state [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
k [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
t [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
j [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f in
                ([Char] -> DebuggingState
DState [Char]
updatedState, [Char] -> DebuggingSymbol
DSymbol [Char]
symbol)) Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
quadruples)) [([Char], [Char], [Char], [Char])]
quads
   in [Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)]
-> Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)
forall (f :: * -> *) k a.
(Foldable f, Ord k) =>
f (Map k a) -> Map k a
Map.unions [Map (DebuggingState, DebuggingSymbol) (a, DebuggingState)]
quadruplesList