symantic-parser 0.1.0.20210201 → 0.2.0.20210703
raw patch · 240 files changed
+21995/−6470 lines, 240 filesdep +attoparsecdep +criteriondep +megaparsecdep ~basedep ~bytestringdep ~containerssetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies added: attoparsec, criterion, megaparsec, pretty, random, symantic-base
Dependency ranges changed: base, bytestring, containers, hashable, text, transformers
API changes (from Hackage documentation)
- Symantic.Parser: runParser :: forall inp a. Ord (InputToken inp) => Show (InputToken inp) => Lift (InputToken inp) => Typeable (InputToken inp) => Input inp => Readable (InputToken inp) Gen => Parser inp a -> CodeQ (inp -> Either (ParsingError inp) a)
- Symantic.Parser.Grammar: class Letable letName repr
- Symantic.Parser.Grammar: def :: (Letable letName repr, Liftable1 repr) => Letable letName (Output repr) => letName -> repr a -> repr a
- Symantic.Parser.Grammar: grammar :: Grammar tok repr => ObserveSharing Name (OptimizeGrammar repr) a -> repr a
- Symantic.Parser.Grammar: ref :: (Letable letName repr, Liftable repr) => Letable letName (Output repr) => Bool -> letName -> repr a
- Symantic.Parser.Grammar: showGrammar :: ObserveSharing Name (OptimizeGrammar (ViewGrammar showName)) a -> String
- Symantic.Parser.Grammar: type Grammar tok repr = (Applicable repr, Alternable repr, Satisfiable tok repr, Letable Name repr, Selectable repr, Matchable repr, Foldable repr, Lookable repr)
- Symantic.Parser.Grammar.Combinators: ($>) :: Applicable repr => repr a -> TermGrammar b -> repr b
- Symantic.Parser.Grammar.Combinators: (*>) :: Applicable repr => repr a -> repr b -> repr b
- Symantic.Parser.Grammar.Combinators: (<$) :: Applicable repr => TermGrammar a -> repr b -> repr a
- Symantic.Parser.Grammar.Combinators: (<$>) :: Applicable repr => TermGrammar (a -> b) -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: (<&>) :: Applicable repr => repr a -> TermGrammar (a -> b) -> repr b
- Symantic.Parser.Grammar.Combinators: (<*) :: Applicable repr => repr a -> repr b -> repr a
- Symantic.Parser.Grammar.Combinators: (<**>) :: Applicable repr => repr a -> repr (a -> b) -> repr b
- Symantic.Parser.Grammar.Combinators: (<*>) :: (Applicable repr, Liftable2 repr) => Applicable (Output repr) => repr (a -> b) -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: (<+>) :: (Alternable repr, Applicable repr) => Alternable repr => repr a -> repr b -> repr (Either a b)
- Symantic.Parser.Grammar.Combinators: (<:>) :: Applicable repr => repr a -> repr [a] -> repr [a]
- Symantic.Parser.Grammar.Combinators: (<|>) :: (Alternable repr, Liftable2 repr) => Alternable (Output repr) => repr a -> repr a -> repr a
- Symantic.Parser.Grammar.Combinators: ErrorItemEnd :: ErrorItem tok
- Symantic.Parser.Grammar.Combinators: ErrorItemHorizon :: Int -> ErrorItem tok
- Symantic.Parser.Grammar.Combinators: ErrorItemLabel :: String -> ErrorItem tok
- Symantic.Parser.Grammar.Combinators: ErrorItemToken :: tok -> ErrorItem tok
- Symantic.Parser.Grammar.Combinators: anyChar :: Satisfiable Char repr => repr Char
- Symantic.Parser.Grammar.Combinators: between :: Applicable repr => repr o -> repr c -> repr a -> repr a
- Symantic.Parser.Grammar.Combinators: branch :: (Selectable repr, Liftable3 repr) => Selectable (Output repr) => repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c
- Symantic.Parser.Grammar.Combinators: chainPost :: (Foldable repr, Applicable repr) => Alternable repr => repr a -> repr (a -> a) -> repr a
- Symantic.Parser.Grammar.Combinators: chainPre :: (Foldable repr, Applicable repr) => Alternable repr => repr (a -> a) -> repr a -> repr a
- Symantic.Parser.Grammar.Combinators: chainl :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr (a -> a -> a) -> TermGrammar a -> repr a
- Symantic.Parser.Grammar.Combinators: chainl1 :: Applicable repr => Foldable repr => repr a -> repr (a -> a -> a) -> repr a
- Symantic.Parser.Grammar.Combinators: chainl1' :: Applicable repr => Foldable repr => TermGrammar (a -> b) -> repr a -> repr (b -> a -> b) -> repr b
- Symantic.Parser.Grammar.Combinators: char :: Applicable repr => Satisfiable Char repr => Char -> repr Char
- Symantic.Parser.Grammar.Combinators: choice :: Alternable repr => [repr a] -> repr a
- Symantic.Parser.Grammar.Combinators: class Alternable repr
- Symantic.Parser.Grammar.Combinators: class Applicable repr
- Symantic.Parser.Grammar.Combinators: class Foldable repr
- Symantic.Parser.Grammar.Combinators: class Lookable repr
- Symantic.Parser.Grammar.Combinators: class Matchable repr
- Symantic.Parser.Grammar.Combinators: class Satisfiable tok repr
- Symantic.Parser.Grammar.Combinators: class Selectable repr
- Symantic.Parser.Grammar.Combinators: conditional :: (Matchable repr, Unliftable repr) => Liftable1 repr => Matchable (Output repr) => Eq a => repr a -> [TermGrammar (a -> Bool)] -> [repr b] -> repr b -> repr b
- Symantic.Parser.Grammar.Combinators: data ErrorItem tok
- Symantic.Parser.Grammar.Combinators: empty :: (Alternable repr, Liftable repr) => Alternable (Output repr) => repr a
- Symantic.Parser.Grammar.Combinators: endBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: endBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: eof :: (Lookable repr, Liftable repr) => Lookable (Output repr) => repr ()
- Symantic.Parser.Grammar.Combinators: infixl 3 <|>
- Symantic.Parser.Grammar.Combinators: infixl 4 <:>
- Symantic.Parser.Grammar.Combinators: instance GHC.Classes.Eq tok => GHC.Classes.Eq (Symantic.Parser.Grammar.Combinators.ErrorItem tok)
- Symantic.Parser.Grammar.Combinators: instance GHC.Classes.Ord tok => GHC.Classes.Ord (Symantic.Parser.Grammar.Combinators.ErrorItem tok)
- Symantic.Parser.Grammar.Combinators: instance GHC.Show.Show tok => GHC.Show.Show (Symantic.Parser.Grammar.Combinators.ErrorItem tok)
- Symantic.Parser.Grammar.Combinators: instance Language.Haskell.TH.Syntax.Lift tok => Language.Haskell.TH.Syntax.Lift (Symantic.Parser.Grammar.Combinators.ErrorItem tok)
- Symantic.Parser.Grammar.Combinators: item :: Satisfiable tok repr => repr tok
- Symantic.Parser.Grammar.Combinators: liftA2 :: Applicable repr => TermGrammar (a -> b -> c) -> repr a -> repr b -> repr c
- Symantic.Parser.Grammar.Combinators: look :: (Lookable repr, Liftable1 repr) => Lookable (Output repr) => repr a -> repr a
- Symantic.Parser.Grammar.Combinators: many :: Applicable repr => Foldable repr => repr a -> repr [a]
- Symantic.Parser.Grammar.Combinators: manyN :: Applicable repr => Foldable repr => Int -> repr a -> repr [a]
- Symantic.Parser.Grammar.Combinators: manyTill :: Applicable repr => Alternable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: match :: (Matchable repr, Eq a) => repr a -> [TermGrammar a] -> (TermGrammar a -> repr b) -> repr b -> repr b
- Symantic.Parser.Grammar.Combinators: maybeP :: Applicable repr => Alternable repr => repr a -> repr (Maybe a)
- Symantic.Parser.Grammar.Combinators: more :: Applicable repr => Satisfiable Char repr => Lookable repr => repr ()
- Symantic.Parser.Grammar.Combinators: negLook :: (Lookable repr, Liftable1 repr) => Lookable (Output repr) => repr a -> repr ()
- Symantic.Parser.Grammar.Combinators: noneOf :: Lift tok => Eq tok => Satisfiable tok repr => [tok] -> repr tok
- Symantic.Parser.Grammar.Combinators: ofChars :: Lift tok => Eq tok => [tok] -> CodeQ tok -> CodeQ Bool
- Symantic.Parser.Grammar.Combinators: oneOf :: Lift tok => Eq tok => Satisfiable tok repr => [tok] -> repr tok
- Symantic.Parser.Grammar.Combinators: option :: Applicable repr => Alternable repr => TermGrammar a -> repr a -> repr a
- Symantic.Parser.Grammar.Combinators: optional :: Applicable repr => Alternable repr => repr a -> repr ()
- Symantic.Parser.Grammar.Combinators: optionally :: Applicable repr => Alternable repr => repr a -> TermGrammar b -> repr b
- Symantic.Parser.Grammar.Combinators: pfoldl :: Applicable repr => Foldable repr => TermGrammar (b -> a -> b) -> TermGrammar b -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: pfoldl1 :: Applicable repr => Foldable repr => TermGrammar (b -> a -> b) -> TermGrammar b -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: pfoldr :: Applicable repr => Foldable repr => TermGrammar (a -> b -> b) -> TermGrammar b -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: pfoldr1 :: Applicable repr => Foldable repr => TermGrammar (a -> b -> b) -> TermGrammar b -> repr a -> repr b
- Symantic.Parser.Grammar.Combinators: pure :: (Applicable repr, Liftable repr) => Applicable (Output repr) => TermGrammar a -> repr a
- Symantic.Parser.Grammar.Combinators: repeat :: Applicable repr => Int -> repr a -> repr [a]
- Symantic.Parser.Grammar.Combinators: satisfy :: (Satisfiable tok repr, Liftable repr) => Satisfiable tok (Output repr) => [ErrorItem tok] -> TermGrammar (tok -> Bool) -> repr tok
- Symantic.Parser.Grammar.Combinators: sepBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: sepBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: sepEndBy :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: sepEndBy1 :: Applicable repr => Alternable repr => Foldable repr => repr a -> repr b -> repr [a]
- Symantic.Parser.Grammar.Combinators: sequence :: Applicable repr => [repr a] -> repr [a]
- Symantic.Parser.Grammar.Combinators: skipMany :: Applicable repr => Foldable repr => repr a -> repr ()
- Symantic.Parser.Grammar.Combinators: skipManyN :: Applicable repr => Foldable repr => Int -> repr a -> repr ()
- Symantic.Parser.Grammar.Combinators: skipSome :: Applicable repr => Foldable repr => repr a -> repr ()
- Symantic.Parser.Grammar.Combinators: some :: Applicable repr => Foldable repr => repr a -> repr [a]
- Symantic.Parser.Grammar.Combinators: string :: Applicable repr => Alternable repr => Satisfiable Char repr => [Char] -> repr [Char]
- Symantic.Parser.Grammar.Combinators: token :: Lift tok => Show tok => Eq tok => Applicable repr => Satisfiable tok repr => tok -> repr tok
- Symantic.Parser.Grammar.Combinators: tokens :: Lift tok => Eq tok => Show tok => Applicable repr => Alternable repr => Satisfiable tok repr => [tok] -> repr [tok]
- Symantic.Parser.Grammar.Combinators: traverse :: Applicable repr => (a -> repr b) -> [a] -> repr [b]
- Symantic.Parser.Grammar.Combinators: try :: (Alternable repr, Liftable1 repr) => Alternable (Output repr) => repr a -> repr a
- Symantic.Parser.Grammar.Combinators: type TermGrammar = Term ValueCode
- Symantic.Parser.Grammar.Combinators: unit :: Applicable repr => repr ()
- Symantic.Parser.Grammar.Combinators: void :: Applicable repr => repr a -> repr ()
- Symantic.Parser.Grammar.Fixity: AssocB :: Side -> Associativity
- Symantic.Parser.Grammar.Fixity: AssocL :: Associativity
- Symantic.Parser.Grammar.Fixity: AssocR :: Associativity
- Symantic.Parser.Grammar.Fixity: Fixity1 :: Unifix -> Fixity
- Symantic.Parser.Grammar.Fixity: Fixity2 :: Infix -> Fixity
- Symantic.Parser.Grammar.Fixity: Infix :: Maybe Associativity -> Precedence -> Infix
- Symantic.Parser.Grammar.Fixity: Postfix :: Precedence -> Unifix
- Symantic.Parser.Grammar.Fixity: Prefix :: Precedence -> Unifix
- Symantic.Parser.Grammar.Fixity: SideL :: Side
- Symantic.Parser.Grammar.Fixity: SideR :: Side
- Symantic.Parser.Grammar.Fixity: [infix_associativity] :: Infix -> Maybe Associativity
- Symantic.Parser.Grammar.Fixity: [infix_precedence] :: Infix -> Precedence
- Symantic.Parser.Grammar.Fixity: [unifix_precedence] :: Unifix -> Precedence
- Symantic.Parser.Grammar.Fixity: class PrecedenceOf a
- Symantic.Parser.Grammar.Fixity: data Associativity
- Symantic.Parser.Grammar.Fixity: data Fixity
- Symantic.Parser.Grammar.Fixity: data Infix
- Symantic.Parser.Grammar.Fixity: data Side
- Symantic.Parser.Grammar.Fixity: data Unifix
- Symantic.Parser.Grammar.Fixity: infixB :: Side -> Precedence -> Infix
- Symantic.Parser.Grammar.Fixity: infixL :: Precedence -> Infix
- Symantic.Parser.Grammar.Fixity: infixN :: Precedence -> Infix
- Symantic.Parser.Grammar.Fixity: infixN0 :: Infix
- Symantic.Parser.Grammar.Fixity: infixN5 :: Infix
- Symantic.Parser.Grammar.Fixity: infixR :: Precedence -> Infix
- Symantic.Parser.Grammar.Fixity: instance GHC.Classes.Eq Symantic.Parser.Grammar.Fixity.Associativity
- Symantic.Parser.Grammar.Fixity: instance GHC.Classes.Eq Symantic.Parser.Grammar.Fixity.Fixity
- Symantic.Parser.Grammar.Fixity: instance GHC.Classes.Eq Symantic.Parser.Grammar.Fixity.Infix
- Symantic.Parser.Grammar.Fixity: instance GHC.Classes.Eq Symantic.Parser.Grammar.Fixity.Side
- Symantic.Parser.Grammar.Fixity: instance GHC.Classes.Eq Symantic.Parser.Grammar.Fixity.Unifix
- Symantic.Parser.Grammar.Fixity: instance GHC.Show.Show Symantic.Parser.Grammar.Fixity.Associativity
- Symantic.Parser.Grammar.Fixity: instance GHC.Show.Show Symantic.Parser.Grammar.Fixity.Fixity
- Symantic.Parser.Grammar.Fixity: instance GHC.Show.Show Symantic.Parser.Grammar.Fixity.Infix
- Symantic.Parser.Grammar.Fixity: instance GHC.Show.Show Symantic.Parser.Grammar.Fixity.Side
- Symantic.Parser.Grammar.Fixity: instance GHC.Show.Show Symantic.Parser.Grammar.Fixity.Unifix
- Symantic.Parser.Grammar.Fixity: instance Symantic.Parser.Grammar.Fixity.PrecedenceOf Symantic.Parser.Grammar.Fixity.Fixity
- Symantic.Parser.Grammar.Fixity: instance Symantic.Parser.Grammar.Fixity.PrecedenceOf Symantic.Parser.Grammar.Fixity.Infix
- Symantic.Parser.Grammar.Fixity: instance Symantic.Parser.Grammar.Fixity.PrecedenceOf Symantic.Parser.Grammar.Fixity.Unifix
- Symantic.Parser.Grammar.Fixity: isPairNeeded :: (Infix, Side) -> Infix -> Bool
- Symantic.Parser.Grammar.Fixity: pairAngle :: Pair
- Symantic.Parser.Grammar.Fixity: pairBrace :: Pair
- Symantic.Parser.Grammar.Fixity: pairBracket :: Pair
- Symantic.Parser.Grammar.Fixity: pairIfNeeded :: Semigroup s => IsString s => Pair -> (Infix, Side) -> Infix -> s -> s
- Symantic.Parser.Grammar.Fixity: pairParen :: Pair
- Symantic.Parser.Grammar.Fixity: precedence :: PrecedenceOf a => a -> Precedence
- Symantic.Parser.Grammar.Fixity: type Pair = (String, String)
- Symantic.Parser.Grammar.Fixity: type Precedence = Int
- Symantic.Parser.Grammar.ObserveSharing: CleanDefs :: (HashSet letName -> repr a) -> CleanDefs letName repr a
- Symantic.Parser.Grammar.ObserveSharing: ObserveSharing :: ReaderT (HashSet SharingName) (State (ObserveSharingState letName)) (CleanDefs letName repr a) -> ObserveSharing letName repr a
- Symantic.Parser.Grammar.ObserveSharing: ObserveSharingState :: HashMap SharingName (letName, Int) -> HashSet SharingName -> ObserveSharingState letName
- Symantic.Parser.Grammar.ObserveSharing: SharingName :: StableName a -> SharingName
- Symantic.Parser.Grammar.ObserveSharing: [oss_recs] :: ObserveSharingState letName -> HashSet SharingName
- Symantic.Parser.Grammar.ObserveSharing: [oss_refs] :: ObserveSharingState letName -> HashMap SharingName (letName, Int)
- Symantic.Parser.Grammar.ObserveSharing: [unCleanDefs] :: CleanDefs letName repr a -> HashSet letName -> repr a
- Symantic.Parser.Grammar.ObserveSharing: [unObserveSharing] :: ObserveSharing letName repr a -> ReaderT (HashSet SharingName) (State (ObserveSharingState letName)) (CleanDefs letName repr a)
- Symantic.Parser.Grammar.ObserveSharing: class Letable letName repr
- Symantic.Parser.Grammar.ObserveSharing: class MakeLetName letName
- Symantic.Parser.Grammar.ObserveSharing: class ShowLetName (showName :: Bool) letName
- Symantic.Parser.Grammar.ObserveSharing: data ObserveSharingState letName
- Symantic.Parser.Grammar.ObserveSharing: data SharingName
- Symantic.Parser.Grammar.ObserveSharing: def :: (Letable letName repr, Liftable1 repr) => Letable letName (Output repr) => letName -> repr a -> repr a
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Alternable repr) => Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Applicable repr) => Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Foldable repr, Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Alternable repr) => Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Lookable repr) => Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Matchable repr) => Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Satisfiable tok repr) => Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName, Symantic.Parser.Grammar.Combinators.Selectable repr) => Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Data.Hashable.Class.Hashable Language.Haskell.TH.Syntax.Name
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Alternable repr => Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Applicable repr => Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Foldable repr => Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Lookable repr => Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Matchable repr => Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Satisfiable tok repr => Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: instance Symantic.Parser.Grammar.Combinators.Selectable repr => Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Parser.Grammar.ObserveSharing: makeLetName :: MakeLetName letName => SharingName -> IO letName
- Symantic.Parser.Grammar.ObserveSharing: makeSharingName :: a -> SharingName
- Symantic.Parser.Grammar.ObserveSharing: newtype CleanDefs letName repr a
- Symantic.Parser.Grammar.ObserveSharing: newtype ObserveSharing letName repr a
- Symantic.Parser.Grammar.ObserveSharing: observeSharing :: ObserveSharing Name repr a -> repr a
- Symantic.Parser.Grammar.ObserveSharing: observeSharingNode :: Eq letName => Hashable letName => Letable letName repr => MakeLetName letName => ObserveSharing letName repr a -> ObserveSharing letName repr a
- Symantic.Parser.Grammar.ObserveSharing: ref :: (Letable letName repr, Liftable repr) => Letable letName (Output repr) => Bool -> letName -> repr a
- Symantic.Parser.Grammar.ObserveSharing: showLetName :: ShowLetName showName letName => letName -> String
- Symantic.Parser.Grammar.Optimize: SomeComb :: Comb comb repr a -> SomeComb repr a
- Symantic.Parser.Grammar.Optimize: data SomeComb repr a
- Symantic.Parser.Grammar.Optimize: data family Comb (comb :: ReprComb -> Constraint) (repr :: ReprComb) :: ReprComb
- Symantic.Parser.Grammar.Optimize: infixl 3 :<|>:
- Symantic.Parser.Grammar.Optimize: infixl 4 :<*>:
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Alternable repr, Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Lookable repr, Symantic.Parser.Grammar.Combinators.Matchable repr, Symantic.Parser.Grammar.Combinators.Selectable repr) => Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Alternable repr, Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Lookable repr, Symantic.Parser.Grammar.Combinators.Selectable repr, Symantic.Parser.Grammar.Combinators.Matchable repr) => Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Alternable repr, Symantic.Parser.Grammar.Combinators.Lookable repr, Symantic.Parser.Grammar.Combinators.Matchable repr, Symantic.Parser.Grammar.Combinators.Selectable repr) => Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Alternable repr, Symantic.Parser.Grammar.Combinators.Lookable repr, Symantic.Parser.Grammar.Combinators.Selectable repr, Symantic.Parser.Grammar.Combinators.Matchable repr) => Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Applicable repr, Symantic.Parser.Grammar.Combinators.Alternable repr, Symantic.Parser.Grammar.Combinators.Lookable repr, Symantic.Parser.Grammar.Combinators.Selectable repr, Symantic.Parser.Grammar.Combinators.Matchable repr) => Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Parser.Grammar.Combinators.Satisfiable tok repr, Data.Typeable.Internal.Typeable tok) => Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance (Symantic.Univariant.Letable.Letable letName repr, Data.Typeable.Internal.Typeable letName) => Symantic.Univariant.Letable.Letable letName (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Alternable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Alternable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Applicable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Applicable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Foldable repr => Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Parser.Grammar.Optimize.SomeComb repr)
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Foldable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Foldable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Lookable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Lookable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Matchable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Matchable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Satisfiable tok repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb (Symantic.Parser.Grammar.Combinators.Satisfiable tok) repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Parser.Grammar.Combinators.Selectable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb Symantic.Parser.Grammar.Combinators.Selectable repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Univariant.Letable.Letable letName repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.Comb (Symantic.Univariant.Letable.Letable letName) repr) repr
- Symantic.Parser.Grammar.Optimize: instance Symantic.Univariant.Letable.MakeLetName Language.Haskell.TH.Syntax.Name
- Symantic.Parser.Grammar.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Grammar.Optimize.SomeComb repr) repr
- Symantic.Parser.Grammar.Optimize: optimizeGrammar :: Trans (SomeComb repr) repr => SomeComb repr a -> repr a
- Symantic.Parser.Grammar.Optimize: pattern (:$>:) :: SomeComb repr a -> TermGrammar b -> Comb Applicable repr b
- Symantic.Parser.Grammar.Optimize: pattern Comb :: Typeable comb => Comb comb repr a -> SomeComb repr a
- Symantic.Parser.Grammar.Optimize: type OptimizeGrammar = SomeComb
- Symantic.Parser.Grammar.Optimize: type ReprComb = Type -> Type
- Symantic.Parser.Grammar.Optimize: unSomeComb :: forall comb repr a. Typeable comb => SomeComb repr a -> Maybe (Comb comb repr a)
- Symantic.Parser.Grammar.View: ViewGrammar :: Tree String -> ViewGrammar showName :: Bool a
- Symantic.Parser.Grammar.View: [unViewGrammar] :: ViewGrammar showName :: Bool a -> Tree String
- Symantic.Parser.Grammar.View: instance Data.String.IsString (Symantic.Parser.Grammar.View.ViewGrammar sN a)
- Symantic.Parser.Grammar.View: instance GHC.Show.Show (Symantic.Parser.Grammar.View.ViewGrammar sN a)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: instance Symantic.Univariant.Letable.ShowLetName sN letName => Symantic.Univariant.Letable.Letable letName (Symantic.Parser.Grammar.View.ViewGrammar sN)
- Symantic.Parser.Grammar.View: newtype ViewGrammar (showName :: Bool) a
- Symantic.Parser.Grammar.View: viewGrammar :: ViewGrammar sN a -> ViewGrammar sN a
- Symantic.Parser.Grammar.Write: WriteGrammar :: (WriteGrammarInh -> Maybe Builder) -> WriteGrammar showName :: Bool a
- Symantic.Parser.Grammar.Write: WriteGrammarInh :: Builder -> (Infix, Side) -> Pair -> WriteGrammarInh
- Symantic.Parser.Grammar.Write: [unWriteGrammar] :: WriteGrammar showName :: Bool a -> WriteGrammarInh -> Maybe Builder
- Symantic.Parser.Grammar.Write: [writeGrammarInh_indent] :: WriteGrammarInh -> Builder
- Symantic.Parser.Grammar.Write: [writeGrammarInh_op] :: WriteGrammarInh -> (Infix, Side)
- Symantic.Parser.Grammar.Write: [writeGrammarInh_pair] :: WriteGrammarInh -> Pair
- Symantic.Parser.Grammar.Write: data WriteGrammarInh
- Symantic.Parser.Grammar.Write: emptyWriteGrammarInh :: WriteGrammarInh
- Symantic.Parser.Grammar.Write: instance Data.String.IsString (Symantic.Parser.Grammar.Write.WriteGrammar sN a)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: instance Symantic.Univariant.Letable.ShowLetName sN letName => Symantic.Univariant.Letable.Letable letName (Symantic.Parser.Grammar.Write.WriteGrammar sN)
- Symantic.Parser.Grammar.Write: newtype WriteGrammar (showName :: Bool) a
- Symantic.Parser.Grammar.Write: pairWriteGrammarInh :: Semigroup s => IsString s => WriteGrammarInh -> Infix -> Maybe s -> Maybe s
- Symantic.Parser.Grammar.Write: writeGrammar :: WriteGrammar sN a -> Text
- Symantic.Parser.Haskell.Optimize: [:@] :: Term repr (a -> b) -> Term repr a -> Term repr b
- Symantic.Parser.Haskell.Optimize: [Char] :: (Lift tok, Show tok) => tok -> Term repr tok
- Symantic.Parser.Haskell.Optimize: [Cons] :: Term repr (a -> [a] -> [a])
- Symantic.Parser.Haskell.Optimize: [Eq] :: Eq a => Term repr (a -> a -> Bool)
- Symantic.Parser.Haskell.Optimize: [Lam1] :: (Term repr a -> Term repr b) -> Term repr (a -> b)
- Symantic.Parser.Haskell.Optimize: [Lam] :: (Term repr a -> Term repr b) -> Term repr (a -> b)
- Symantic.Parser.Haskell.Optimize: [Term] :: {unTerm :: repr a} -> Term repr a
- Symantic.Parser.Haskell.Optimize: [Var] :: String -> Term repr a
- Symantic.Parser.Haskell.Optimize: data Term repr a
- Symantic.Parser.Haskell.Optimize: infixl 9 :@
- Symantic.Parser.Haskell.Optimize: instance Symantic.Parser.Haskell.Term.Termable repr => Symantic.Parser.Haskell.Term.Termable (Symantic.Parser.Haskell.Optimize.Term repr)
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Haskell.Optimize.Term Data.Functor.Identity.Identity) Data.Functor.Identity.Identity
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Haskell.Optimize.Term Language.Haskell.TH.Lib.Internal.CodeQ) (Symantic.Parser.Haskell.Optimize.Term Symantic.Parser.Haskell.Term.ValueCode)
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Haskell.Optimize.Term Language.Haskell.TH.Lib.Internal.CodeQ) Language.Haskell.TH.Lib.Internal.CodeQ
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Haskell.Optimize.Term Symantic.Parser.Haskell.Term.ValueCode) (Symantic.Parser.Haskell.Optimize.Term Language.Haskell.TH.Lib.Internal.CodeQ)
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Haskell.Optimize.Term Symantic.Parser.Haskell.Term.ValueCode) Symantic.Parser.Haskell.Term.ValueCode
- Symantic.Parser.Haskell.Optimize: instance Symantic.Univariant.Trans.Trans repr (Symantic.Parser.Haskell.Optimize.Term repr)
- Symantic.Parser.Haskell.Optimize: optimizeTerm :: Term repr a -> Term repr a
- Symantic.Parser.Haskell.Term: ($) :: (Termable repr, Liftable repr) => Termable (Output repr) => repr ((a -> b) -> a -> b)
- Symantic.Parser.Haskell.Term: (.) :: (Termable repr, Liftable repr) => Termable (Output repr) => repr ((b -> c) -> (a -> b) -> a -> c)
- Symantic.Parser.Haskell.Term: (.@) :: (Termable repr, Liftable2 repr) => Termable (Output repr) => repr (a -> b) -> repr a -> repr b
- Symantic.Parser.Haskell.Term: ValueCode :: a -> CodeQ a -> ValueCode a
- Symantic.Parser.Haskell.Term: [code] :: ValueCode a -> CodeQ a
- Symantic.Parser.Haskell.Term: [value] :: ValueCode a -> a
- Symantic.Parser.Haskell.Term: bool :: (Termable repr, Liftable repr) => Termable (Output repr) => Bool -> repr Bool
- Symantic.Parser.Haskell.Term: char :: (Termable repr, Liftable repr) => Termable (Output repr) => Lift tok => Show tok => tok -> repr tok
- Symantic.Parser.Haskell.Term: class Termable repr
- Symantic.Parser.Haskell.Term: cons :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (a -> [a] -> [a])
- Symantic.Parser.Haskell.Term: const :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (a -> b -> a)
- Symantic.Parser.Haskell.Term: data ValueCode a
- Symantic.Parser.Haskell.Term: eq :: (Termable repr, Liftable repr) => Termable (Output repr) => Eq a => repr (a -> a -> Bool)
- Symantic.Parser.Haskell.Term: flip :: (Termable repr, Liftable repr) => Termable (Output repr) => repr ((a -> b -> c) -> b -> a -> c)
- Symantic.Parser.Haskell.Term: id :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (a -> a)
- Symantic.Parser.Haskell.Term: infixl 9 .@
- Symantic.Parser.Haskell.Term: infixr 0 $
- Symantic.Parser.Haskell.Term: infixr 9 .
- Symantic.Parser.Haskell.Term: instance Symantic.Parser.Haskell.Term.Termable Data.Functor.Identity.Identity
- Symantic.Parser.Haskell.Term: instance Symantic.Parser.Haskell.Term.Termable Language.Haskell.TH.Lib.Internal.CodeQ
- Symantic.Parser.Haskell.Term: instance Symantic.Parser.Haskell.Term.Termable Symantic.Parser.Haskell.Term.ValueCode
- Symantic.Parser.Haskell.Term: just :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (a -> Maybe a)
- Symantic.Parser.Haskell.Term: lam :: (Termable repr, Liftable repr) => Unliftable repr => Termable (Output repr) => (repr a -> repr b) -> repr (a -> b)
- Symantic.Parser.Haskell.Term: lam1 :: (Termable repr, Liftable repr) => Unliftable repr => Termable (Output repr) => (repr a -> repr b) -> repr (a -> b)
- Symantic.Parser.Haskell.Term: left :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (l -> Either l r)
- Symantic.Parser.Haskell.Term: nil :: (Termable repr, Liftable repr) => Termable (Output repr) => repr [a]
- Symantic.Parser.Haskell.Term: nothing :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (Maybe a)
- Symantic.Parser.Haskell.Term: right :: (Termable repr, Liftable repr) => Termable (Output repr) => repr (r -> Either l r)
- Symantic.Parser.Haskell.Term: unit :: (Termable repr, Liftable repr) => Termable (Output repr) => repr ()
- Symantic.Parser.Haskell.View: ViewTerm :: (ViewTermInh -> ShowS) -> ViewTerm a
- Symantic.Parser.Haskell.View: ViewTermInh :: (Infix, Side) -> Pair -> Int -> ViewTermInh
- Symantic.Parser.Haskell.View: [unViewTerm] :: ViewTerm a -> ViewTermInh -> ShowS
- Symantic.Parser.Haskell.View: [viewTermInh_lamDepth] :: ViewTermInh -> Int
- Symantic.Parser.Haskell.View: [viewTermInh_op] :: ViewTermInh -> (Infix, Side)
- Symantic.Parser.Haskell.View: [viewTermInh_pair] :: ViewTermInh -> Pair
- Symantic.Parser.Haskell.View: data ViewTermInh
- Symantic.Parser.Haskell.View: instance Data.String.IsString (Symantic.Parser.Haskell.View.ViewTerm a)
- Symantic.Parser.Haskell.View: instance GHC.Show.Show (Symantic.Parser.Haskell.Optimize.Term repr a)
- Symantic.Parser.Haskell.View: instance GHC.Show.Show (Symantic.Parser.Haskell.View.ViewTerm a)
- Symantic.Parser.Haskell.View: newtype ViewTerm a
- Symantic.Parser.Haskell.View: pairViewTerm :: ViewTermInh -> Infix -> ShowS -> ShowS
- Symantic.Parser.Machine: machine :: forall inp repr a. Ord (InputToken inp) => Show (InputToken inp) => Lift (InputToken inp) => Grammar (InputToken inp) (Program repr inp) => Machine (InputToken inp) repr => ParserRepr repr inp a -> repr inp '[] ('Succ 'Zero) a
- Symantic.Parser.Machine: type Parser inp = ParserRepr Gen inp
- Symantic.Parser.Machine: type ParserRepr repr inp = ObserveSharing Name (OptimizeGrammar (Program repr inp))
- Symantic.Parser.Machine.Generate: Gen :: (Map Name Horizon -> Horizon) -> (GenCtx inp vs es a -> CodeQ (Either (ParsingError inp) a)) -> Gen inp vs es a
- Symantic.Parser.Machine.Generate: GenCtx :: ValueStack vs -> FailStack inp a es -> CodeQ (Cont inp a a) -> CodeQ (Cursor inp) -> CodeQ (Cursor inp -> Bool) -> CodeQ (Cursor inp -> (# InputToken inp, Cursor inp #)) -> CodeQ (Cursor inp) -> CodeQ [ErrorItem (InputToken inp)] -> Offset -> Map Name Offset -> GenCtx inp vs es :: Peano a
- Symantic.Parser.Machine.Generate: ParsingErrorStandard :: Offset -> Maybe (InputToken inp) -> Set (ErrorItem (InputToken inp)) -> ParsingError inp
- Symantic.Parser.Machine.Generate: [FailStackCons] :: {failStackHead :: CodeQ (FailHandler inp a), failStackTail :: FailStack inp a es} -> FailStack inp a ('Succ es)
- Symantic.Parser.Machine.Generate: [FailStackEmpty] :: FailStack inp a 'Zero
- Symantic.Parser.Machine.Generate: [ValueStackCons] :: {valueStackHead :: TermInstr v, valueStackTail :: ValueStack vs} -> ValueStack (v : vs)
- Symantic.Parser.Machine.Generate: [ValueStackEmpty] :: ValueStack '[]
- Symantic.Parser.Machine.Generate: [checkedHorizon] :: GenCtx inp vs es :: Peano a -> Offset
- Symantic.Parser.Machine.Generate: [failStack] :: GenCtx inp vs es :: Peano a -> FailStack inp a es
- Symantic.Parser.Machine.Generate: [farthestExpecting] :: GenCtx inp vs es :: Peano a -> CodeQ [ErrorItem (InputToken inp)]
- Symantic.Parser.Machine.Generate: [farthestInput] :: GenCtx inp vs es :: Peano a -> CodeQ (Cursor inp)
- Symantic.Parser.Machine.Generate: [input] :: GenCtx inp vs es :: Peano a -> CodeQ (Cursor inp)
- Symantic.Parser.Machine.Generate: [minHorizonByName] :: GenCtx inp vs es :: Peano a -> Map Name Offset
- Symantic.Parser.Machine.Generate: [minHorizon] :: Gen inp vs es a -> Map Name Horizon -> Horizon
- Symantic.Parser.Machine.Generate: [moreInput] :: GenCtx inp vs es :: Peano a -> CodeQ (Cursor inp -> Bool)
- Symantic.Parser.Machine.Generate: [nextInput] :: GenCtx inp vs es :: Peano a -> CodeQ (Cursor inp -> (# InputToken inp, Cursor inp #))
- Symantic.Parser.Machine.Generate: [parsingErrorExpecting] :: ParsingError inp -> Set (ErrorItem (InputToken inp))
- Symantic.Parser.Machine.Generate: [parsingErrorOffset] :: ParsingError inp -> Offset
- Symantic.Parser.Machine.Generate: [parsingErrorUnexpected] :: ParsingError inp -> Maybe (InputToken inp)
- Symantic.Parser.Machine.Generate: [retCode] :: GenCtx inp vs es :: Peano a -> CodeQ (Cont inp a a)
- Symantic.Parser.Machine.Generate: [unGen] :: Gen inp vs es a -> GenCtx inp vs es a -> CodeQ (Either (ParsingError inp) a)
- Symantic.Parser.Machine.Generate: [valueStack] :: GenCtx inp vs es :: Peano a -> ValueStack vs
- Symantic.Parser.Machine.Generate: checkHorizon :: Lift (InputToken inp) => Gen inp vs ('Succ es) a -> Gen inp vs ('Succ es) a
- Symantic.Parser.Machine.Generate: checkToken :: forall inp vs es a. Ord (InputToken inp) => Lift (InputToken inp) => [ErrorItem (InputToken inp)] -> TermInstr (InputToken inp -> Bool) -> Gen inp (InputToken inp : vs) ('Succ es) a -> Gen inp vs ('Succ es) a
- Symantic.Parser.Machine.Generate: data FailStack inp a es
- Symantic.Parser.Machine.Generate: data Gen inp vs es a
- Symantic.Parser.Machine.Generate: data GenCtx inp vs (es :: Peano) a
- Symantic.Parser.Machine.Generate: data ParsingError inp
- Symantic.Parser.Machine.Generate: data ValueStack vs
- Symantic.Parser.Machine.Generate: genCode :: TermInstr a -> CodeQ a
- Symantic.Parser.Machine.Generate: generateCode :: forall inp ret. Ord (InputToken inp) => Show (InputToken inp) => Lift (InputToken inp) => Input inp => CodeQ inp -> Show (Cursor inp) => Gen inp '[] ('Succ 'Zero) ret -> CodeQ (Either (ParsingError inp) ret)
- Symantic.Parser.Machine.Generate: generateResume :: CodeQ (Cont inp v a) -> Gen inp (v : vs) es a
- Symantic.Parser.Machine.Generate: generateSuspend :: Gen inp (v : vs) es a -> GenCtx inp vs es a -> CodeQ (Cont inp v a)
- Symantic.Parser.Machine.Generate: instance GHC.Show.Show (Symantic.Parser.Machine.Input.InputToken inp) => GHC.Show.Show (Symantic.Parser.Machine.Generate.ParsingError inp)
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Branchable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Failable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Inputable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Joinable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Readable GHC.Types.Char Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Routinable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: instance Symantic.Parser.Machine.Instructions.Stackable Symantic.Parser.Machine.Generate.Gen
- Symantic.Parser.Machine.Generate: type Cont inp v a = Cursor inp -> [ErrorItem (InputToken inp)] -> v -> Cursor inp -> Either (ParsingError inp) a
- Symantic.Parser.Machine.Generate: type FailHandler inp a = Cursor inp -> Cursor inp -> [ErrorItem (InputToken inp)] -> Either (ParsingError inp) a
- Symantic.Parser.Machine.Generate: type Horizon = Offset
- Symantic.Parser.Machine.Generate: type Offset = Int
- Symantic.Parser.Machine.Input: (:>) :: {-# UNPACK #-} !Char -> Stream -> Stream
- Symantic.Parser.Machine.Input: CharList :: String -> CharList
- Symantic.Parser.Machine.Input: OffWith :: {-# UNPACK #-} !Int -> ts -> OffWith ts
- Symantic.Parser.Machine.Input: OffWithStreamAnd :: {-# UNPACK #-} !Int -> !Stream -> ts -> OffWithStreamAnd ts
- Symantic.Parser.Machine.Input: Text16 :: Text -> Text16
- Symantic.Parser.Machine.Input: UnpackedLazyByteString :: {-# UNPACK #-} !Int -> !Addr# -> ForeignPtrContents -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> ByteString -> UnpackedLazyByteString
- Symantic.Parser.Machine.Input: class Show cur => Cursorable cur
- Symantic.Parser.Machine.Input: class Cursorable (Cursor inp) => Input inp where {
- Symantic.Parser.Machine.Input: compareOffset :: Cursorable cur => CodeQ (cur -> cur -> Ordering)
- Symantic.Parser.Machine.Input: cursorOf :: Input inp => CodeQ inp -> CodeQ (# Cursor inp, Cursor inp -> Bool, Cursor inp -> (# InputToken inp, Cursor inp #) #)
- Symantic.Parser.Machine.Input: data OffWith ts
- Symantic.Parser.Machine.Input: data OffWithStreamAnd ts
- Symantic.Parser.Machine.Input: data Stream
- Symantic.Parser.Machine.Input: data UnpackedLazyByteString
- Symantic.Parser.Machine.Input: emptyUnpackedLazyByteString :: Int -> UnpackedLazyByteString
- Symantic.Parser.Machine.Input: instance GHC.Show.Show Symantic.Parser.Machine.Input.UnpackedLazyByteString
- Symantic.Parser.Machine.Input: instance GHC.Show.Show ts => GHC.Show.Show (Symantic.Parser.Machine.Input.OffWith ts)
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Cursorable (Symantic.Parser.Machine.Input.OffWith GHC.Base.String)
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Cursorable Data.Text.Internal.Text
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Cursorable GHC.Types.Int
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Cursorable Symantic.Parser.Machine.Input.UnpackedLazyByteString
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Input (Data.Array.Base.UArray GHC.Types.Int GHC.Types.Char)
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Input Data.ByteString.Internal.ByteString
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Input Data.ByteString.Lazy.Internal.ByteString
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Input Data.Text.Internal.Text
- Symantic.Parser.Machine.Input: instance Symantic.Parser.Machine.Input.Input GHC.Base.String
- Symantic.Parser.Machine.Input: lowerOffset :: Cursorable cur => CodeQ (cur -> cur -> Bool)
- Symantic.Parser.Machine.Input: newtype CharList
- Symantic.Parser.Machine.Input: newtype Text16
- Symantic.Parser.Machine.Input: nomore :: Stream
- Symantic.Parser.Machine.Input: offWith :: CodeQ (ts -> OffWith ts)
- Symantic.Parser.Machine.Input: offset :: Cursorable cur => cur -> Int
- Symantic.Parser.Machine.Input: sameOffset :: Cursorable cur => CodeQ (cur -> cur -> Bool)
- Symantic.Parser.Machine.Input: shiftLeftByteString :: Int -> UnpackedLazyByteString -> UnpackedLazyByteString
- Symantic.Parser.Machine.Input: shiftLeftText :: Int -> Text -> Text
- Symantic.Parser.Machine.Input: shiftRight :: Cursorable cur => CodeQ (Int -> cur -> cur)
- Symantic.Parser.Machine.Input: shiftRightByteString :: Int -> UnpackedLazyByteString -> UnpackedLazyByteString
- Symantic.Parser.Machine.Input: shiftRightText :: Int -> Text -> Text
- Symantic.Parser.Machine.Input: type family InputToken inp :: Type;
- Symantic.Parser.Machine.Input: }
- Symantic.Parser.Machine.Instructions: LetName :: Name -> LetName a
- Symantic.Parser.Machine.Instructions: Succ :: Peano -> Peano
- Symantic.Parser.Machine.Instructions: Zero :: Peano
- Symantic.Parser.Machine.Instructions: [unLetName] :: LetName a -> Name
- Symantic.Parser.Machine.Instructions: appI :: Stackable repr => repr inp (y : vs) es a -> repr inp (x : ((x -> y) : vs)) es a
- Symantic.Parser.Machine.Instructions: call :: Routinable repr => LetName v -> repr inp (v : vs) ('Succ es) a -> repr inp vs ('Succ es) a
- Symantic.Parser.Machine.Instructions: caseI :: Branchable repr => repr inp (x : vs) es r -> repr inp (y : vs) es r -> repr inp (Either x y : vs) es r
- Symantic.Parser.Machine.Instructions: catchFail :: Failable repr => repr inp vs ('Succ es) a -> repr inp (Cursor inp : vs) es a -> repr inp vs es a
- Symantic.Parser.Machine.Instructions: choices :: Branchable repr => [TermInstr (v -> Bool)] -> [repr inp vs es a] -> repr inp vs es a -> repr inp (v : vs) es a
- Symantic.Parser.Machine.Instructions: class Branchable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Failable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Inputable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Joinable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Readable (tok :: Type) (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Routinable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: class Stackable (repr :: ReprInstr)
- Symantic.Parser.Machine.Instructions: data Peano
- Symantic.Parser.Machine.Instructions: defJoin :: Joinable repr => LetName v -> repr inp (v : vs) es a -> repr inp vs es a -> repr inp vs es a
- Symantic.Parser.Machine.Instructions: fail :: Failable repr => [ErrorItem (InputToken inp)] -> repr inp vs ('Succ es) a
- Symantic.Parser.Machine.Instructions: ifI :: Branchable repr => repr inp vs es a -> repr inp vs es a -> repr inp (Bool : vs) es a
- Symantic.Parser.Machine.Instructions: instance GHC.Classes.Eq (Symantic.Parser.Machine.Instructions.LetName a)
- Symantic.Parser.Machine.Instructions: instance GHC.Show.Show (Symantic.Parser.Machine.Instructions.LetName a)
- Symantic.Parser.Machine.Instructions: jump :: Routinable repr => LetName a -> repr inp '[] ('Succ es) a
- Symantic.Parser.Machine.Instructions: liftI2 :: Stackable repr => TermInstr (x -> y -> z) -> repr inp (z : vs) es a -> repr inp (y : (x : vs)) es a
- Symantic.Parser.Machine.Instructions: loadInput :: Inputable repr => repr inp vs es a -> repr inp (Cursor inp : vs) es a
- Symantic.Parser.Machine.Instructions: mapI :: Stackable repr => TermInstr (x -> y) -> repr inp (y : vs) es a -> repr inp (x : vs) es a
- Symantic.Parser.Machine.Instructions: newtype LetName a
- Symantic.Parser.Machine.Instructions: pop :: Stackable repr => repr inp vs es a -> repr inp (v : vs) es a
- Symantic.Parser.Machine.Instructions: popFail :: Failable repr => repr inp vs es a -> repr inp vs ('Succ es) a
- Symantic.Parser.Machine.Instructions: push :: Stackable repr => TermInstr v -> repr inp (v : vs) es a -> repr inp vs es a
- Symantic.Parser.Machine.Instructions: pushInput :: Inputable repr => repr inp (Cursor inp : vs) es a -> repr inp vs es a
- Symantic.Parser.Machine.Instructions: read :: (Readable tok repr, tok ~ InputToken inp) => [ErrorItem tok] -> TermInstr (tok -> Bool) -> repr inp (tok : vs) ('Succ es) a -> repr inp vs ('Succ es) a
- Symantic.Parser.Machine.Instructions: refJoin :: Joinable repr => LetName v -> repr inp (v : vs) es a
- Symantic.Parser.Machine.Instructions: ret :: Routinable repr => repr inp '[a] es a
- Symantic.Parser.Machine.Instructions: subroutine :: Routinable repr => LetName v -> repr inp '[] ('Succ 'Zero) v -> repr inp vs ('Succ es) a -> repr inp vs ('Succ es) a
- Symantic.Parser.Machine.Instructions: swap :: Stackable repr => repr inp (x : (y : vs)) es a -> repr inp (y : (x : vs)) es a
- Symantic.Parser.Machine.Instructions: type Machine tok repr = (Branchable repr, Failable repr, Inputable repr, Joinable repr, Routinable repr, Stackable repr, Readable tok repr)
- Symantic.Parser.Machine.Instructions: type ReprInstr = Type -> [Type] -> Peano -> Type -> Type
- Symantic.Parser.Machine.Instructions: type TermInstr = Term CodeQ
- Symantic.Parser.Machine.Optimize: SomeInstr :: Instr instr repr inp vs es a -> SomeInstr repr inp vs es a
- Symantic.Parser.Machine.Optimize: data SomeInstr repr inp vs es a
- Symantic.Parser.Machine.Optimize: data family Instr (instr :: ReprInstr -> Constraint) (repr :: ReprInstr) :: ReprInstr
- Symantic.Parser.Machine.Optimize: instance (Symantic.Parser.Machine.Instructions.Readable tok repr, Data.Typeable.Internal.Typeable tok) => Symantic.Parser.Machine.Instructions.Readable tok (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance (Symantic.Parser.Machine.Instructions.Readable tok repr, tok GHC.Types.~ Symantic.Parser.Machine.Input.InputToken inp) => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr (Symantic.Parser.Machine.Instructions.Readable tok) repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Branchable repr => Symantic.Parser.Machine.Instructions.Branchable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Branchable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Branchable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Failable repr => Symantic.Parser.Machine.Instructions.Failable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Failable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Failable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Inputable repr => Symantic.Parser.Machine.Instructions.Inputable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Inputable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Inputable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Joinable repr => Symantic.Parser.Machine.Instructions.Joinable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Joinable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Joinable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Routinable repr => Symantic.Parser.Machine.Instructions.Routinable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Routinable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Routinable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Stackable repr => Symantic.Parser.Machine.Instructions.Stackable (Symantic.Parser.Machine.Optimize.SomeInstr repr)
- Symantic.Parser.Machine.Optimize: instance Symantic.Parser.Machine.Instructions.Stackable repr => Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.Instr Symantic.Parser.Machine.Instructions.Stackable repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: instance Symantic.Univariant.Trans.Trans (Symantic.Parser.Machine.Optimize.SomeInstr repr inp vs es) (repr inp vs es)
- Symantic.Parser.Machine.Optimize: pattern Instr :: Typeable comb => Instr comb repr inp vs es a -> SomeInstr repr inp vs es a
- Symantic.Parser.Machine.Optimize: unSomeInstr :: forall instr repr inp vs es a. Typeable instr => SomeInstr repr inp vs es a -> Maybe (Instr instr repr inp vs es a)
- Symantic.Parser.Machine.Program: Program :: (forall vs es ret. SomeInstr repr inp (a : vs) ('Succ es) ret -> SomeInstr repr inp vs ('Succ es) ret) -> Program repr inp a
- Symantic.Parser.Machine.Program: [unProgram] :: Program repr inp a -> forall vs es ret. SomeInstr repr inp (a : vs) ('Succ es) ret -> SomeInstr repr inp vs ('Succ es) ret
- Symantic.Parser.Machine.Program: data Program repr inp a
- Symantic.Parser.Machine.Program: failIfConsumed :: Cursorable (Cursor inp) => Branchable repr => Failable repr => Inputable repr => Stackable repr => SomeInstr repr inp vs ('Succ es) ret -> SomeInstr repr inp (Cursor inp : vs) ('Succ es) ret
- Symantic.Parser.Machine.Program: instance (GHC.Classes.Ord (Symantic.Parser.Machine.Input.InputToken inp), Symantic.Parser.Machine.Input.Cursorable (Symantic.Parser.Machine.Input.Cursor inp), Symantic.Parser.Machine.Instructions.Branchable repr, Symantic.Parser.Machine.Instructions.Failable repr, Symantic.Parser.Machine.Instructions.Inputable repr, Symantic.Parser.Machine.Instructions.Joinable repr, Symantic.Parser.Machine.Instructions.Readable (Symantic.Parser.Machine.Input.InputToken inp) repr, Data.Typeable.Internal.Typeable (Symantic.Parser.Machine.Input.InputToken inp), Symantic.Parser.Machine.Instructions.Stackable repr) => Symantic.Parser.Grammar.Combinators.Lookable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance (Symantic.Parser.Machine.Input.Cursorable (Symantic.Parser.Machine.Input.Cursor inp), Symantic.Parser.Machine.Instructions.Branchable repr, Symantic.Parser.Machine.Instructions.Failable repr, Symantic.Parser.Machine.Instructions.Inputable repr, Symantic.Parser.Machine.Instructions.Joinable repr, Symantic.Parser.Machine.Instructions.Stackable repr) => Symantic.Parser.Grammar.Combinators.Alternable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance (Symantic.Parser.Machine.Input.Cursorable (Symantic.Parser.Machine.Input.Cursor inp), Symantic.Parser.Machine.Instructions.Branchable repr, Symantic.Parser.Machine.Instructions.Failable repr, Symantic.Parser.Machine.Instructions.Inputable repr, Symantic.Parser.Machine.Instructions.Joinable repr, Symantic.Parser.Machine.Instructions.Stackable repr) => Symantic.Parser.Grammar.Combinators.Foldable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance (Symantic.Parser.Machine.Instructions.Branchable repr, Symantic.Parser.Machine.Instructions.Joinable repr) => Symantic.Parser.Grammar.Combinators.Matchable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance (Symantic.Parser.Machine.Instructions.Branchable repr, Symantic.Parser.Machine.Instructions.Joinable repr, Symantic.Parser.Machine.Instructions.Stackable repr) => Symantic.Parser.Grammar.Combinators.Selectable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance (tok GHC.Types.~ Symantic.Parser.Machine.Input.InputToken inp, Symantic.Parser.Machine.Instructions.Readable tok repr, Data.Typeable.Internal.Typeable tok) => Symantic.Parser.Grammar.Combinators.Satisfiable tok (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance Symantic.Parser.Machine.Instructions.Routinable repr => Symantic.Univariant.Letable.Letable Language.Haskell.TH.Syntax.Name (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: instance Symantic.Parser.Machine.Instructions.Stackable repr => Symantic.Parser.Grammar.Combinators.Applicable (Symantic.Parser.Machine.Program.Program repr inp)
- Symantic.Parser.Machine.Program: joinNext :: Joinable repr => Program repr inp v -> Program repr inp v
- Symantic.Parser.Machine.Program: optimizeMachine :: forall inp es repr a. Machine (InputToken inp) repr => Program repr inp a -> repr inp '[] ('Succ es) a
- Symantic.Parser.Machine.View: ViewMachine :: (Forest String -> Forest String) -> ViewMachine showName :: Bool inp vs :: [Type] es :: Peano a
- Symantic.Parser.Machine.View: [unViewMachine] :: ViewMachine showName :: Bool inp vs :: [Type] es :: Peano a -> Forest String -> Forest String
- Symantic.Parser.Machine.View: instance Data.String.IsString (Symantic.Parser.Machine.View.ViewMachine sN inp vs es a)
- Symantic.Parser.Machine.View: instance GHC.Show.Show (Symantic.Parser.Machine.View.ViewMachine sN inp vs es a)
- Symantic.Parser.Machine.View: instance Symantic.Parser.Machine.Instructions.Branchable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Parser.Machine.Instructions.Failable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Parser.Machine.Instructions.Inputable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Parser.Machine.Instructions.Readable tok (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Parser.Machine.Instructions.Stackable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Univariant.Letable.ShowLetName sN Language.Haskell.TH.Syntax.Name => Symantic.Parser.Machine.Instructions.Joinable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: instance Symantic.Univariant.Letable.ShowLetName sN Language.Haskell.TH.Syntax.Name => Symantic.Parser.Machine.Instructions.Routinable (Symantic.Parser.Machine.View.ViewMachine sN)
- Symantic.Parser.Machine.View: newtype ViewMachine (showName :: Bool) inp (vs :: [Type]) (es :: Peano) a
- Symantic.Parser.Machine.View: viewInstrArg :: String -> Forest String -> Tree String
- Symantic.Parser.Machine.View: viewInstrCmd :: String -> Forest String -> Tree String
- Symantic.Parser.Machine.View: viewMachine :: ViewMachine sN inp vs es a -> ViewMachine sN inp vs es a
- Symantic.Univariant.Letable: CleanDefs :: (HashSet letName -> repr a) -> CleanDefs letName repr a
- Symantic.Univariant.Letable: ObserveSharing :: ReaderT (HashSet SharingName) (State (ObserveSharingState letName)) (CleanDefs letName repr a) -> ObserveSharing letName repr a
- Symantic.Univariant.Letable: ObserveSharingState :: HashMap SharingName (letName, Int) -> HashSet SharingName -> ObserveSharingState letName
- Symantic.Univariant.Letable: SharingName :: StableName a -> SharingName
- Symantic.Univariant.Letable: [oss_recs] :: ObserveSharingState letName -> HashSet SharingName
- Symantic.Univariant.Letable: [oss_refs] :: ObserveSharingState letName -> HashMap SharingName (letName, Int)
- Symantic.Univariant.Letable: [unCleanDefs] :: CleanDefs letName repr a -> HashSet letName -> repr a
- Symantic.Univariant.Letable: [unObserveSharing] :: ObserveSharing letName repr a -> ReaderT (HashSet SharingName) (State (ObserveSharingState letName)) (CleanDefs letName repr a)
- Symantic.Univariant.Letable: class Letable letName repr
- Symantic.Univariant.Letable: class MakeLetName letName
- Symantic.Univariant.Letable: class ShowLetName (showName :: Bool) letName
- Symantic.Univariant.Letable: data ObserveSharingState letName
- Symantic.Univariant.Letable: data SharingName
- Symantic.Univariant.Letable: def :: (Letable letName repr, Liftable1 repr) => Letable letName (Output repr) => letName -> repr a -> repr a
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Letable.Letable letName (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Letable.Letable letName (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Trans.Trans (Symantic.Univariant.Letable.CleanDefs letName repr) (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Trans.Trans1 (Symantic.Univariant.Letable.CleanDefs letName repr) (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Trans.Trans2 (Symantic.Univariant.Letable.CleanDefs letName repr) (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Univariant.Letable: instance (Symantic.Univariant.Letable.Letable letName repr, Symantic.Univariant.Letable.MakeLetName letName, GHC.Classes.Eq letName, Data.Hashable.Class.Hashable letName) => Symantic.Univariant.Trans.Trans3 (Symantic.Univariant.Letable.CleanDefs letName repr) (Symantic.Univariant.Letable.ObserveSharing letName repr)
- Symantic.Univariant.Letable: instance Data.Hashable.Class.Hashable Symantic.Univariant.Letable.SharingName
- Symantic.Univariant.Letable: instance GHC.Classes.Eq Symantic.Univariant.Letable.SharingName
- Symantic.Univariant.Letable: instance GHC.Show.Show letName => Symantic.Univariant.Letable.ShowLetName 'GHC.Types.True letName
- Symantic.Univariant.Letable: instance Symantic.Univariant.Letable.ShowLetName 'GHC.Types.False letName
- Symantic.Univariant.Letable: instance Symantic.Univariant.Trans.Trans repr (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Univariant.Letable: instance Symantic.Univariant.Trans.Trans1 repr (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Univariant.Letable: instance Symantic.Univariant.Trans.Trans2 repr (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Univariant.Letable: instance Symantic.Univariant.Trans.Trans3 repr (Symantic.Univariant.Letable.CleanDefs letName repr)
- Symantic.Univariant.Letable: makeLetName :: MakeLetName letName => SharingName -> IO letName
- Symantic.Univariant.Letable: makeSharingName :: a -> SharingName
- Symantic.Univariant.Letable: newtype CleanDefs letName repr a
- Symantic.Univariant.Letable: newtype ObserveSharing letName repr a
- Symantic.Univariant.Letable: observeSharing :: Eq letName => Hashable letName => ObserveSharing letName repr a -> repr a
- Symantic.Univariant.Letable: observeSharingNode :: Eq letName => Hashable letName => Letable letName repr => MakeLetName letName => ObserveSharing letName repr a -> ObserveSharing letName repr a
- Symantic.Univariant.Letable: ref :: (Letable letName repr, Liftable repr) => Letable letName (Output repr) => Bool -> letName -> repr a
- Symantic.Univariant.Letable: showLetName :: ShowLetName showName letName => letName -> String
- Symantic.Univariant.Trans: Any :: repr a -> Any repr a
- Symantic.Univariant.Trans: [unAny] :: Any repr a -> repr a
- Symantic.Univariant.Trans: class Trans from to
- Symantic.Univariant.Trans: class Trans1 from to
- Symantic.Univariant.Trans: class Trans2 from to
- Symantic.Univariant.Trans: class Trans3 from to
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans (Symantic.Univariant.Trans.Any repr) repr
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans repr (Symantic.Univariant.Trans.Any repr)
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans1 (Symantic.Univariant.Trans.Any repr) repr
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans1 repr (Symantic.Univariant.Trans.Any repr)
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans2 (Symantic.Univariant.Trans.Any repr) repr
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans2 repr (Symantic.Univariant.Trans.Any repr)
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans3 (Symantic.Univariant.Trans.Any repr) repr
- Symantic.Univariant.Trans: instance Symantic.Univariant.Trans.Trans3 repr (Symantic.Univariant.Trans.Any repr)
- Symantic.Univariant.Trans: lift :: forall repr a. Liftable repr => Output repr a -> repr a
- Symantic.Univariant.Trans: lift1 :: forall repr a b. Liftable1 repr => (Output repr a -> Output repr b) -> repr a -> repr b
- Symantic.Univariant.Trans: lift2 :: forall repr a b c. Liftable2 repr => (Output repr a -> Output repr b -> Output repr c) -> repr a -> repr b -> repr c
- Symantic.Univariant.Trans: lift3 :: forall repr a b c d. Liftable3 repr => (Output repr a -> Output repr b -> Output repr c -> Output repr d) -> repr a -> repr b -> repr c -> repr d
- Symantic.Univariant.Trans: newtype Any repr a
- Symantic.Univariant.Trans: trans :: Trans from to => from a -> to a
- Symantic.Univariant.Trans: trans1 :: (Trans1 from to, BiTrans from to) => (from a -> from b) -> to a -> to b
- Symantic.Univariant.Trans: trans2 :: (Trans2 from to, BiTrans from to) => (from a -> from b -> from c) -> to a -> to b -> to c
- Symantic.Univariant.Trans: trans3 :: (Trans3 from to, BiTrans from to) => (from a -> from b -> from c -> from d) -> to a -> to b -> to c -> to d
- Symantic.Univariant.Trans: type BiTrans from to = (Trans from to, Trans to from)
- Symantic.Univariant.Trans: type Liftable repr = Trans (Output repr) repr
- Symantic.Univariant.Trans: type Liftable1 repr = Trans1 (Output repr) repr
- Symantic.Univariant.Trans: type Liftable2 repr = Trans2 (Output repr) repr
- Symantic.Univariant.Trans: type Liftable3 repr = Trans3 (Output repr) repr
- Symantic.Univariant.Trans: type Unliftable repr = Trans repr (Output repr)
- Symantic.Univariant.Trans: type family Output (repr :: Type -> Type) :: Type -> Type
- Symantic.Univariant.Trans: unlift :: forall repr a. Trans repr (Output repr) => repr a -> Output repr a
+ Parsers.Brainfuck.Attoparsec: parser :: forall inp. Inputable inp => Parser inp [Instruction]
+ Parsers.Brainfuck.Handrolled: parser :: forall inp. CoerceEnum (Token inp) Char => Inputable inp => inp -> Maybe [Instruction]
+ Parsers.Brainfuck.SymanticParser: grammar :: forall tok repr. CoerceEnum Char tok => CoerceEnum tok Char => Grammarable tok repr => repr [Instruction]
+ Parsers.Brainfuck.SymanticParser: parserByteString :: ByteString -> Either (ParsingError ByteString) [Instruction]
+ Parsers.Brainfuck.SymanticParser: parserByteStringLazy :: ByteString -> Either (ParsingError ByteString) [Instruction]
+ Parsers.Brainfuck.SymanticParser: parserString :: String -> Either (ParsingError String) [Instruction]
+ Parsers.Brainfuck.SymanticParser: parserText :: Text -> Either (ParsingError Text) [Instruction]
+ Parsers.Brainfuck.SymanticParser.Grammar: grammar :: forall tok repr. CoerceEnum Char tok => CoerceEnum tok Char => Grammarable tok repr => repr [Instruction]
+ Parsers.Brainfuck.Types: Backward :: Instruction
+ Parsers.Brainfuck.Types: Decrement :: Instruction
+ Parsers.Brainfuck.Types: Forward :: Instruction
+ Parsers.Brainfuck.Types: Increment :: Instruction
+ Parsers.Brainfuck.Types: Input :: Instruction
+ Parsers.Brainfuck.Types: Loop :: [Instruction] -> Instruction
+ Parsers.Brainfuck.Types: Output :: Instruction
+ Parsers.Brainfuck.Types: data Instruction
+ Parsers.Brainfuck.Types: instance Control.DeepSeq.NFData Parsers.Brainfuck.Types.Instruction
+ Parsers.Brainfuck.Types: instance GHC.Classes.Eq Parsers.Brainfuck.Types.Instruction
+ Parsers.Brainfuck.Types: instance GHC.Classes.Ord Parsers.Brainfuck.Types.Instruction
+ Parsers.Brainfuck.Types: instance GHC.Generics.Generic Parsers.Brainfuck.Types.Instruction
+ Parsers.Brainfuck.Types: instance GHC.Show.Show Parsers.Brainfuck.Types.Instruction
+ Parsers.Brainfuck.Types: instance Language.Haskell.TH.Syntax.Lift Parsers.Brainfuck.Types.Instruction
+ Parsers.Nandlang: grammar :: forall repr. Grammarable Char repr => repr ()
+ Parsers.Nandlang: nandIdentLetter :: Char -> Bool
+ Parsers.Nandlang: nandIdentStart :: Char -> Bool
+ Parsers.Nandlang: nandStringLetter :: Char -> Bool
+ Parsers.Nandlang: nandUnreservedName :: String -> Bool
+ Parsers.Nandlang: type Parser a = Parser Text a
+ Parsers.Playground: boom :: CombApplicable repr => repr ()
+ Parsers.Utils: class CoerceEnum a b
+ Parsers.Utils: coerceEnum :: (CoerceEnum a b, Enum a) => Enum b => a -> b
+ Parsers.Utils: instance Parsers.Utils.CoerceEnum GHC.Types.Char GHC.Types.Char
+ Parsers.Utils: instance Parsers.Utils.CoerceEnum GHC.Types.Char GHC.Word.Word8
+ Parsers.Utils: instance Parsers.Utils.CoerceEnum GHC.Word.Word8 GHC.Types.Char
+ Parsers.Utils: w2c :: Word8 -> Char
+ Parsers.Utils.Attoparsec: (<+>) :: Alternative p => p a -> p b -> p (Either a b)
+ Parsers.Utils.Attoparsec: (<:>) :: Applicative p => p a -> p [a] -> p [a]
+ Parsers.Utils.Attoparsec: (<~>) :: Applicative p => p a -> p b -> p (a, b)
+ Parsers.Utils.Attoparsec: (>?>) :: MonadPlus m => m a -> (a -> Bool) -> m a
+ Parsers.Utils.Attoparsec: InfixL :: [p (a -> a -> a)] -> Level p s a
+ Parsers.Utils.Attoparsec: InfixR :: [p (a -> a -> a)] -> Level p s a
+ Parsers.Utils.Attoparsec: Postfix :: [p (a -> a)] -> Level p s a
+ Parsers.Utils.Attoparsec: Prefix :: [p (a -> a)] -> Level p s a
+ Parsers.Utils.Attoparsec: between :: Applicative f => f a -> f b -> f c -> f c
+ Parsers.Utils.Attoparsec: chainPost :: Alternative p => p a -> p (a -> a) -> p a
+ Parsers.Utils.Attoparsec: chainPre :: Alternative p => p (a -> a) -> p a -> p a
+ Parsers.Utils.Attoparsec: chainl1 :: Alternative p => p a -> p (a -> a -> a) -> p a
+ Parsers.Utils.Attoparsec: chainr1 :: Alternative p => p a -> p (a -> a -> a) -> p a
+ Parsers.Utils.Attoparsec: char :: Inputable inp => Char -> Parser inp Char
+ Parsers.Utils.Attoparsec: class Chunk inp => Inputable inp where {
+ Parsers.Utils.Attoparsec: data Level p s a
+ Parsers.Utils.Attoparsec: empty :: Inputable inp => inp
+ Parsers.Utils.Attoparsec: fromMaybeP :: Monad m => m (Maybe a) -> m a -> m a
+ Parsers.Utils.Attoparsec: instance Parsers.Utils.Attoparsec.Inputable Data.ByteString.Internal.ByteString
+ Parsers.Utils.Attoparsec: instance Parsers.Utils.Attoparsec.Inputable Data.Text.Internal.Text
+ Parsers.Utils.Attoparsec: match :: (Monad m, Eq a) => [a] -> m a -> (a -> m b) -> m b -> m b
+ Parsers.Utils.Attoparsec: maybeP :: Alternative p => p a -> p (Maybe a)
+ Parsers.Utils.Attoparsec: notInClass :: Inputable inp => String -> Token inp -> Bool
+ Parsers.Utils.Attoparsec: null :: Inputable inp => inp -> Bool
+ Parsers.Utils.Attoparsec: pfoldl1 :: Alternative p => (b -> a -> b) -> b -> p a -> p b
+ Parsers.Utils.Attoparsec: precedence :: Alternative p => [Level p s a] -> p a -> p a
+ Parsers.Utils.Attoparsec: satisfy :: Inputable inp => (Token inp -> Bool) -> Parser inp (Token inp)
+ Parsers.Utils.Attoparsec: skipSome :: Alternative p => p a -> p ()
+ Parsers.Utils.Attoparsec: some :: Alternative p => p a -> p [a]
+ Parsers.Utils.Attoparsec: type family Token inp;
+ Parsers.Utils.Attoparsec: uncons :: Inputable inp => inp -> Maybe (Token inp, inp)
+ Parsers.Utils.Attoparsec: }
+ Parsers.Utils.Attoparsec.Text: noneOf :: [Char] -> Parser Char
+ Parsers.Utils.Attoparsec.Text: oneOf :: [Char] -> Parser Char
+ Parsers.Utils.Attoparsec.Text: token :: Text -> Parser Text
+ Parsers.Utils.Handrolled: class Inputable inp where {
+ Parsers.Utils.Handrolled: empty :: Inputable inp => inp
+ Parsers.Utils.Handrolled: instance Parsers.Utils.Handrolled.Inputable Data.ByteString.Internal.ByteString
+ Parsers.Utils.Handrolled: instance Parsers.Utils.Handrolled.Inputable Data.Text.Internal.Text
+ Parsers.Utils.Handrolled: null :: Inputable inp => inp -> Bool
+ Parsers.Utils.Handrolled: type family Token inp;
+ Parsers.Utils.Handrolled: uncons :: Inputable inp => inp -> Maybe (Token inp, inp)
+ Parsers.Utils.Handrolled: }
Files
- .envrc +0/−10
- ChangeLog.md +29/−0
- Hacking.md +36/−0
- Makefile +84/−16
- ReadMe.md +22/−8
- Setup.hs +0/−138
- ToDo.md +6/−16
- benchmarks/Brainfuck.hs +70/−0
- benchmarks/Main.hs +10/−0
- default.nix +33/−16
- flake.lock +75/−0
- flake.nix +5/−2
- parsers/Parsers/Brainfuck/Attoparsec.hs +29/−0
- parsers/Parsers/Brainfuck/Handrolled.hs +49/−0
- parsers/Parsers/Brainfuck/SymanticParser.hs +43/−0
- parsers/Parsers/Brainfuck/SymanticParser/Grammar.hs +45/−0
- parsers/Parsers/Brainfuck/Types.hs +21/−0
- parsers/Parsers/Brainfuck/inputs/compiler.bf +749/−0
- parsers/Parsers/Brainfuck/inputs/hanoi.bf +713/−0
- parsers/Parsers/Brainfuck/inputs/helloworld.bf +22/−0
- parsers/Parsers/Brainfuck/inputs/helloworld_golfed.bf +1/−0
- parsers/Parsers/Nandlang.hs +130/−0
- parsers/Parsers/Playground.hs +15/−0
- parsers/Parsers/Utils.hs +25/−0
- parsers/Parsers/Utils/Attoparsec.hs +107/−0
- parsers/Parsers/Utils/Attoparsec/Text.hs +20/−0
- parsers/Parsers/Utils/Handrolled.hs +26/−0
- src/Language/Haskell/TH/HideName.hs +135/−0
- src/Language/Haskell/TH/Show.hs +42/−0
- src/Symantic/Parser.hs +10/−13
- src/Symantic/Parser/Grammar.hs +32/−19
- src/Symantic/Parser/Grammar/Combinators.hs +485/−321
- src/Symantic/Parser/Grammar/Fixity.hs +0/−115
- src/Symantic/Parser/Grammar/ObserveSharing.hs +44/−75
- src/Symantic/Parser/Grammar/Optimize.hs +279/−239
- src/Symantic/Parser/Grammar/Production.hs +189/−0
- src/Symantic/Parser/Grammar/View.hs +66/−48
- src/Symantic/Parser/Grammar/Write.hs +87/−62
- src/Symantic/Parser/Haskell.hs +0/−8
- src/Symantic/Parser/Haskell/Optimize.hs +0/−194
- src/Symantic/Parser/Haskell/Term.hs +0/−194
- src/Symantic/Parser/Haskell/View.hs +0/−114
- src/Symantic/Parser/Machine.hs +7/−14
- src/Symantic/Parser/Machine/Generate.hs +620/−287
- src/Symantic/Parser/Machine/Input.hs +21/−16
- src/Symantic/Parser/Machine/Instructions.hs +136/−113
- src/Symantic/Parser/Machine/Optimize.hs +158/−178
- src/Symantic/Parser/Machine/Program.hs +185/−110
- src/Symantic/Parser/Machine/View.hs +182/−64
- src/Symantic/Univariant/Letable.hs +0/−242
- src/Symantic/Univariant/Trans.hs +0/−122
- symantic-parser.cabal +140/−68
- test/Golden.hs +10/−146
- test/Golden/Grammar.hs +38/−0
- test/Golden/Grammar/OptimizeGrammar/G1.expected.txt +4/−0
- test/Golden/Grammar/OptimizeGrammar/G10.expected.txt +10/−0
- test/Golden/Grammar/OptimizeGrammar/G11.expected.txt +14/−0
- test/Golden/Grammar/OptimizeGrammar/G12.expected.txt +14/−0
- test/Golden/Grammar/OptimizeGrammar/G13.expected.txt +63/−0
- test/Golden/Grammar/OptimizeGrammar/G14.expected.txt +410/−0
- test/Golden/Grammar/OptimizeGrammar/G15.expected.txt +12/−0
- test/Golden/Grammar/OptimizeGrammar/G16.expected.txt +16/−0
- test/Golden/Grammar/OptimizeGrammar/G2.expected.txt +11/−0
- test/Golden/Grammar/OptimizeGrammar/G3.expected.txt +12/−0
- test/Golden/Grammar/OptimizeGrammar/G4.expected.txt +25/−0
- test/Golden/Grammar/OptimizeGrammar/G5.expected.txt +27/−0
- test/Golden/Grammar/OptimizeGrammar/G6.expected.txt +14/−0
- test/Golden/Grammar/OptimizeGrammar/G7.expected.txt +16/−0
- test/Golden/Grammar/OptimizeGrammar/G8.expected.txt +14/−0
- test/Golden/Grammar/OptimizeGrammar/G9.expected.txt +4/−0
- test/Golden/Grammar/ViewGrammar/G1.expected.txt +8/−0
- test/Golden/Grammar/ViewGrammar/G10.expected.txt +14/−0
- test/Golden/Grammar/ViewGrammar/G11.expected.txt +28/−0
- test/Golden/Grammar/ViewGrammar/G12.expected.txt +20/−0
- test/Golden/Grammar/ViewGrammar/G13.expected.txt +107/−0
- test/Golden/Grammar/ViewGrammar/G14.expected.txt +844/−0
- test/Golden/Grammar/ViewGrammar/G15.expected.txt +22/−0
- test/Golden/Grammar/ViewGrammar/G16.expected.txt +28/−0
- test/Golden/Grammar/ViewGrammar/G2.expected.txt +29/−0
- test/Golden/Grammar/ViewGrammar/G3.expected.txt +20/−0
- test/Golden/Grammar/ViewGrammar/G4.expected.txt +55/−0
- test/Golden/Grammar/ViewGrammar/G5.expected.txt +59/−0
- test/Golden/Grammar/ViewGrammar/G6.expected.txt +38/−0
- test/Golden/Grammar/ViewGrammar/G7.expected.txt +40/−0
- test/Golden/Grammar/ViewGrammar/G8.expected.txt +24/−0
- test/Golden/Grammar/ViewGrammar/G9.expected.txt +4/−0
- test/Golden/Grammar/app.dump +0/−3
- test/Golden/Grammar/app.opt.dump +0/−1
- test/Golden/Grammar/boom.dump +0/−46
- test/Golden/Grammar/boom.opt.dump +0/−36
- test/Golden/Grammar/brainfuck.dump +0/−101
- test/Golden/Grammar/brainfuck.opt.dump +0/−58
- test/Golden/Grammar/eof.dump +0/−1
- test/Golden/Grammar/eof.opt.dump +0/−1
- test/Golden/Grammar/many-a.dump +0/−16
- test/Golden/Grammar/many-a.opt.dump +0/−10
- test/Golden/Grammar/many-char-eof.dump +0/−20
- test/Golden/Grammar/many-char-eof.opt.dump +0/−12
- test/Golden/Grammar/nandlang.dump +0/−993
- test/Golden/Grammar/nandlang.opt.dump +0/−479
- test/Golden/Grammar/string.dump +0/−35
- test/Golden/Grammar/string.opt.dump +0/−10
- test/Golden/Grammar/tokens.dump +0/−35
- test/Golden/Grammar/tokens.opt.dump +0/−10
- test/Golden/Grammar/unit-unit.dump +0/−8
- test/Golden/Grammar/unit-unit.opt.dump +0/−6
- test/Golden/Grammar/unit.dump +0/−1
- test/Golden/Grammar/unit.opt.dump +0/−1
- test/Golden/Machine.hs +41/−0
- test/Golden/Machine/G1.expected.txt +24/−0
- test/Golden/Machine/G10.expected.txt +72/−0
- test/Golden/Machine/G11.expected.txt +111/−0
- test/Golden/Machine/G12.expected.txt +146/−0
- test/Golden/Machine/G13.expected.txt +416/−0
- test/Golden/Machine/G14.expected.txt +3383/−0
- test/Golden/Machine/G15.expected.txt +96/−0
- test/Golden/Machine/G16.expected.txt +144/−0
- test/Golden/Machine/G2.expected.txt +98/−0
- test/Golden/Machine/G3.expected.txt +87/−0
- test/Golden/Machine/G4.expected.txt +206/−0
- test/Golden/Machine/G5.expected.txt +277/−0
- test/Golden/Machine/G6.expected.txt +144/−0
- test/Golden/Machine/G7.expected.txt +172/−0
- test/Golden/Machine/G8.expected.txt +158/−0
- test/Golden/Machine/G9.expected.txt +71/−0
- test/Golden/Machine/a-or-b.dump +0/−18
- test/Golden/Machine/app.dump +0/−2
- test/Golden/Machine/boom.dump +0/−51
- test/Golden/Machine/brainfuck.dump +0/−104
- test/Golden/Machine/eof.dump +0/−23
- test/Golden/Machine/many-a.dump +0/−23
- test/Golden/Machine/many-char-eof.dump +0/−48
- test/Golden/Machine/many-char-fail.dump +0/−25
- test/Golden/Machine/nandlang.dump +0/−938
- test/Golden/Machine/some-string.dump +0/−42
- test/Golden/Machine/string.dump +0/−16
- test/Golden/Machine/string.txt +0/−1
- test/Golden/Machine/unit-unit.dump +0/−9
- test/Golden/Machine/unit.dump +0/−2
- test/Golden/Parser.hs +86/−0
- test/Golden/Parser/G1/P1.expected.txt +1/−0
- test/Golden/Parser/G1/P1.input.txt +1/−0
- test/Golden/Parser/G10/P1.expected.txt +1/−0
- test/Golden/Parser/G10/P1.input.txt +1/−0
- test/Golden/Parser/G11/P1.expected.txt +1/−0
- test/Golden/Parser/G11/P1.input.txt +1/−0
- test/Golden/Parser/G12/P1.expected.txt +1/−0
- test/Golden/Parser/G12/P1.input.txt +1/−0
- test/Golden/Parser/G13/P1.expected.txt +1/−0
- test/Golden/Parser/G13/P1.input.txt +1/−0
- test/Golden/Parser/G13/P2.expected.txt +1/−0
- test/Golden/Parser/G13/P2.input.txt +3/−0
- test/Golden/Parser/G2/P1.expected.txt +1/−0
- test/Golden/Parser/G2/P1.input.txt +1/−0
- test/Golden/Parser/G2/P2.expected.txt +1/−0
- test/Golden/Parser/G2/P2.input.txt +1/−0
- test/Golden/Parser/G3/P1.expected.txt +1/−0
- test/Golden/Parser/G3/P1.input.txt +1/−0
- test/Golden/Parser/G4/P1.expected.txt +1/−0
- test/Golden/Parser/G4/P1.input.txt +1/−0
- test/Golden/Parser/G4/P2.expected.txt +1/−0
- test/Golden/Parser/G4/P2.input.txt +1/−0
- test/Golden/Parser/G4/P3.expected.txt +1/−0
- test/Golden/Parser/G4/P3.input.txt +1/−0
- test/Golden/Parser/G5/P1.expected.txt +1/−0
- test/Golden/Parser/G5/P1.input.txt +1/−0
- test/Golden/Parser/G5/P2.expected.txt +1/−0
- test/Golden/Parser/G5/P2.input.txt +1/−0
- test/Golden/Parser/G5/P3.expected.txt +1/−0
- test/Golden/Parser/G5/P3.input.txt +1/−0
- test/Golden/Parser/G6/P1.expected.txt +1/−0
- test/Golden/Parser/G6/P1.input.txt +1/−0
- test/Golden/Parser/G7/P1.expected.txt +1/−0
- test/Golden/Parser/G7/P1.input.txt +1/−0
- test/Golden/Parser/G7/P2.expected.txt +1/−0
- test/Golden/Parser/G7/P2.input.txt +1/−0
- test/Golden/Parser/G8/P1.expected.txt +1/−0
- test/Golden/Parser/G8/P1.input.txt +1/−0
- test/Golden/Parser/G9/P1.expected.txt +1/−0
- test/Golden/Parser/G9/P1.input.txt +0/−0
- test/Golden/Parser/G9/P2.expected.txt +1/−0
- test/Golden/Parser/G9/P2.input.txt +1/−0
- test/Golden/Parser/alt-char-fail.dump +0/−1
- test/Golden/Parser/alt-char-fail.txt +0/−1
- test/Golden/Parser/alt-char-try-fail.txt +0/−1
- test/Golden/Parser/alt-left.dump +0/−1
- test/Golden/Parser/alt-left.txt +0/−1
- test/Golden/Parser/alt-right-notry.dump +0/−1
- test/Golden/Parser/alt-right-notry.txt +0/−1
- test/Golden/Parser/alt-right-try.dump +0/−1
- test/Golden/Parser/alt-right-try.txt +0/−1
- test/Golden/Parser/char.dump +0/−1
- test/Golden/Parser/char.txt +0/−1
- test/Golden/Parser/eof-fail.dump +0/−1
- test/Golden/Parser/eof-fail.txt +0/−1
- test/Golden/Parser/eof.dump +0/−1
- test/Golden/Parser/eof.txt +0/−0
- test/Golden/Parser/many-char-eof.dump +0/−1
- test/Golden/Parser/many-char-eof.txt +0/−1
- test/Golden/Parser/many-char-fail.dump +0/−1
- test/Golden/Parser/many-char-fail.txt +0/−1
- test/Golden/Parser/many-char.dump +0/−1
- test/Golden/Parser/many-char.txt +0/−1
- test/Golden/Parser/many-oneOf.dump +0/−1
- test/Golden/Parser/many-oneOf.txt +0/−1
- test/Golden/Parser/some-string-eof-fail.dump +0/−1
- test/Golden/Parser/some-string-eof-fail.txt +0/−1
- test/Golden/Parser/some-string-fail.dump +0/−1
- test/Golden/Parser/some-string-fail.txt +0/−1
- test/Golden/Parser/some-string.dump +0/−1
- test/Golden/Parser/some-string.txt +0/−1
- test/Golden/Parser/string-fail-horizon.dump +0/−1
- test/Golden/Parser/string-fail-horizon.txt +0/−1
- test/Golden/Parser/string.dump +0/−1
- test/Golden/Parser/string.txt +0/−1
- test/Golden/Splice.hs +49/−0
- test/Golden/Splice/G1.expected.txt +132/−0
- test/Golden/Splice/G10.expected.txt +243/−0
- test/Golden/Splice/G11.expected.txt +257/−0
- test/Golden/Splice/G12.expected.txt +305/−0
- test/Golden/Splice/G13.expected.txt +722/−0
- test/Golden/Splice/G14.expected.txt +4218/−0
- test/Golden/Splice/G15.expected.txt +316/−0
- test/Golden/Splice/G16.expected.txt +427/−0
- test/Golden/Splice/G2.expected.txt +211/−0
- test/Golden/Splice/G3.expected.txt +184/−0
- test/Golden/Splice/G4.expected.txt +326/−0
- test/Golden/Splice/G5.expected.txt +420/−0
- test/Golden/Splice/G6.expected.txt +318/−0
- test/Golden/Splice/G7.expected.txt +329/−0
- test/Golden/Splice/G8.expected.txt +278/−0
- test/Golden/Splice/G9.expected.txt +153/−0
- test/Golden/Splice/T1.hs +0/−70
- test/Golden/Utils.hs +36/−0
- test/Grammar.hs +54/−0
- test/Main.hs +5/−7
- test/Parser.hs +0/−8
- test/Parser/Brainfuck.hs +0/−47
- test/Parser/Nandlang.hs +0/−138
- test/Parser/Playground.hs +0/−15
.envrc view
@@ -1,11 +1,1 @@-use_flake() {- watch_file flake.nix- watch_file flake.lock- watch_file default.nix- watch_file shell.nix- mkdir -p "$(direnv_layout_dir)"- eval "$(nix print-dev-env --option allow-import-from-derivation true -L --show-trace --profile "$(direnv_layout_dir)/flake-profile" || echo false)" &&- nix-store --add-root "shell.root" \- --indirect --realise "$(direnv_layout_dir)/flake-profile"-} use flake
ChangeLog.md view
@@ -1,3 +1,32 @@+## symantic-parser-0.2.0.20210703++* Fix mutual let bindings by defining them all together.+* Add a fixpoint to analyse the minimal reads and raisable exceptions+ of each let binding in the `Machine`.+ Those analyses respectively enable to minimize calls to `checkHorizon`,+ and minimize the number of `catchHandler`s passed to `call`s and `jump`s.+ Computed values appear in golden tests.+* Add golden tests for `TemplateHaskell` splices using `runQ`+ which is enough here and avoids to have a custom `Setup.hs`+ in order to correctly run an external `ghc`+ like [singletons](https://hackage.haskell.org/package/singletons-base-3.0/src/Setup.hs) does.+* Add preliminary support for error reporting using exceptions,+ based upon: [A Parsing Machine for Parsing Expression Grammars with Labeled Failures](https://dl.acm.org/doi/10.1145/2851613.2851750)+* Add benchmarks for Brainfuck parsers.+* Change `ValueCode` to `Production` which relies upon `Data.Functor.Product`,+ to be able to leverage type-classes to handle the burden of defining both+ `Identity` and `CodeQ` for `Production` expressions.+* Rename `Symantic.Univariant` to `Symantic.Typed`.+* Add `Language.Haskell.TH.Show` utility to avoid+ adding a `Symantic.Typed.View` entry into `Production`+ which would make writing `Production`s even more painful.+ This adds the benefit of printing any Haskell code,+ instead of only operators having symantics, eg. in `Symantic.Typed.Lang`.+ However `Symantic.Typed.View` is no longer used now,+ and thus `lam1`s no longer singled-out, not a big deal though.+* Major refactoring.+* Minor other optimizations and fixes.+ ## symantic-parser-0.1.0.20210201 * Add error reporting using the farthest position reached.
+ Hacking.md view
@@ -0,0 +1,36 @@+# Hacking `symantic-parser`++## Typing+```bash+make repl+make parsers/repl+make tests/repl+make benchmarks/repl+```++## Testing+```bash+make tests+```++### Profiling+```bash+make tests/prof+make tests/prof t=.Golden.Parsers.G13+```++## Benchmarking++### Profiling++#### Time+```bash+make benchmarks/prof-time b=Brainfuck/ByteString/hanoi/'*' BENCHMARK_OPTIONS=-n1+```+Then open `symantic-parser-benchmarks.eventlog.json` with [`speedscope`](https://www.speedscope.app).++#### Heap+```bash+make benchmarks/prof-heap b=Brainfuck/ByteString/hanoi/'*' BENCHMARK_OPTIONS=-n1+```+Then open `symantic-parser-benchmakrs.eventlog.html`.
Makefile view
@@ -1,25 +1,93 @@-cabal = $(wildcard *.cabal)-package = $(notdir ./$(cabal:.cabal=))-version = $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))+override RTS_OPTIONS += -L100+override TEST_OPTIONS += --color always --size-cutoff 1000000 $(addprefix -p ,$t)+override GHC_PROF_OPTIONS += -eventlog -fprof-auto -fprof-auto-calls+override BENCHMARK_OPTIONS += --output benchmarks/html/$(version).html --match glob $b+override REPL_OPTIONS += -ignore-dot-ghci++cabal := $(wildcard *.cabal)+package := $(notdir ./$(cabal:.cabal=))+version := $(shell sed -ne 's/^version: *\(.*\)/\1/p' $(cabal))+project := $(patsubst %.cabal,%,$(cabal))+ all: build build:- cabal build+ cabal build $(CABAL_BUILD_FLAGS) clean c: cabal clean repl:- cabal repl+ cabal repl $(CABAL_REPL_FLAGS) $(project)+ghcid:+ ghcid -c 'cabal repl $(CABAL_REPL_FLAGS) $(project) --repl-options "$(REPL_OPTIONS)"' --reverse-errors+.PHONY: parsers+parsers:+ cabal build $(CABAL_BUILD_FLAGS) $(project):parsers+parsers/repl:+ cabal repl $(CABAL_REPL_FLAGS) $(project):parsers+parsers/ghcid:+ ghcid -c 'cabal repl $(CABAL_REPL_FLAGS) $(project):parsers --repl-options "$(REPL_OPTIONS)"' --reverse-errors+parsers/prof-th:+ cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always+ cabal build $(CABAL_BUILD_FLAGS) $(project):parsers \+ --enable-profiling $(GHC_PROF_OPTIONS) \+ --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))" -t:- cabal test -fdump-splices --test-show-details always --test-options "--color always --size-cutoff 100000"-t/accept:- cabal test --test-show-details always --test-options "--accept --color always --size-cutoff 100000"-t/prof:- cabal test --enable-profiling --enable-library-coverage --enable-coverage --test-show-details always-t/repl:- cabal repl --enable-tests symantic-parser-test-t/splices: t- shopt -s globstar; $$EDITOR dist-newstyle/build/**/t/**/*.dump-splices+.PHONY: tests+t tests:+ cabal test $(CABAL_TEST_FLAGS) \+ --test-show-details always --test-options "$(TEST_OPTIONS)"+tests/prof-time: $(project)-test.eventlog.json+tests/prof-heap: $(project)-test.eventlog.html+.PHONY: $(project)-test.eventlog+$(project)-test.eventlog $(project)-test.prof:+ cabal test $(CABAL_TEST_FLAGS) \+ --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \+ --enable-profiling $(GHC_PROF_OPTIONS) || true+tests/prof-th:+ cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always+ cabal test $(CABAL_TEST_FLAGS) \+ --test-show-details always --test-options "$(TEST_OPTIONS) +RTS $(RTS_OPTIONS)" \+ --enable-profiling $(GHC_PROF_OPTIONS) \+ --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"+tests/repl:+ cabal repl $(CABAL_REPL_FLAGS) --enable-tests $(project)-test+tests/ghcid:+ ghcid -c 'cabal repl $(CABAL_REPL_FLAGS) $(project):tests --test-options "$(TEST_OPTIONS)"' --reverse-errors +%/accept: TEST_OPTIONS += --accept+%/accept: %+ +%/cover: CABAL_TEST_FLAGS += --enable-coverage+%/cover: %+ +%.eventlog.html: RTS_OPTIONS += -hy -l-au+%.eventlog.html: %.eventlog+ eventlog2html $<+%.eventlog.json: RTS_OPTIONS += -p -l-au+%.eventlog.json: %.eventlog+ hs-speedscope $<++.PHONY: benchmarks/html/$(version).html+b benchmarks: benchmarks/html/$(version).html+benchmarks/html/$(version).html:+ mkdir -p benchmarks/html+ cabal bench $(CABAL_BENCH_FLAGS) --benchmark-options "$(BENCHMARK_OPTIONS)"+benchmarks/repl:+ cabal repl $(CABAL_REPL_FLAGS) --enable-benchmarks $(project)-benchmark+benchmarks/prof-time: $(project)-benchmark.eventlog.json+benchmarks/prof-heap: $(project)-benchmark.eventlog.html+.PHONY: $(project)-benchmark.eventlog+$(project)-benchmark.eventlog $(project)-benchmark.prof:+ @echo "$$(tput setaf 1)WARNING: benchmarking with --enable-profiling can create significant biases$$(tput sgr0)"+ cabal bench $(CABAL_BENCH_FLAGS) \+ --benchmark-options "$(BENCHMARK_OPTIONS) +RTS $(RTS_OPTIONS)" \+ --enable-profiling $(GHC_PROF_OPTIONS)+$(project)-benchmark.prof2:+ cabal v2-build lib:$(project) --enable-profiling $(GHC_PROF_OPTIONS) --write-ghc-environment-files=always+ cabal bench $(CABAL_BENCH_FLAGS) \+ --benchmark-options "$(BENCHMARK_OPTIONS)" \+ --enable-profiling $(GHC_PROF_OPTIONS) \+ --ghc-options "$(addprefix -opti,+RTS $(RTS_OPTIONS))"+ doc: cabal haddock --haddock-css ocean --haddock-hyperlink-source @@ -44,6 +112,6 @@ nix-relock: nix flake update --recreate-lock-file nix-repl:- nix -L develop --command cabal repl+ nix -L develop --command cabal repl $(CABAL_REPL_FLAGS) nix-shell: nix -L develop
ReadMe.md view
@@ -1,21 +1,35 @@ ### Main differences with respect to `ParsleyHaskell` -- Extensible primitive grammar combinators, including their underlying optimization passes, by leveraging reciprocal injections between a tagless-final encoding of syntaxes (aka. type-classes) and a corresponding tagful-initial encoding to pattern-match syntaxes (aka. data-instances). This enable a very principled, yet flexible source code. Moreover `DefaultSignatures` are supplied to succinctly derive new semantics (aka. type-class-instances) using automatic `trans`formations.+- Primitive grammar combinators are extensible, including the optimization pass for which they are the current top-level combinator. -- Error messages based upon the farthest input position reached (not yet implemented in `ParsleyHaskell`).+- Error messages are based upon the farthest input position reached (not yet implemented in `ParsleyHaskell`) and a there is a preliminary support for error messages based upon [labeled failures](https://dl.acm.org/doi/10.1145/2851613.2851750). -- Minimal input length checks ("horizon" checks) required for a successful parsing are factorized using a different static analysis than `ParsleyHaskell`'s "piggy bank" which I've not understood well. This analyis can see beyond calls to subroutines, but maybe `ParsleyHaskell`'s analysis can also be adjusted to do the same. Both analysis are not well documented and studied.+- Minimal input length checks ("horizon" checks) required for a successful parsing are statically computed using a [polyfix](http://okmij.org/ftp/Computation/fixed-point-combinators.html#Poly-variadic) to see beyond calls to subroutines, which is not (yet) possible in `ParsleyHaskell`. -- No dependency upon GHC plugins: `lift-plugin` and `idioms-plugin`, because those are plugins hence introduce a bit of complexity in the build processes using this parser, but most importantly they are experimental and mostly cosmetics, since they only enable a cleaner usage of the parsing combinators, by lifting Haskell code in `pure` to integrate the `TemplateHaskell` needed. I do not understand them that much and do not feel confortable to maintain them come the day that their authors abandon them.+- No dependency upon GHC plugins: `lift-plugin`, `idioms-plugin` or `parsley-garnish` for users. Those provide convenient syntaxic-sugar (by quoting an Haskell expression as itself and its `TemplateHaskell` equivalent) for writing grammar productions, but are experimental, but I do not understand them that much and do not feel confortable to maintain them in case their authors abandon them. -- No dependency upon `dependent-map` by keeping observed sharing inside `def` and `ref` combinators, instead of passing by a `DMap`. And also when introducing the join-points optimization, where fresh `TemplateHaskell` names are also directly used instead of passing by a `DMap`.+- No dependency upon `dependent-map` by keeping observed sharing in `def` and `ref` combinators, instead of passing by a `DMap`. And also when introducing the join-points optimization, where fresh `TemplateHaskell` names are also directly used instead of passing by a `DMap`. -- No support for general purpose registers in the `Machine` producing the `TemplateHaskell` splices (maybe it will come if I need and understand what's done in `ParsleyHaskell`).+- No support (yet?) for general purpose registers in the `Machine` producing the `TemplateHaskell` splices. Hence `symantic-parser` generates parser much slower than `ParsleyHaskell`, comparable to `attoparsec` in the Brainfuck benchmark. -- License is `GPL-3.0-or-later` not `BSD-3-Clause`.+- License is `AGPL-3-or-later` not `BSD-3-Clause`. +- Testing grammars have their generated machines and `TemplateHaskell` splices followed by golden tests.+ ### Main goals - For me to better understand [ParsleyHaskell](https://github.com/j-mie6/ParsleyHaskell), and find a manageable balance between simplicity of the codebase and features of the parser. And by doing so, challenging and showcasing symantic techniques. -- To support the parsing of tree-like data structures instead of only string-like data structures. Eg. to validate XML using RelaxNG in [symantic-xml](http://hackage.haskell.org/package/symantic-xml) or to perform routing of HTTP requests in [symantic-http-server](http://hackage.haskell.org/package/symantic-http-server). This is currently done in those packages using `megaparsec`, but `megaparsec` is not conceived for such input, and is less principled when it comes to optimizing, like merging alternatives.+- To support the parsing of tree-like data structures instead of only string-like data structures. Eg. to validate XML using RelaxNG in [symantic-xml](https://hackage.haskell.org/package/symantic-xml) or to perform routing of HTTP requests in [symantic-http-server](http://hackage.haskell.org/package/symantic-http-server). This is currently done in those packages using `megaparsec`, but `megaparsec` is not conceived for such input, and is less principled when it comes to optimizing, like merging alternatives.++### Implementation techniques++#### Typed Tagless-Final+The syntax of grammars are term-level combinators defined in type-classes,+and their semantics are data-types having instances of those type-classes.+And the same technique is applied for machine instructions and grammar productions.++For automatic deriving, `DefaultSignatures` are supplied using automatic `trans`formations, see `Symantic.Typed.Trans`.++For pattern-matching, data-families indexed by the syntaxic type-class are supplied,+see `Symantic.Typed.Data`.
− Setup.hs
@@ -1,138 +0,0 @@-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--import Control.Monad--import Data.List-import Data.String--import Distribution.PackageDescription-import Distribution.Simple-import Distribution.Simple.BuildPaths-import Distribution.Simple.LocalBuildInfo-import Distribution.Simple.PackageIndex-import Distribution.Simple.Program-import Distribution.Simple.Setup-import Distribution.Simple.Utils-import Distribution.Text--import System.Directory-import System.FilePath--main :: IO ()-main = defaultMainWithHooks simpleUserHooks- { buildHook = \pkg lbi hooks flags -> do- generateBuildModule flags pkg lbi- buildHook simpleUserHooks pkg lbi hooks flags- , confHook = \(gpd, hbi) flags ->- confHook simpleUserHooks (amendGPD gpd, hbi) flags- , haddockHook = \pkg lbi hooks flags -> do- generateBuildModule (haddockToBuildFlags flags) pkg lbi- haddockHook simpleUserHooks pkg lbi hooks flags- }---- | Convert only flags used by 'generateBuildModule'.-haddockToBuildFlags :: HaddockFlags -> BuildFlags-haddockToBuildFlags f = emptyBuildFlags- { buildVerbosity = haddockVerbosity f- , buildDistPref = haddockDistPref f- }--generateBuildModule :: BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()-generateBuildModule flags pkg lbi = do- rootDir <- getCurrentDirectory- let verbosity = fromFlag (buildVerbosity flags)- distPref = fromFlag (buildDistPref flags)- distPref' | isRelative distPref = rootDir </> distPref- | otherwise = distPref- -- Package DBs- dbStack = withPackageDB lbi ++ [ SpecificPackageDB $ distPref' </> "package.conf.inplace" ]- dbFlags = "-hide-all-packages" : "-package-env=-" : packageDbArgsDb dbStack-- ghc = case lookupProgram ghcProgram (withPrograms lbi) of- Just fp -> locationPath $ programLocation fp- Nothing -> error "Can't find GHC path"- withTestLBI pkg lbi $ \suite suitecfg -> when (testName suite == fromString testSuiteName) $ do- let testAutogenDir = autogenComponentModulesDir lbi suitecfg- createDirectoryIfMissingVerbose verbosity True testAutogenDir- let buildSingletonsBaseFile = testAutogenDir </> buildSingletonsBaseModule <.> "hs"- withLibLBI pkg lbi $ \_ libCLBI -> do- let libDeps = map fst $ componentPackageDeps libCLBI- pidx = case dependencyClosure (installedPkgs lbi) libDeps of- Left p -> p- Right _ -> error "Broken dependency closure"- libTransDeps = map installedUnitId $ allPackages pidx- singletonsBaseUnitId = componentUnitId libCLBI- deps = formatDeps (singletonsBaseUnitId:libTransDeps)- allFlags = dbFlags ++ deps- writeFile buildSingletonsBaseFile $ unlines- [ "module Build_singletons_base where"- , ""- , "ghcPath :: FilePath"- , "ghcPath = " ++ show ghc- , ""- , "ghcFlags :: [String]"- , "ghcFlags = " ++ show allFlags- , ""- , "rootDir :: FilePath"- , "rootDir = " ++ show rootDir- ]- where- formatDeps = map formatOne- formatOne installedPkgId = "-package-id=" ++ display installedPkgId-- -- GHC >= 7.6 uses the '-package-db' flag. See- -- https://ghc.haskell.org/trac/ghc/ticket/5977.- packageDbArgsDb :: [PackageDB] -> [String]- -- special cases to make arguments prettier in common scenarios- packageDbArgsDb dbstack = case dbstack of- (GlobalPackageDB:UserPackageDB:dbs)- | all isSpecific dbs -> concatMap single dbs- (GlobalPackageDB:dbs)- | all isSpecific dbs -> "-no-user-package-db"- : concatMap single dbs- dbs -> "-clear-package-db"- : concatMap single dbs- where- single (SpecificPackageDB db) = [ "-package-db=" ++ db ]- single GlobalPackageDB = [ "-global-package-db" ]- single UserPackageDB = [ "-user-package-db" ]- isSpecific (SpecificPackageDB _) = True- isSpecific _ = False--buildSingletonsBaseModule :: FilePath-buildSingletonsBaseModule = "Build_singletons_base"--testSuiteName :: String-testSuiteName = "singletons-base-test-suite"--amendGPD :: GenericPackageDescription -> GenericPackageDescription-amendGPD gpd = gpd- { condTestSuites = map f (condTestSuites gpd)- }- where- f (name, condTree)- | name == fromString testSuiteName = (name, condTree')- | otherwise = (name, condTree)- where- -- I miss 'lens'- testSuite = condTreeData condTree- bi = testBuildInfo testSuite- om = otherModules bi- am = autogenModules bi-- -- Cons the module to both other-modules and autogen-modules.- -- At the moment, cabal-spec-2.0 and cabal-spec-2.2 don't have- -- "all autogen-modules are other-modules if they aren't exposed-modules"- -- rule. Hopefully cabal-spec-3.0 will have.- --- -- Note: we `nub`, because it's unclear if that's ok to have duplicate- -- modules in the lists.- om' = nub $ mn : om- am' = nub $ mn : am-- mn = fromString buildSingletonsBaseModule-- bi' = bi { otherModules = om', autogenModules = am' }- testSuite' = testSuite { testBuildInfo = bi' }- condTree' = condTree { condTreeData = testSuite' }
ToDo.md view
@@ -1,22 +1,12 @@-- [ ] Error messages also based upon: [A Parsing Machine for Parsing Expression Grammars with Labeled Failures](https://dl.acm.org/doi/10.1145/2851613.2851750)--- [ ] Golden tests using more complex grammars.--- [ ] Error messages also based upon: [A Parsing Machine for Parsing Expression Grammars with Labeled Failures](https://dl.acm.org/doi/10.1145/2851613.2851750)--- [ ] Concerning the unusual `pure :: H.Term pure a -> repr a`,- it may be acceptable to use `H.Term` only internally.+- [ ] Finalize support for error messages based upon: [A Parsing Machine for Parsing Expression Grammars with Labeled Failures](https://dl.acm.org/doi/10.1145/2851613.2851750) -- [ ] Move the `Symantic.Univariant.*` modules into a separate package, maybe `symantic-base`.+- [ ] Try to introduce registers like in `ParsleyHaskell`. -- [ ] Golden tests for TH splices as in `singleton`.- Note that the custom `Setup.hs` to get `ghcFlags` requires `cabal-install-3.4` which does not compile in Nixpkgs yet.+- [ ] Move the `Symantic.Typed.*` modules into a separate package, maybe `symantic-base`. - [ ] Support parsing tree inputs (eg. RelaxNG in `symantic-xml` or HTTP routing in `symantic-http-server`). -- [ ] Consider introducing registers like in ParsleyHaskell.- The custom `Setup.hs` requires `cabal-install-3.4`- which does not compile in Nixpkgs yet.+- [ ] Study how the generated parser can be made reentrant like `attoparsec`'s `Partial`.+ In which case it would be able to replace `attoparsec` in `pipes`. -- [ ] Study if the generated parser can easily and without much costs be made reentrant like `attoparsec`.- In which case it could maybe replace `attoparsec` in `pipes`.+- [ ] Golden tests using more complex grammars.
+ benchmarks/Brainfuck.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# OPTIONS_GHC -Wno-missing-signatures #-}+module Brainfuck where++--import qualified Data.Text.Lazy as TL+import Control.Monad ((=<<))+import Criterion.Main (Benchmark, bench, bgroup, env, nf)+import Data.Function (($))+import Data.Semigroup (Semigroup(..))+import qualified Data.Attoparsec.ByteString as AP.ByteString+import qualified Data.Attoparsec.Text as AP.Text+import qualified Data.ByteString as BS+import qualified Data.ByteString.Lazy as BSL+import qualified Data.List as List+import qualified Data.Text.IO as Text+import qualified System.IO as IO++import qualified Parsers.Brainfuck.Attoparsec as AP.Brainfuck+import qualified Parsers.Brainfuck.Handrolled as HR.Brainfuck+import qualified Parsers.Brainfuck.SymanticParser as SP.Brainfuck+import Paths_symantic_parser++inputPath inputName = getDataFileName ("parsers/Parsers/Brainfuck/inputs/"<>inputName<>".bf")+benchBrainfuck inputName =+ [ bgroup "Text"+ [ env (Text.readFile =<< inputPath inputName) $ \inp ->+ bgroup inputName+ [ bench "SymanticParser" $+ nf SP.Brainfuck.parserText inp+ , bench "Attoparsec" $+ nf (AP.Text.parse AP.Brainfuck.parser) inp+ , bench "Handrolled" $+ nf HR.Brainfuck.parser inp+ ]+ ]+ , bgroup "String"+ [ env (IO.readFile =<< inputPath inputName) $ \inp ->+ bgroup inputName+ [ bench "SymanticParser" $+ nf SP.Brainfuck.parserString inp+ ]+ ]+ , bgroup "ByteString"+ [ env (BS.readFile =<< inputPath inputName) $ \inp ->+ bgroup inputName+ [ bench "SymanticParser" $+ nf SP.Brainfuck.parserByteString inp+ , bench "Attoparsec" $+ nf (AP.ByteString.parse AP.Brainfuck.parser) inp+ , bench "Handrolled" $+ nf HR.Brainfuck.parser inp+ ]+ ]+ , bgroup "ByteStringLazy"+ [ env (BSL.readFile =<< inputPath inputName) $ \inp ->+ bgroup inputName+ [ bench "SymanticParser" $+ nf SP.Brainfuck.parserByteStringLazy inp+ ]+ ]+ ]++benchmark :: Benchmark+benchmark = bgroup "Brainfuck" $ List.concat+ [ benchBrainfuck "helloworld"+ , benchBrainfuck "compiler"+ , benchBrainfuck "hanoi"+ ]
+ benchmarks/Main.hs view
@@ -0,0 +1,10 @@+module Main where++import Criterion.Main+import Prelude+import qualified Brainfuck++main :: IO ()+main = defaultMain+ [ Brainfuck.benchmark+ ]
default.nix view
@@ -1,40 +1,57 @@ { pkgs ? import <nixpkgs> {} , ghc ? "ghc901" , withHoogle ? false+, inputs }: let haskellPackages = if ghc == null then pkgs.haskellPackages else pkgs.haskell.packages.${ghc};- hs = haskellPackages.extend (with pkgs.haskell.lib;- hself: hsuper:+ hs = haskellPackages.extend (with pkgs.haskell.lib; hself: hsuper: {- data-fix = doJailbreak hsuper.data-fix;- primitive = doJailbreak hsuper.primitive;- assoc = doJailbreak hsuper.assoc;- these = doJailbreak hsuper.these;- dump-core = dontCheck (unmarkBroken hsuper.dump-core);- #symantic-parser = enableExecutableProfiling (doCheck ( hself.callCabal2nix "symantic-parser" ./. {}));- } //- packageSourceOverrides {- symantic-parser = ./.;- } hself hsuper+ # FIXME: this should not be necessary, but haskellPackages.ormolu is currently broken.+ ormolu = pkgs.ormolu;+ text-short = dontCheck hsuper.text-short;+ hs-speedscope = doJailbreak (unmarkBroken hsuper.hs-speedscope);+ eventlog2html = doJailbreak (unmarkBroken hsuper.eventlog2html);+ trie-simple = doJailbreak (unmarkBroken hsuper.trie-simple);+ symantic-base = buildFromSdist (hself.callCabal2nix "symantic-base" inputs.symantic-base {});+ symantic-parser = doBenchmark (buildFromSdist (hself.callCabal2nix "symantic-parser" ./. {}));+ /*+ hlint = hsuper.hlint_3_3_1.overrideScope (self: super: {+ ghc-lib-parser = overrideCabal self.ghc-lib-parser_9_0_1_20210324 {+ doHaddock = false;+ };+ ghc-lib-parser-ex = self.ghc-lib-parser-ex_9_0_0_4;+ });+ */+ } ); in hs.symantic-parser // { shell = hs.shellFor {+ doBenchmark = true; packages = p: [ p.symantic-parser ];+ # FIXME: remove when Nixpkgs' haskellPackages.ormolu is no longer broken+ CABAL_TEST_FLAGS = "-fdisable-ormolu-check"; nativeBuildInputs = [- #pkgs.cabal-install- #hs.cabal-install- pkgs.cabal-install+ hs.cabal-install+ hs.eventlog2html+ hs.ghc-events+ hs.ghcid+ #hs.hlint+ hs.hs-speedscope+ hs.ormolu+ hs.profiteur+ #hs.threadscope+ #hs.ghc-events-analyze #hs.haskell-language-server #hs.hpc ]; buildInputs = [ #hs.ghcid- #hs.ormolu+ pkgs.cabal2nix #hs.hlint #pkgs.nixpkgs-fmt ];
+ flake.lock view
@@ -0,0 +1,75 @@+{+ "nodes": {+ "flake-utils": {+ "locked": {+ "lastModified": 1623875721,+ "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",+ "owner": "numtide",+ "repo": "flake-utils",+ "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",+ "type": "github"+ },+ "original": {+ "owner": "numtide",+ "repo": "flake-utils",+ "type": "github"+ }+ },+ "flake-utils_2": {+ "locked": {+ "lastModified": 1623875721,+ "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",+ "owner": "numtide",+ "repo": "flake-utils",+ "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",+ "type": "github"+ },+ "original": {+ "owner": "numtide",+ "repo": "flake-utils",+ "type": "github"+ }+ },+ "nixpkgs": {+ "locked": {+ "narHash": "sha256-3C35/g5bJ3KH67fOpxTkqDpfJ1CHYrO2bbl+fPgqfMQ=",+ "path": "/nix/store/6g7dgkinzm4rvwmpfp9avklsb4hiqals-nixpkgs-patched",+ "type": "path"+ },+ "original": {+ "id": "nixpkgs",+ "type": "indirect"+ }+ },+ "root": {+ "inputs": {+ "flake-utils": "flake-utils",+ "nixpkgs": "nixpkgs",+ "symantic-base": "symantic-base"+ }+ },+ "symantic-base": {+ "inputs": {+ "flake-utils": "flake-utils_2",+ "nixpkgs": [+ "nixpkgs"+ ]+ },+ "locked": {+ "lastModified": 1626033315,+ "narHash": "sha256-vHRFhc9Bg2cxrAR9R1TSXn2f6ZwzOIMRD+0n3cXzl54=",+ "ref": "master",+ "rev": "29078a0e7fbe8df3204bcf86dd902a301072574f",+ "revCount": 14,+ "type": "git",+ "url": "git://git.sourcephile.fr/haskell/symantic-base"+ },+ "original": {+ "type": "git",+ "url": "git://git.sourcephile.fr/haskell/symantic-base"+ }+ }+ },+ "root": "root",+ "version": 7+}
flake.nix view
@@ -1,12 +1,15 @@ { inputs.nixpkgs.url = "flake:nixpkgs";+#inputs.nixpkgs.url = "github:NixOS/nixpkgs"; inputs.flake-utils.url = "github:numtide/flake-utils";+inputs.symantic-base.url = "git://git.sourcephile.fr/haskell/symantic-base";+inputs.symantic-base.inputs.nixpkgs.follows = "nixpkgs"; outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system: let pkgs = inputs.nixpkgs.legacyPackages.${system}; in {- defaultPackage = import ./default.nix { inherit pkgs; };- devShell = (import ./default.nix { inherit pkgs; }).shell;+ defaultPackage = import ./default.nix { inherit inputs pkgs; };+ devShell = (import ./default.nix { inherit inputs pkgs; }).shell; } ); }
+ parsers/Parsers/Brainfuck/Attoparsec.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+module Parsers.Brainfuck.Attoparsec where++import Control.Applicative+import Data.Attoparsec.Combinator+import Data.ByteString as BS+import Data.Functor (($>))+import Data.Text as T+import qualified Data.Attoparsec.Internal.Types as AP++import Parsers.Utils.Attoparsec as AP+import Parsers.Brainfuck.Types++parser :: forall inp. AP.Inputable inp => AP.Parser inp [Instruction]+parser = whitespace *> bf <* endOfInput+ where+ whitespace = skipMany (AP.satisfy (AP.notInClass @inp "<>+-.,[]"))+ lexeme :: AP.Parser inp a -> AP.Parser inp a+ lexeme p = p <* whitespace+ bf = many (lexeme (AP.char '>' $> Forward)+ <|> lexeme (AP.char '<' $> Backward)+ <|> lexeme (AP.char '+' $> Increment)+ <|> lexeme (AP.char '-' $> Decrement)+ <|> lexeme (AP.char '.' $> Output)+ <|> lexeme (AP.char ',' $> Input)+ <|> between (lexeme (AP.char '[')) (lexeme (AP.char ']')) (Loop <$> bf))+-- Specializing is essential to keep best performances.+{-# SPECIALIZE parser :: AP.Parser T.Text [Instruction] #-}+{-# SPECIALIZE parser :: AP.Parser BS.ByteString [Instruction] #-}
+ parsers/Parsers/Brainfuck/Handrolled.hs view
@@ -0,0 +1,49 @@+module Parsers.Brainfuck.Handrolled where++import Control.Monad (Monad(..), fail)+import Data.ByteString as BS+import Data.Char (Char)+import Data.Maybe (Maybe(..))+import Data.Text as T+import qualified Data.List as List++import Parsers.Utils+import qualified Parsers.Utils.Handrolled as HR+import Parsers.Brainfuck.Types++parser :: forall inp.+ CoerceEnum (HR.Token inp) Char =>+ HR.Inputable inp =>+ inp -> Maybe [Instruction]+parser input = do+ (acc, is) <- walk input []+ if HR.null is+ then fail "remaining input"+ else Just acc+ where+ walk :: inp -> [Instruction] -> Maybe ([Instruction], inp)+ walk inp acc =+ case HR.uncons inp of+ Nothing -> Just (List.reverse acc, HR.empty)+ Just (i, is) ->+ case coerceEnum i of+ ']' -> Just (List.reverse acc, inp)+ '>' -> walk is (Forward:acc)+ '<' -> walk is (Backward:acc)+ '+' -> walk is (Increment:acc)+ '-' -> walk is (Decrement:acc)+ '.' -> walk is (Output:acc)+ ',' -> walk is (Input:acc)+ '[' -> do+ (body, is') <- loop is+ walk is' (Loop body:acc)+ _ -> walk is acc+ loop :: inp -> Maybe ([Instruction], inp)+ loop inp = do+ (body, rest) <- walk inp []+ case HR.uncons rest of+ Just (i, rest') | ']' <- coerceEnum i -> return (body, rest')+ _ -> fail "unclosed loop"+-- Specializing is essential to keep best performances.+{-# SPECIALIZE parser :: T.Text -> Maybe [Instruction] #-}+{-# SPECIALIZE parser :: BS.ByteString -> Maybe [Instruction] #-}
+ parsers/Parsers/Brainfuck/SymanticParser.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE ViewPatterns #-}+-- for Symantic.Parser's TemplateHaskell+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE UnboxedTuples #-}+{-# OPTIONS_GHC -Wno-unused-matches #-}+{-# OPTIONS_GHC -Wno-unused-local-binds #-}+module Parsers.Brainfuck.SymanticParser+ ( module Parsers.Brainfuck.SymanticParser+ , module Parsers.Brainfuck.SymanticParser.Grammar+ ) where++import Data.Either (Either)+import Data.String (String)+import qualified Data.ByteString as BS+import qualified Data.ByteString.Lazy as BSL+import qualified Data.Text as T+--import qualified Data.Text.Lazy as TL+import qualified Symantic.Parser as SP++-- 'grammar' must be in an another module because of GHC's stage restriction.+import Parsers.Brainfuck.SymanticParser.Grammar (grammar)+import Parsers.Brainfuck.Types (Instruction)++parserByteString :: BS.ByteString -> Either (SP.ParsingError BS.ByteString) [Instruction]+parserByteString = $$(SP.runParser @BS.ByteString grammar)++parserByteStringLazy :: BSL.ByteString -> Either (SP.ParsingError BSL.ByteString) [Instruction]+parserByteStringLazy = $$(SP.runParser @BSL.ByteString grammar)++parserString :: String -> Either (SP.ParsingError String) [Instruction]+parserString = $$(SP.runParser @String grammar)++parserText :: T.Text -> Either (SP.ParsingError T.Text) [Instruction]+parserText = $$(SP.runParser @T.Text grammar)++--parserTextLazy :: TL.Text -> Either (SP.ParsingError TL.Text) [Instruction]+--parserTextLazy = $$(SP.runParser @TL.Text grammar)
+ parsers/Parsers/Brainfuck/SymanticParser/Grammar.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE ViewPatterns #-}+module Parsers.Brainfuck.SymanticParser.Grammar where++import Data.Char (Char)+import Data.Function ((.))+import qualified Prelude++import qualified Symantic.Parser as SP++import Parsers.Utils+import Parsers.Brainfuck.Types++-- | Use with @$$(runParser @Text grammar)@,+-- but in another Haskell module to avoid+-- GHC stage restriction on such top-level splice.+grammar :: forall tok repr.+ CoerceEnum Char tok =>+ CoerceEnum tok Char =>+ SP.Grammarable tok repr =>+ repr [Instruction]+grammar = whitespace SP.*> bf+ where+ whitespace = SP.skipMany (SP.noneOf (coerceEnum @_ @tok Prelude.<$> "<>+-,.[]"))+ lexeme :: repr a -> repr a+ lexeme p = p SP.<* whitespace+ bf :: repr [Instruction]+ bf = SP.many (lexeme (SP.match (SP.look (SP.item @tok))+ (SP.prod . coerceEnum Prelude.<$> "<>+-,.[")+ op SP.empty))+ op :: SP.Production tok -> repr Instruction+ op prod = case coerceEnum (SP.runValue prod) of+ '<' -> SP.item @tok SP.$> SP.prod Backward+ '>' -> SP.item @tok SP.$> SP.prod Forward+ '+' -> SP.item @tok SP.$> SP.prod Increment+ '-' -> SP.item @tok SP.$> SP.prod Decrement+ ',' -> SP.item @tok SP.$> SP.prod Input+ '.' -> SP.item @tok SP.$> SP.prod Output+ '[' -> SP.between (lexeme (SP.item @tok))+ (SP.token (coerceEnum @_ @tok ']'))+ ($(SP.prodCon 'Loop) SP.<$> bf)+ _ -> Prelude.undefined
+ parsers/Parsers/Brainfuck/Types.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveLift #-}+module Parsers.Brainfuck.Types where++import Control.DeepSeq (NFData)+import Data.Eq (Eq)+import Data.Ord (Ord)+import GHC.Generics (Generic)+import Text.Show (Show(..))+import qualified Language.Haskell.TH.Syntax as TH++data Instruction+ = Forward+ | Backward+ | Increment+ | Decrement+ | Input+ | Output+ | Loop [Instruction]+ deriving (Show, Eq, Ord, TH.Lift, Generic, NFData)
+ parsers/Parsers/Brainfuck/inputs/compiler.bf view
@@ -0,0 +1,749 @@+Thanks to: https://github.com/matslina/awib+# This is the awib frontend+# Please refer to the documentation in the full source distribution+# of awib for details regarding this file+## Phase 1+## Target identification+##+% *T (where T = index of target platform)+# read bytes until EOF or bf instruction or '@' is reached+>>>>+[>[-],++% T 0 0 0 1 *inc(X) 0 0 0 (where X is byte read)+[->+>+<<]>>[-<<+>>]+<+% T 0 0 0 1 inc(X) *inc(X) 1 0+[-[>+++++[-<------->]+<-[-[-[-[--------------[--[-->>+<<[>>-<+++[-<--------->]+<[--[>+++++++++[-<++++++++++>]<[-]]]]]]]]]]]<->]+>[-<<<->>>]<<<]+% T 0 0 0 *0 X 0 0 d+% if( X=='@' ) d=1 else if(EOF) X=0 else X = a bf instruction+# if '@' was encountered then read a string at most 20 bytes long+# whitespace and EOF and bf all terminate the string when read+>>>>[->++++++++++++++++++++<<<<[-]>>>+[+% T 0 0 0 0 (target) 0 0 0 *1 C (where C = sub(20 strlen(target)))+-<,+[-<+<+>>]+<<->+% T 0 0 0 0 (target) X *X 1 0 C+[-[---------[-[---[>++++[-<---->]+<+[-----------[-[-[-[--------------+[--[>++[-<--------->]+<--[--[>+++++++++[-<++++++++++>]<[-]]]]]]]]]]]]]]]++>[-<->]+% T 0 0 0 0 (target) X c *0 0 C (where c=(X EOF or bf or whitespace ? 0 : 1))+>>[->+<]+<<<[->>>+>->+<[>-]>[>]<[-<<->>]<<<<<]>>>+% T 0 0 0 0 (target) X 0 0 0 *c D+% where c=(string terminated ? 0 : 1) and D=(c==1 ? sub(C 1) : C)+]+# if string was ended due to strlen exceeding limit then read one char extra++>[<-]<[<]>[-<<<,>>>>]+% T 0 0 0 0 (target) X 0 0 0 *0 D+# now check if the read target string matches any known target string+# and overwrite the target index T accordingly+# we take care not to overwrite the last read X as it may be bf and should+# be passed on to the bytecode compiler below+<<<<+[->+<]>[-<<[<]<<<+>>>>[>]>]++++++++++++++++++++>>>>[-<<<<->>>>]<<<+++++++++<<<[<]<<<->>>>[>]>>+% T X 0 0 0 (target) 0 s *8 0 0 (where s = strlen(target))+[[->+>+<<]>[-<+>]+>-[-[-[-[-[-[-[-[<->[-]]+<[-+# build target string for backend index 8+% T X 0 0 0 (target) 0 s 8 *0 0+>+++++++++[->+>++++++++++++<<]>>[->+>+>+>+>+>+>+>+>+<<<<<<<<<]+>>----------->++>----->------------->-->----------->++++++++++>-----------+<<<<<<<<<<<<+% T X 0 0 0 (target) 0 s 8 *0 0 9 0 "lang_java" 0+]>]+<[-+# build target string for backend index 7+% T X 0 0 0 (target) 0 s 7 *0 0+>+++++++++[->+>++++++++++++<<]>->[->+>+>+>+>+>+>+>+<<<<<<<<]>>----------->+++>----->------------->++++++++>---------+<<<<<<<<<<+% T X 0 0 0 (target) 0 s 7 *0 0 8 0 "lang_tcl" 0+]>]+<[-+# build target string for backend index 6+% T X 0 0 0 (target) 0 s 6 *0 0+>+++++++++[->+>++++++++++++<<]>>[->+>+>+>+>+>+>+>+>+<<<<<<<<<]>>----------->+++>----->------------->++++++>+++++++++>---------->++++++++++++++<<<<<<<<<<<<+% T X 0 0 0 (target) 0 s 6 *0 0 9 0 "lang_ruby" 0+]>]+<[-+# build target string for backend index 5+% T X 0 0 0 (target) 0 s 5 *0 0+>+++++++++++[->+>++++++++++<<]>>[->+>+>+>+>+>+>+>+>+>+>+<<<<<<<<<<<]+>-->------------->>------->--------------->++>+++++++++++>++++++>------>++<<<<<<<<<<<<<+% T X 0 0 0 (target) 0 s 5 *0 0 11 0 "lang_python" 0+]>]+<[-+# build target string for backend index 4+% T X 0 0 0 (target) 0 s 4 *0 0+>>+++++++[->+++++++<]+++++++>+[->++>++>++>++>++>++>++<<<<<<<]>+++++++++++>->++++++++++++>+++++>--->+++++>++++++++++++++<<<<<<<<<<+% T X 0 0 0 (target) 0 s 4 *0 0 7 0 "lang_go" 0+]>]+<[-+# build target string for backend index 3+% T X 0 0 0 (target) 0 s 3 *0 0+>>+++++++[->+++++++<]++++++++++>+[->++>++>++>++>++>++>++>++>++>++<<<<<<<<<<]>+++++++++++>->++++++++++++>+++++>--->++>+++++++++++++++++++>+++++++++++>++++++++++++>+++++++++++++++++++++++<<<<<<<<<<<<<+% T X 0 0 0 (target) 0 s 3 *0 0 10 0 "lang_dummy" 0+]>]+<[-+# build target string for backend index 2+% T X 0 0 0 (target) 0 s 2 *0 0+>>+++++++[->+++++++<]++++++>[->++>++>++>++>++>++<<<<<<]+>++++++++++>->++++++++++++>+++++>--->+<<<<<<<<<+% T X 0 0 0 (target) 0 s 2 *0 0 6 0 "lang_c" 0+]>]+<[-+# build target string for backend index 1+% T X 0 0 0 (target) 0 s 1 *0 0+>>+++++++[->+++++++<]+++++++++>[->+>+>+>++>++>++>++>++>++<<<<<<<<<]+>++>+++++++>+++++>--->++++++++++>+++++++>++++++++++++>++++++++++++++++++++>++++++++++++++++++++++<<<<<<<<<<<<+% T X 0 0 0 (target) 0 s 1 *0 0 9 0 "386_linux" 0+]+% T X 0 0 0 (target) 0 s i *0 0 S 0 (string) 0+% where S = strlen(string) and i is the backend index of the target (string)+# if (target) equals (string) then set T=i and break else decrease s and retry+<<[->>+>>-<<<<]>>[-<<+>>]>+>[<++++[->++++<]>[-]]<+% T X 0 0 0 (target) 0 s i 0 *e 0 0 (string) 0 (where e=(S==s ? 1 : 0))+[-+<+<<<<[<]>+% T X 0 0 0 *(target) 0 s i 1 0 0 0 (string) 0+[+% T X 0 (target) 0 0 *(F target) 0 s i c 0 (1sled) 0 0 (G string) 0+% where c = (strings equal so far ? 1 : 0 ) and (1sled) is a (initially empty)+% sequence of cells holding 1 and F/G first cells of respective block+[-<+<+>>]<[>>[>]>>>>>[>]>+>[<-]<[<]>[-<<[<]<[-]<<<<[<]<[-]+>>[>]>>>>>[>]>>+<]>-<<<[<]<<<<<[<]<-]+% T X 0 (target F) *0 0 (target) 0 s i c 0 (1sled) 0 0 sub(G F) (string) 0+>>[>]>>>>>[>]>>[[-]<<<[<]<[-]>>[>]>>]<<+[<]<<<<<[<]>+% T X 0 (target F) 0 0 *(target) 0 s i c 0 (1sled) 1 0 0 (string)+]+% T X 0 (target) 0 0 *0 s i c 0 (1sled) 0+<<<[[->>+<<]<]>>>[>]>>>>>[>]<[-<]<+% T X 0 0 0 (target) 0 s i *c 0+# if c==1 then we have a match and write T=i and set i=1+[-<<<<[<]<<<<[-]>>>>>[>]>>[-<<<[<]<<<<+>>>>>[>]>>]+>]>+% T X 0 0 0 (target) 0 s i 0 *0+]+# remove (string) if string lengths didn't match and then sub 1 from i+>>>[>]<[[-]<]<<+<<-]+% T X 0 0 0 (target) 0 s *0 0 0+<[-]<<[[-]<]<<<+[->>>>+<<<<]>>>>->>>+% T 0 0 0 0 X 0 0 *0+]+% T 0 0 0 0 X 0 0 *0+<<<+[->>>>>>>+<<<<<<<]>>>>>>>-+% T 11(0) *X 0 0+## Phase 2+## Bytecode compilation+##+% T 11(0) *X (where X is user input)+# if read char X is not EOF then enter main loop++[[-<+>]>+<]>[-<<->>]<<+[+% T 8(0) (code) 0 0 *X (cells left of code ignored for a while hereafter)+# check if X is brainfuck+[->+>+<<]>[-<+>]++++++[->-------<]+>-+[-[-[-[--------------[--[<+++[->-----+--<]+>-[--[<->>+++++++[-<++++++++++++++>]<++[-]]]]]]]]]<<+% (code) 0 0 *X isbf(X) 0 0+# if bf then add to bytecode+>[-+++++++[-<------->]+<+% (code) 0 0 *sub(X 42) 1 0 0+[-[-[-[-[--------------[--[-----------------------------[+# CLOSING BRACKET+# if this closes OPEN SUB(1) or OPEN ADD(1) then overwrite with SET(0)+# else append CLOSE+--<<++<<<<-------[>>>>-]>>>>[>>>>]<<<<<<<<+++++++>>>>+% (code) P i Q j *c 0 0 1 0 (where c = (P(i) == OPEN(0)))+[<<---[>>-]>>[>>]<<[->>>>+<<<<]++ << ++[>>-]>>[>>]<<[->>>>+<<<<]<<+>>>>>>+ % (code) OPEN 0 Q j 0 0 0 1 *d (where d = (Q == ADD or Q == SUB))+ [-<<<<+<-[>-]>[>]<<+>+ % (code) OPEN 0 Q j *e 0 0 1 0 (where e = (j == 1) == overwrite SET(0))+ [->>>-<<<<-<[-]<<++>>]>>>>]<<<<]>+% (code) 0 *0 0 f 0 (where f = 1 if append CLOSE)+>>[-<<<++++++++>>>>>]<<+% (code) CLOSE()/SET(0) 0 *0 0 0+]+# OPENING BRACKET+# if previous op was SET(0) or CLOSE or if this is the first op+# then ignore this loop+>[-+% (code) 0 0 0 *0 0 0++++<<<<<+[>>>>>-<<<<<[->>>+<<<]]>>>+--------[++++++++[-<+>]<-------->>>-<<]<+-[+++++++++[-<<+>>]<<--------->>>>>-<<<]<<+++++++++>>++<[>-]>[>]<[->>>[-<+>]<<<]>>>[-]<<<+++++++>>+% (code) OPEN *c 0 0 0 (where c = (should this loop be ignored ? 1 : 0))+[[-]+>>>>>+<<<<<[+% (code) OPEN *1 0 0 0 L l+>>+<,[>-]>[>]<[-<<->>]+<+[>-]>[>]<[-<<->>]<-+% (code) OPEN c *X 0 0 L l (where c = (EOF reached ? 0 : 1) and X = byte read)+>+++++++++[-<---------->]+<-[>-]>[>]<[->>+{ 16b inc >>>++++++++[-<++++++++>]<[->++++<]<+ [->+>-<<]>+[-<+>]+>-[<->[-]]<[-<[-]<+>>]<< }+<<]+<--[>-]>[>]<[->>+{ 16b dec >>+<[>-<[->>+<<]]>>[-<<+>>]<<->[-<++ <->++++++++[->++++++++<]>[-<++++>]<->]<< }+<<]+++++++++[-<++++++++++>]<++++[-]+>>>+{ 16b iszero >>+<[>-]>[>]<<<[[->>>+<<<]>>[-]<<]>>>[-<<<+>>>]<<< }+# if Ll=0 then delete OPEN and set c=0 to break+>>[-<<<<<<[-]<<------->>>>>>]<<<<<<+]]+% (code) *0 0 0 0 L l (where Ll is nonzero iff EOF occurred prematurely)+>>>>[-]>[-]<<<+% (code) 0 0 *0 0+]<]+# MOVE RIGHT+# if previous op is RIGHT(i) and i is not 255 then overwrite with RIGHT(inc(i))+# else append RIGHT(1)+>[+-<<<<<[->>+>+<<<]>>[-<<+>>]<[->+>>+<<<]>[-<+>]+% (code) *0 P i 0 (where P(i) = previous op)+++++++++++++++++[->>----------------<<]>>++[<<++++++++++++++++[->>++++++++++++++++<<]+>>[-]]<------[<[-]>++++++[-]]+<[->>+<<]++++++>+>[-<-<------<+>]>>+]<+% (code) RIGHT(?) 0 *0 0 0+]+# MOVE LEFT+# if previous op is LEFT(i) and i is not 255 then overwrite with LEFT(inc(i))+# else append LEFT(1)+>[+-<<<<<[->>+>+<<<]>>[-<<+>>]<[->+>>+<<<]>[-<+>]+% (code) *0 P i 0 (where P(i) = previous op)+++++++++++++++++[->>----------------<<]>>++[<<++++++++++++++++[->>++++++++++++++++<<]+>>[-]]<-----[<[-]>+++++[-]]+<[->>+<<]+++++>+>[-<-<-----<+>]>>+]<+% (code) LEFT(?) 0 *0 0 0+]+# OUTPUT+>[+<<<++++>>>->+]<+% (code) OUTPUT 0 *0 0 0+]+# SUB+#if previous op is SUB(i)+# if i is 255 then remove previous op+# else overwrite with SUB(inc(i))+#else append SUB(1)+>[+-<<<<<[->>+>+<<<]>>[-<<+>>]<[->+>>+<<<]>[-<+>]+% (code) *0 P i 0 (where P(i) = previous op)+>---[<+++>+++[-]+>[-]>]>+[<++++++++++++++++[->----------------<]>+>+<+[<<<+>>++++++++++++++++[->++++++++++++++++<]>[-]>-<]+>[-<<<<[-]<--->>>]<]+ ]<+% (code) SET/SUB(?) 0 *0 0 0+]+# INPUT+>[+<<<++>>>->+]<+% (code) INPUT 0 *0 0 0+]+# ADD+#if previous op is ADD(i)+# if i is 255 then remove previous op+# else overwrite with ADD(inc(i))+#else append ADD(1)+>[+-<<<<<[->>+>+<<<]>>[-<<+>>]<[->+>>+<<<]>[-<+>]+% (code) *0 P i 0 (where P(i) = previous op)+>-[<+>+[-]+>[-]>]>+[<++++++++++++++++[->----------------<]>+>+<+[<<<+>>++++++++++++++++[->++++++++++++++++<]>[-]>-<]+>[-<<<<[-]<->>>]<]+]<+% (code) ADD(?) 0 *0 0 0+]+# Cancellation+% (code P i Q j) 0 *0 (where P(i) and Q(j) are the two most recent ops)+# if P/Q in (LEFT/RIGHT RIGHT/LEFT ADD/SUB SUB/ADD) and j == 1+# remove Q(j) and decrement i+# if dec(i) == 0 then remove P(i)+>>+<<<+<-[>-]>[>]<<+>[+ # j == 1+ % P i Q 1 *1 0 0 1+ <<<[>>-]>>[>>]<<[->-<]+>[-+ # i != 0+ <-<[->+<<<+>>]+ % add(P Q) i *0 Q 0 0 0 1+ +<<----[>>-]>>[>>]<<[->>>+<<<]+<<-------[>>-]>>[>>]<<[->>>+<<<]+ >[-<+<<->>>]+<<<+++++++++++>>>>>+ % P i Q 1 0 *c 0 1 (where c = add(P Q) in (add(LEFT RIGHT) add(ADD SUB)))+ [->>-<<<<-<[-]+<-[>-]>[>]<[-<<[-]]>]<]]>>>+% (code) 0 0 0 *z (where z = 1 if we should attempt further optimizations)+#if P in (ADD SUB) and Q == SET then remove P+[>+<-<<<+<<---------[>>-]>>[>>]<<[+ # Q == SET+ >>>>-<<<<+ -<<+<<-[>>-]>>[>>]<<[->>>+<<<]+<<--[>>-]>>[>>]<<[->>>+<<<]<<+++>>>>>+ % P i 0 j 0 *c 0 0 0 (where c = P in (ADD SUB))+ [-<<<<<[-]>[-]>>[-<<+>>]]<]<<+++++++++>>>>>]+% (code) 0 0 0 *0 z (where z = 1 if we should attempt further optimizations)+# if P == SET and Q(j) in (ADD(1) SUB(1)) then inc/dec i and remove Q(j)++>[-+<<<<+<<<<---------[>>>>-]>>>>[>>>>]<<<<<<<<+++++++++>>>>[+ # P == SET+ % 9 i Q j *1 0 0 1 0+ <-[>-]>[>]<<+>[+ # j == 1+ <<-[>>-]>>[>>]<<<<+>>[-+ # Q == ADD+ >>>-<<<<-<<<+++++++[->----------------<]>+[>-]>[>]+<[->-<]>+ [-<++++++++++++++++[-<++++++++++++++++>]>]+ <<<+++++++++>>]+ +<<---[>>-]>>[>>]<<<<+++>>[-+ # Q == SUB+ >>>-<<<<-<--+ <[>-]>[>]<[+++++++++++++++[-<++++++++++++++++>]]<->+]]]>>>>]<+% (code) 0 0 0 *z 0 (where z = 1 if we should attempt further optimizations)+# if P == CLOSE then try the copy loop optimization+[+ -<<<+<<--------[>>-]>>[>>]<<<<++++++++>>[# P == CLOSE+ ->>>>>>>++++++++<<++++++++[-<++++++++++++++++>]<-[-<+<+>>]+ <<<<<+<-------+ % (code) Q j *1 1 0 0 128 128 *0 0 0 P+ <<[>>-]>>[>>]<<[->-<]>[-<+>]<+ [ # determine if loop can be optimized+ % (code) *k 0 0 0 l r a 0 0 (code)+ % where k = 1 iff next op should be inspected+ % l = sub(127 num_left)+ % r = sub(127 num_right)+ % a = 1 iff SUB(1) on cell 0 processed+ <<-[>>-]>>[>>]<<[# P == ADD+ >>>>[->->>+<<<]+>[<-]<[<]>[ # l == r: kill l ->>>[-<<+>>]<<<]+ >>>[-<<+<+>>>]<<<<<<+<-]++ <<--[>>-]>>[>>]<<[# P == SUB+ >>>>[->->>+<<<]+>[<-]<[<]>[ # l == r+ >>[<<-]<<[<<]>+>[-<<<<<-[>-]>[>]<<+>[->>>->>>+<<<<<<]+>>>>]+ <[->>>>[-<<+>>]<<<<]>]+ >>>[-<<+<+>>>]<<<<<<+<-]++ <<--[>>-]>>[>>]<<[# P == LEFT+ -<[->+>>>+>-[<-]<[<]>[-<<<<[->+<]>>>>]<<<<]>[-<+>]>+<]++ <<-[>>-]>>[>>]<<[ # P == RIGHT+ -<[->+>>>+>>-[<<-]<<[<<]>>[-<<<<[->+<]>>>>]<<<<]>[-<+>]>+<]+ % (code) sub(P 6) i *0 q 0 0 l r a 0 0 (code) 0+ % where q = P in (ADD SUB LEFT RIGHT)+ # keep going if q==1 && l!=0 && r!=0 && next op exists+ <[->>>>>>>>>+<<<<<<<<<]<++++++[->>>>>>>>>+<<<<<<<<<]+ +<<[>>->>>+<<<]>>[>>]<<[-]>>>>>>+ [[-<<+>>]>[[-<<+>>]<<<<+>>>>]<]>[-<<+>>]>[-<<+>>]<<<<<+ ---[<<<->>>+++[-]]<<<++ % (code) *k 0 0 0 l r a 0 0 P i (code)+ ]+ >>>>>>>>+>-------[<-]<[<]>>++++++++ <<<[->>+<<]+<<[-<+>>-<]>[>-]>[>]<[->>+<<]>+>---[<-]<[<]>>+++[-]+ <<<<<[->>+<<]>>[-]>+>+ % (code) 0 0 0 0 0 0 1 *w 0 (loop)+ % where w = 1 iff copy loop optimization can be applied+ [<->->>[-]>[-]<<<<<<<<<+>+>+>+>+>>>>>>+ [ # replace loop with LMUL/RMUL+ % (code) 0 1 ::: 1 0 0 n d 0 *P i (loop)+ % where d = offset to current cell+ % n = 1 iff offset is negative+ <+>-[--[--[-[++++++[-]<->]<[ # RIGHT(i)+ ->>[<<+<[>-]>[>]<[-<<[-]>>]<+>>>-]<<+ ]>]<[ # LEFT(i)+ ->>[<<+<[>-]>[>]<[-<<[-]+>>]<->>>-]<<+ ]>]<[ # SUB(i)+ % (code) 0 1 ::: 1 0 0 n d *1 0 i (loop)+ <[>-]>[>]+<[->-<]>[ # d != 0+ +++++++++++++++[-<<<<++++++++++++++++>>>>]>[-<<<<<->>>>>]<]<+ % (code) 0 1 ::: 1 0 sub(256 i) n d *0 0 0 (loop)+ ]>]<[ # ADD(i)+ % (code) 0 1 ::: 1 0 0 n d *1 0 i (loop)+ <[>-]>[>]+<[->-<]>[ # d != 0+ ->[-<<<<<+>>>>>]<]<+ % (code) 0 1 ::: 1 0 i n d *0 0 0 (loop)+ ]+ % (code) 0 1 ::: 1 0 y n d *0 0 i (loop)+ % where y!=0 iff MUL op should be appended to code+ % and y is the second op argument+ <<<[ # y!=0+ <+>>[ # n=1 so d negative+ <<-<[<]++++++++++>->++++++++++>->->[>]+ >>>[+<<<<[<]<<<+>>>>[>]>>>>>-<<]>+<<-]+ <<[ # n=0 so d positive+ -<[<]++++++++++++>->++++++++++++>->->[>]+ >>>[->>+<<<<<<[<]<<<+>>>>[>]>>>]+ <<<]+ >[-<<[<]<+>>[>]>]+ % (code) LMUL/RMUL y 0 1 ::: 1 0 *0 0 0 n d 0? (loop)+ ]+ % (code) 0 1 ::: 1 0 *0 n d 0 0 i (loop)+ >[>[+>>-<<]>+<<-]>[->>+<<]+ <<+<+>>>>>>>+ % (code) 0 1 ::: 1 0 0 n d 0 *(loop)+ ]+ % (code) 0 1 ::: 1 0 0 n 0 0 *0+ <<<[-]<<<[-<]+++++++++>>>>>>>>>+ % (code) SET(0) 0 0 0 0 0 0 0 *0+ ]+ % (code) 0 0 0 0 0 0 v *0 0 (loop)+ % where v = 1 iff copy loop optimization was not applied+ <[->>>[[-<<<<<<<<<+>>>>>>>>>]>[-<<<<<<<<<+>>>>>>>>>]>]+ <<<]<<<<<<+ ]>>>+ % (code) 0 0 0 *0 0+ ]+]+% 8(0) (code) 0 0 X *0 (where X may be the last byte read)+# read next byte and and break if EOF+<[-]>+,+[[-<+>]>+<]>[-<<->>]<<+]+<<<<[<<]+% 6(0) *0 0 (code)+## Phase 3+## Code verification+##+# move code leftwards and ensure that all OPEN/CLOSE are balanced+# in the process we calculate the maximum loop (ie OPEN/CLOSE) depth+% 6(0) *0 0 (code)+<+<<+>>>>>[+% 0 0 (code) M m D d 0 0 *P p (code) 0 c+% where Pp is first op of right code block+% Dd holds current loop depth (starting at 1)+% Mm holds the max loop depth yet encountered+% c = (unbalanced code ? 1 : 0)+<<<[->>+<<]<[->>+<<]<[->>+<<]<[->>+<<]>>>>>>>[-<<<<<<+>>>>>>]<+[->+<<<<<<<+>>>>>>]+>+% 0 0 (code) P p M m D d 1 *P (code) 0 c+-------[-[<->++++++++[-]]+<[-<<+# P is CLOSE; decrease Dd and leave Mm as it was+ { 16b dec >>+<[>-<[->>+<<]]>>[-<<+>>]<<->[-<+<->+++++++ ++[->++++++++<]>[-<++++>]<->]<< }+>>]>]+<[+# P is OPEN; if Mm==Dd then Mm=Dd=inc(Dd) else Dd=inc(Dd)+% (code) P p M m D d *1 0 (code) 0 c (note: p=0 since P=OPEN)+<<[-<<->>>>>+<<<]<<[[->>+<<]>>>>-<<<<]+% (code) P p *0 m sub(M D) d e D (code) 0 c (where e=(M==D ? 1 : 0))+>>>[-<<-<+>>>]<<[[->>+<<]>>>[-]<<<]+% (code) P p d *0 sub(M D) sub(m d) e D (code) 0 c (where e=(Mm==Dd ? 1 : 0))+>>[-<<+>>]<<<[->+>>+<<<]>>[-<<+>>]>>>[-<<<+<<+>>>>>]<[-<<<<<+>>>>>]<<+% (code) P e M m *D d 0 0 (code) 0 c (where e = (Mm==Dd ? 1 : 0))+ { 16b inc >>>++++++++[-<++++++++>]<[->++++<]<[->+>-<<]+ >+[-<+>]+>-[<->[-]]<[-<[-]<+>>]<< }+<<<[->[-]>[-]>[-<+<+>>]<[->+<]>>[->+<<<+>>]>[-<+>]<<<<<]>>>>>+]+% 0 0 (code P p) M m D d *0 0 (code) 0 c (where Dd is properly updated)+<< { 16b iszero [[->>+<<]>>>+<<<]>>[-<<+>>]<[[->+<]>>+<<]>[-<+>]+>[<->[-]]<<< }+>>[-<+>>>[>>]>[-]+<<<[<<]]>>+% 0 0 (code P p) M m D d 0 0 *(code) 0 c (where c is properly updated)+]+% 0 0 (code) M m D d 0 0 *0 c+<<<<+{ 16b dec >>+<[>-<[->>+<<]]>>[-<<+>>]<<->[-<+<->+++++++ ++[->++++++++<]>[-<++++>]<->]<< }+{ 16b isnonzero >[>>+<]>[<]<<[[->>+<<]>>>+<<<]>>[-<<+>>]>[[-]<+>]<<< }+>>[->>>[-]+<<<]<[-]<[-]<[->+<]<[->+<]>>>>>>>[-<<<<+>>>>]<<<<+<<<<<[<<]>+>[>>]>>>+% 0 1 (code) 0 M m *c 0 0 0+# if c==1 output string "Error: unbalanced brackets!\n"+[-<[-]<[-]<<<[<<]>->[>>]++++++++++++[->++++++>++++++++++>+++<<<]>+% (code) 0 *66 110 33++++.>++++..---.+++.<-----------.>>-.<+++.-------.+------------.-.+++++++++++.-----------.+++++++++++++.+-----------.++.-.>.<--.++++++++++++++++.-----------------.+++.++++++++.------.+++++++++++++++.-.>+.---[--->+<]>.[-]<<[-]<[-]>>>]+<<<<<[<<]+% T *0 b (code) 0 M m+% where b = (bytecode OK ? 1 : 0) and Mm = maximum loop depth++# This is the Java language backend for awib+# Please refer to the documentation in the full source code distribution+# of awib for additional details+% 23(0) *8 (code) 0 M m+# print Java header+++[-<++++++++<++++++++<++++++++++<++++++++++<+++<++++++++++<++++++++++<+++++++++++<+++<++++++<++<+++++++++++>>>>>>>>>>>>]<<<+++++.++++.+++.-.+++.+++.<<++.>++++++.<<---.>>>++.<<<.>++++++++++++++.>-.++++++.<.>>>-------.<+<-.++.>-.-.>>+++.<<.--.<<<<+.>.>>---.<<<<<<-.<----------.<-----.++++.++++.-.+++.++.>>>++.>>+++++.>.>>>++++.<<<.>.<<-.>>>++.<.>>>>----.<<-.-.<+.>++.-.>>++++.<<.--.<<<<<+.>>.>>---.<<<<<<.<.>>>>.>>>.>--.-.+++.++.<<<<<<.>>++.>.>>>++.<<<.>.<<-.>>>++.<.>>>.>----.<----.<++.<<<++.++.>>+.++++.<<<.+++++++.-.<<<.<..<----.+++++.>>>>---.>--.---.<+.<.>.>+++.<--.>>>>-..<<<<<.<++++++++.>>>>+.<<<.>>>>>>+++.<<<<<<<<.>>....>+.>>>>>--.<+.<<-.<<-------.+++.<.>>+.<<<-------.<.>>....>>----.+++++.>>>.<<<<<.>>++.<<<.<.>>....>>>>>+>>++++.<<<<<--.++.>>>+.-.>>>++++.<<<.--.<<.----.<---.<<.>>----.<<<.<.>>.+...>>>>>>>>----.<<----.-.<--.>+.-.>>++++.<<.--.<<<++++.----.>>---.<<<<<.+>>>>>++.<<<<<<.<..>>....>>>>>+.>+++.<<<+.<+++.---.>+.<<<.<+++++++.>>>---+.>>------.>>>.<<--.++.>.-.>>.<<.--.<<<++.----.>>---.<<<<<.>>+++.>>++++.<+<<<.>>>>>>>>----.<<+++.-.----.+++++.-.>>++++.<<.--.<<<++++.----.>>.<<<<<+.>>>>>++.<---.<<<<.<<<++++++.>.>>........>>++++.<<<-----.>>>+.>++++.>>>++++++.<<<<<<.>>>---.>>>++.-----.<<<+++.<<--.>>>+++++++.>>++++.<<+.-.+.-..+<<<++.<<--.<.>>........>>++.<<<++.>>>>>+.+.+++++.++++.<<<<<<.>>........>+>++++.>+++.+.<-.>>-------------.<.<<<<.>>>>.<<<<--.<.>>........>>+.>-.+.+<-.>>.>.<<<<<<++.>>>>>>.<<<<<<--.<.>>....<<<++.>..>>....>>---.+++++.<++++++.>>+++.---.<<+.<.>>+.>>>.<<.<<+.<.>>----.+++.>>>-.<<<<<.++++++++.+.---+------.<<<--.>.>>........>>-.>-.+.<-.>>.<<<-----.>>>++.--------.+.<<<<<.+<.>>....<<<++.>..>>....>>---.+++++.<+++.>>+++.---.<<+.<.>>--.+.<--.>.>.<+<++.<.>>++.>>>+.<<.<<+.<.>>>>>--.<<<<---.>>.>>+.<-.>>>>.<<----.--.<<<.>>+.<<--.<<------.++.<.>++++.>>>>>.<<<.>>>+.<<+.<<<<.<<<--.>.>>........>>>>+>.<<--.<+.<<.<+++++++.>>>>+.>-.>>>>.<<++++++.------.+.<<<-.>>-.<++++++.>+----.+++++.<--.>>>>.<<+++++.------.+.<<<.>>-.<++.>++.>+.-.<<-----.+++++.+>>--.+++.<-.<------.+.<<<<<-------.<.>>....<<<++.>..>>....>>>>>++.++.<<+++++.<-.<.>--.>----.<<<.>>++.>>>---.------.<<-.<<<.>>----.>>-.+.<<<<.<<<-+-.>.>>........>>++.--.+++++++.<<.<<<.>.>>............>>>>>.<+++++.>>---.+<<<+.<<.>>-.>------.>++++.<++++.>>--.<<.+++++.--------.<<<<<.<.>>.......+.<<<++.>>>.>++.--.>-----.>-.+++++.<<<.>>>>-.>>>.>----.<----.<++++++++.<<+<<<++.++.>----.++++.>+.>>++.-.<<<<<.>.>>>+.<<<<.<<<--.++.>.>>....<<<.>..+>>....>>----.++.>.>>>--.<<<<<----.>++.>----.<<<.>>++.>>>+.------.<<-.<<<+.>>+.>>-.+.<<<<.<<<--.>.>>........>>---.--.>>>>+++.<<<<<<.<<<.>.>>......+......>>---.>>+++++.>>--.-----.<.>++.<<<+.>------.<<--.<------.>+++.<++.+>>>+.<<<<<.<.>>............>>-.>>+++++.<+.<---.>>>>+.--.<-.<------.+.<<<+<<.<.>>........<<<++.>>>.>>>---.--.>>>+.<<<++.>>.<<<<<.>>>>-.>>>++++.>.<+----.<++++.<<<.++.<++++.++++.>>>+.++++++.-.<<<<<.>>>.>+.<<<<.<<<--.++.>.+>>....<<<.>..>>....>>----.++.>++++.>>>--.<<<<<++++.>++.>----.<<<.>>++.>>+>+.------.<<-.<<<.>--.>>>+++++++.--------.+.<<<<.<<<--.>.[<]>[[-]>]+% 23(0) *0 (code) 0 M m+++++++++++++++++[-<++++++++++++++++>]<-[-<<<<<<<<<<<<<<<+<+>>>>>>>>>>>>>>>>]+<<<<<<<<<<<<<<<<<<+<+>>>>>>>>>>>>>>>>>>>>+% 4(0) 1 0 255 255 15(0) *0 (code) 0 M m+>[<+>+% ::: (stack) 0 1:::1 0 c d 15(0) 1 *P i (code) 0 M m+% (where c and d form a two cell counter+% P(i) is the next op code)+# the stack segment is a sequence of adjacent C and D; these values+# are previous values of the cd counter that have been pushed to stack+# on OPEN; they are in turn popped on CLOSE+-[-[-[-[-[-[-[-[-[-[-[-[[-]+<[+# RMUL2+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m++++++[->+++++++++++++++<]>+++.-[--<+>]<---.-[-->+++<]>--.------[-<++>]<-.-+-----------------.+[---->+++++<]>---.+++[-----<++++>]<+.-[-->+<]>----.[-]+<<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# RMUL1+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->++++++++++++++++++<]>+.------------------.+[----<+++++>]<---.+--[----->++<]>-.[-]<<<+>>+% ::: (stack) 0 1:::1 0 c d 11(0) 0 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# LMUL2+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m++++++[->+++++++++++++++<]>+++.-[--<+>]<---.-[-->+++<]>--.------[-<++>]<-.-+-----------------.+[---->+++++<]>---.+++[-----<++++>]<+.-[-->+<]>----.[-]+<<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# LMUL1+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->++++++++++++++++++<]>+.------------------.+[----<+++++>]<---.+--[----->++<]>+.[-]<+<<+>>+% ::: (stack) 0 1:::1 0 c d 11(0) 0 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# SET+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++[->++++++<]>[-<++++<+++<+<++>>>>]<-----------.<+.>+++.<++.+<<+.>++++++++++.>+++++.>+++++++++.-----.<+++.<+.>>[[-]<]+>>+>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[-+# CLOSE+% ::: (stack) 0 1:::1 0 c d 15(0) *0 0 0 (code) 0 M m+# output: ' }\n\n private void '++++++++++++++++++++++++++[-<+<+++++<++++<++<+++>>>>>]<+++++++....<.+>>++++++++++..<....<-------------.++.<+++++.>++++.<--------.>--.<+++++.>>.<++.-------.<++++.-----.>>.>[[-]<]<<<<<<<<<<<<+% ::: (stack) 0 1:::1 *0 c d 15(0) 0 0 0 (code) 0 M m+# fetch xy from top of stack+<[<]<[->>[>]>>>>+<<<<<[<]<]<[->>>[>]>>>>>+<<<<<<[<]<<]>+>+[>]+% ::: (stack) 0 1:::1 *0 c d 0 y x 12(0) 0 0 0 (code) 0 M m+# output: '_x_y'+>>>>>[+>++++++++[->++++++++++++<]>-.[-]+# itoa+++++++++++<<[->>->+<[>-]>[>]<[-<++++++++++<+>>]<<<]++++++++++>>[-<<->>]+>++++++++++<<[->>->+<[>-]>[>]<[-<++++++++++<+>>]<<<]++++++++++>>[-<<->>]+>++++++[-<++++++++>]<<[>[-<+<+>>]<.[-]<.[-]>]+<[>>[-<<+>>]<<.[-]]>>[-]<<++++++[-<++++++++>]<.[-]<+]+% ::: (stack) 0 1:::1 0 c d *0 14(0) 0 0 0 (code) 0 M m+# output: '() {'++++++++++++++++++++++++++++++++++++++++++[->+++>+>++<<<]+>>-.+.---------.<.<++++++++++.[[-]>]>>>>>>>>>>>+% ::: (stack) 0 1:::1 0 c d 15(0) *0 0 0 (code) 0 M m+]>]+<[-+# OPEN+% ::: (stack) 0 1:::1 0 c d 15(0) *0 0 0 (code) 0 M m+# build ef = dec(cd)+<<<<<<<<<<<<<<<<[[->>+>>>>>>>>+<<<<<<<<<<]<]+>>>>>+<-[>-]>[>]<[+++++++++++++++[-<++++++++++++++++>]<-<->>]<+% ::: (stack) 0 1:::1 0 0 0 e *f 6(0) c d 5(0) *0 0 0 (code) 0 M m+# push a copy of ef to stack+<<<<<[<]>->->[>]>>>+[-<<<<[<]<<+>>>[>]>>>>>>>>>+<<<<<<]>+[-<<<<<[<]<+>>[>]>>>>>>>>>>+<<<<<<]>>>>>>>>+% ::: (stack ef) 0 1:::1 9(0) e f c *d 5(0) 0 0 0 (code) 0 M m+# construct decimal representations of e f c and d+[+% 0 (counters) *n 5(0) 0 0 0+% (where n is the rightmost counter)+# itoa+% (counters) *n 5(0) 0 0 0+>>++++++++++<<[->>->+<[>-]>[>]<[-<++++++++++<+>>]<<<]++++++++++>>[-<<->>]+>++++++++++<<[->>->+<[>-]>[>]<[-<++++++++++<+>>]<<<]++++++++++>>[-<<->>]+>++++++[-<++++++++>]<<[>[-<+<+>>]<:[->>>>+<<<<]<:[->>>>>>+<<<<<<]>]+<[>>[-<<+>>]<<[->>>>>>+<<<<<<]]>>[-]<<++++++[-<++++++++>]<[->>>>>>>>+<<<<<<<<]+% (counters) *0 5(0) n2 n1 n0+% (where n2n1n0 is n in base 10+% ni is 0 if not significant)+# move down remaining counters to make room for next base 10 rep+<[<]>[[-<<+>>]>]<<<+]+% ::: (stack) 0 1:::1 *0 8(0) e2 e1 e0 f2 f1 f0 c2 c1 c0 *d2 d1 d0 (code) 0 M m+# output: ' while(m{p}!=0){_'+# but with brackets instead of braces+++++++++++++++++++++++++++++++[->++>+>++++>+++<<<<]>>++........>-.+---------------.+.+++.-------.<++++++++.>++++++++.>+.<+++.>++.+<<-------.<+.-------------.-------.>>+++++++++++.>++.>+% 0 41 33 123 95 *0 0 0 0 e2 e1 e0 f2 f1 f0 c2 c1 c0 d2 d1 d0+# output: '_c_d();}'+# replace c and d with the corresponding decimal representation+>>>>>>>>>+>[.[-<<<<<<<<<+>>>>>>>>>]]>[.[-<<<<<<<<<+>>>>>>>>>]]>[.[-<<<<<<<<<+>>>>>>>>>]]+<<<<<<<<<<<<<.>>>>>>>>>>>>>+>[.[-<<<+>>>]]>[.[-<<<+>>>]]>[.[-<<<+>>>]]+<<<<<<<<<<<<<<<<<<<-.+.++++++++++++++++++.------------------>>++.+<<<++++++++++.>->-+% 10 40 *32 125 95 0 c2 c1 c0 e2 e1 e0 f2 f1 f0 d2 d1 d0 0 0 0+# output: ' _e_f();\n }\n\n private void _c_d'+# again with e f c and d replaced by their base 10 reps+........>>.>>>>+>[.[->>>>>>>>>+<<<<<<<<<]]+>[.[->>>>>>>>>+<<<<<<<<<]]+>[.[->>>>>>>>>+<<<<<<<<<]]+<<<<<<<.>>>>>>>+>[.[-<<<+>>>]]+>[.[-<<<+>>>]]+>[.[-<<<+>>>]]+% 10 40 32 125 95 0 c2 c1 c0 f2 f1 f0 0 0 *0 d2 d1 d0 e2 e1 e0+<<<<<<<<<+<<<<.+.++++++++++++++++++.<.>>....>.<<<..>>....>-------------.++.---------.++++++++++++++.>++.<--.>++++.<<.>++.-------.>++++.-----.<<.>>-----.<<<<+% *10 59 32 111 95 0 c2 c1 c0 f2 f1 f0 0 0 0 d2 d1 d0 e2 e1 e0+>>>>>+>[.[-]]>[.[-]]>[.[-]]+<<<<.>>>>>>>>>>+>[.[-]]>[.[-]]>[.[-]]+% 10 59 32 111 95 0 0 0 0 f2 f1 f0 0 0 0 0 0 *0 e2 e1 e0+# restore ef+>[[-<+>]++++++[-<-------->]]+>[[-<+>]++++++[-<-------->]]+>[[-<+>]++++++[-<-------->]]+<<[->++++++++++<]+<[->++++++++++[->++++++++++<]<]+<<<<<+<[[->+<]++++++[->--------<]]+<[[->+<]++++++[->--------<]]+<[[->+<]++++++[->--------<]]+>>[->++++++++++<]<[->++++++++++[->++++++++++<]<]+% 10 59 32 111 95 0 0 0 0 0 *0 0 f 0 0 0 0 0 0 e 0+# output: '() {'+# and move ef into position+<<<<<<<<++++++++.+.---------.>++++++++++++.<<<.+[[-]>]+>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]+>>>>>>>[-<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>]+% 0 e f 15(0) 0 *0 0+# leave behind gh = dec(dec(cd)) = dec(ef)+<<<<<<<<<<<<<<<<+<-[>-]>[>]<[+++++++++++++++[-<++++++++++++++++>]<-<->>]+>>>>>>>>>>>>>>>+% ::: (stack) 0 1:::1 0 g h 15(0) *0 0 0 (code) 0 M m+]>]+<[+# RIGHT+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->+++++++++++++++++++<]>--.--[-----<++>]<-.-[-->+++<]>--.[-]<+<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# LEFT+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->+++++++++++++++++++<]>--.--[-----<++>]<+.[--->++++<]>+.[-]<+<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# OUTPUT+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->++++++++++++++++++++<]>-.+[---<+>]<.+.[-]+<<<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 0 0 *0 0 i (code) 0 M m+]>]+<[+# SUB+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->++++++++++++++++++<]>+.------------------.+[----<+++++>]<---.++++[----->++++<]>+.-[--<+>]<-.[--->++++<]>+.[-]<+<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]>]+<[+# INPUT+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->+++++++++++++++++++<]>.[---<+>]<++.+.[-]+<<<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 0 0 *0 0 i (code) 0 M m+]>]+<[+# ADD+% ::: (stack) 0 1:::1 0 c d 15(0) *1 0 i (code) 0 M m+++++++++.---[->++++++++++++++++++<]>+.------------------.+[----<+++++>]<---.++++[----->++++<]>+.-[--<+>]<---.-[-->+++<]>--.[-]<+<<+<<+>>>>+% ::: (stack) 0 1:::1 0 c d 11(0) 1 0 1 0 *0 0 i (code) 0 M m+]+# optionally append ; and/or itoa(i)+% ::: (stack) 0 1:::1 0 c d 11(0) b 0 a 0 *0 0 i (code) 0 M m+% (where a==1 iff i should be output+% b==1 iff ';\n' should be output)+<<[->>+% ::: b 0 0 0 *0 0 i (code) 0 M m+# itoa+++++++++++>>[-<<-<+>[<-]<[<]>[->++++++++++>+<<]>>>]++++++++++<<[->>-<<]+<++++++++++>>[-<<-<+>[<-]<[<]>[->++++++++++>+<<]>>>]++++++++++<<[->>-<<]+<++++++[->++++++++<]>>[<[->+>+<<]>.[-]>.[-]<]+>[<<[->>+<<]>>.[-]]<<[-]>>++++++[->++++++++<]>.[-]+<<<<]+<<[+++++[->++++++++++<]>-.[-]++++++++++.[-]<]>>>>>>[-]+% ::: (stack) 0 1:::1 0 c d 15(0) 0 0 *0 (code) 0 M m+# copy up cd; extend the 1 sled; process next operation+<<<<<<<<<<<<<<<<<<[->>+<<]<[->>+<<]+<+>>>>>>>>>>>>>>>>>>>>+>]+% ::: 0 0 0 *0 M m+# footer+>[-]>[-]++++[->++++++++<]>....[->++++<]>---.>++++++++++.<.[-]>.[-]+% ::: 0 0 *0 0 0
+ parsers/Parsers/Brainfuck/inputs/hanoi.bf view
@@ -0,0 +1,713 @@+Towers of Hanoi in Brainf*ck+Source: http://www.clifford.at/bfcpu/hanoi.bf+License: GNU GPLv2++Copyright: Clifford Wolf <clifford@clifford.at>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>[-]>[-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-------------------.-------+--------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----------------------------------------.+++++++++++++++++++++++++.[-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-------------------------------------+----.+++++++++.---------.+++++.+++++++++++++++++.++++++++++++.++++++++++++++++++++++++++++.++++++++.------------------.+++++++++++++.+.------------------+-----------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------+---.----------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.++++++++++++++.+.------.---------------------------------------------------------------+----------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++.-------------------------------------------------------------+-----------------.++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++.-----------------.++++++++.+++++.--------.--------+----------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++.[-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------------+----------------------------.++++++++.----------.++++.+++++++++++++++++++.++++++++++++++++.+++++++++++++++++++++++++++.---------.+++++++++++..-----------+----.+++++++++.-------------------------------------------------------------+-----------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++.-------------------------------------------+----------------------------------------------.++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++.---.---..+++++++++.+++.----+----------.-----------------------------------------------------------------+---.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.---.------.--------------------------------------------------------+--------------.++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++.++++++++++++..----.--------------------------------------------+----------.-----------..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...-----------------------------------------------------+--------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++.---.---..+++++++++.+++.--------------.-----------------------------+-------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++.------------------------------------------------------+---------------.+++++++++++++++++++++++++++++++++++++++++++++++++++.++++.---+.+++++++++++++.+++++.-------------------------------------------------------+---------------.+++++++++++++++.[-]>[-]+++++++++>[-]+++>>[-]>[-]<<<<<[->>>>>++<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<+<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]+>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-+<<+>>]<<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]+>>>]<<<[>[-]++++++++++++++++++++++++++++++++++++++++++++++>[-]<<<<<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<++++++++++++++++++++++++++++++++++++++++++++>]<<<[>>>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<<+->>>][-]++++++++++++++++>[-]++++++++++++++>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<+<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[+[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>++<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>+>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<<+++++>>>>]>[-]>[-+]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]+<<[-]+>>+>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<+]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<+[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<+[[-]<<<++++++++++>>>][-]>[-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<+<<<<<<<++>>>>>>>>][-]+++++++++++++++++++++++++<<<[-]>>[>>[-]<[->+<]>[-<+<<<+>>>>]<<-]+[-]<<[->>+<<]>>[-<<+<<+>>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<<<<<<<+<+>>>>->>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<<<<<<<<+>>>>->>>>]>[-]+>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-+]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]++>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>+>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>+]<<<[[-]<<<<----->>>>][-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<<<<<<<<<++>>>>>>->>>][-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>+>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[+-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->+>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<++>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]+>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<+<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>++<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>+>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[+-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>+]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-+<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->+>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<+[-]>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>>>]<<[-<<<<->>>>+]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>+>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]+<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[+[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>+[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<+<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>+>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->+[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]++>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[+-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<+<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<+<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[-+>>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<+]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.+>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]+<<]<<<<<<--------------------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>+>>[-<+<<<<<+>>>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<++>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>++<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]+>>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>+>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>+>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[+-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>+>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]+>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<++<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->+>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>+->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[+-]+>>]<]<]<<<]<<[-]>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>+>>]<<[-<<<<->>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[+[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[+->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]++>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>++<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>]+[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]++>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>+[[-<<<+>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-+<<<+<<+>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>]+[-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<+<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>+[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]+<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>+[-]+<[[-<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>+>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<++>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>+>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<++>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<[->>>>>>>>+<<<+<<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..+>>>-]<<<.>>>>>[-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>+][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[->>>>>>>+<<<<<+<<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>+[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>++<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]+>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<<<]>>>[-]<<<<+<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<<<<<<<[-]<[-]<[-]>>>>>>>>>>[-]<<<<<[->>>+>>+<<<<<]>>>>>[-<<<<<+<<<+>>>>>>>>][-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>]<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-+[<<<<+>>>>-]<<<<]<<[-]>>>[<<<+>>>-]<<[>>>>]><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<<<<<[->>>>>+<<<<+<]>>>>>[[-<<<<<+>>>>>]<<<<<->>>>>]<]<<<<<+>>[-]+>>[-]>[-]<<<<<[->>>>>+<<<<<]+>>>>>[-<+<<<<+>>>>>][-]++++++++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>+[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<+<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<+<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]+>>>]<<<]<<<[-]>[-]+>[-]++>[-]++++++++>[-]++>[-]+[>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++<<[-]>>>[-]>[+-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<-+>->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>+]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]+>>>]<<<[>[-+]<<<<<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]>[-]>[-]>[-]>>[-]>[-]<<<<<<<<<<[->>>+>>>>>>>+<<<<<<<<<<]>>>>>>>>>>[-<+<<<<<<<<<+>>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<+<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[+-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<+][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<[-]++>[-]+>>]>[-]>[-]<<<<<<<<<<[->>>>>>>>>>+<<<<<<<<<<]>>>>>>>>>>[-<+<<<<<<<<<+>+>>>>>>>>>][-]+++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]+>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[-+>>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->++<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<[-]+>>[-]+>][-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-+]>>[-]<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>[-]>[-<+<<<<<<<<<<<<<<+>>>>>>>>>>>>>>+>]<[<+>-]>[-]<<<<<<<<<<<<<<[->>>>>>>>>>>>>>+<<+<<<<<<<<<<<<]>>>>>>>>>>>>>[-]>[-<<<<<<<<<<<<<<+>>>>>>>>>>>>>+>]<[<+++>-]>[-]+<<<<<<<<<<<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>[-]>[-<<<<<<<<<<<<<+>+>>>>>>>>>>>+>]<[<+++++++++>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<[-]<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>[-]<<[->>+<<]>>[-<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>][-]<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>+<<<<<<<<<+<<<<<<<]>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<<<<+>>>>-]<<<<]<<[-]>>>[<<<+>>+>-]<<[>>>>]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-]>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>[-]<<<<<<<<<<<<[->>>>>>>>>>>>+<<<<<<<<<<<<]>>>>>>>>>>>>[-<+<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>][-]<<<<<<<<<<<<<<<+<[->>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<+<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]+<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<<<<+>>>>-]<<<<]<<[-]>>>[<<<+>>>-]<<[>>>>]>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<+<<]>>>>>>>>>>>[-<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>][-]<<+<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>[-<<<<<<<<+<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<+<<<+>>>>-]<<<<]<<[-]>>>[<<<+>>>-]<<[>>>>]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>+>>>>>>>>>>>>>][-]<<[->>+<<]>>[[-<<+>>]>[-]<<<<<<<<<<<<[->>>>+>>>>>>>>+<<<<<<<<<<<<]>>>>>[-]>>>>>>>[-<<<<<<<<<<<<+>>>>>+>>>>>>>][-]<<<<<<<+<<<<[->>>>>>>>>>>+<<<<<<<<<<<]<[-]>>>>>>>>>>>>[-<<<<<<<<<<<+<+>>>>>>>>>>>>][+-]<<<<<<<[->>>>>>>+<<<<<<<]<<<<[-]>>>>>>>>>>>[-<<<<<<<+<<<<+>>>>>>>>>>>]<<<<+<<<<<<->[-]>+>>>>>>>][-]<[->+<]>[[-<+>]>[-]<<<<<<<<<<<<[->>>>>>>>>>>>+<<<<<<+<<<<<<]>>>>>[-]>>>>>>>[-<<<<<<<<<<<<+>>>>>+>>>>>>>][-]<<<<<<<<<<<<<[->>>>>>>+>>>>>>+<<<<<<<<<<<<<]>[-]>>>>>>>>>>>>[-<<<<<<<<<<<<<+>+>>>>>>>>>>>>][-]<<<<<+<<[->>>>>>>+<<<<<<<]<<<<<<[-]>>>>>>>>>>>>>[-<<<<<<<+<<<<<<+>>>>>>>>>>>>>]<<<+<<<<<<<->[-]>+>>>>>>>]<<<<]>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<+<<<<<+>>>+>>>][-]++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<+<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<+]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-+<+>]<<<[-]>>>]<<<[[-]>>>>[-]++>>[-]>[-]<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>+<<<<+<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>][-]<<[-]+>>>[-+]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[+<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]++>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-+]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>[-]>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>]<]>[-]>[-]<<<<<<<<<<<<<<<[-+>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<+>>>>>>>>>>+>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-+<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<+<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[+-<+>]<<<[-]>>>]<<<[[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>[-<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>+>>>>]<]>[-]>[-]<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>+<<<+<<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>][-]++<<[-]+>>+>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<+]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<+[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<+[[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>[-]>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>]<]>[-]+>[-]<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<+<<<<<<<<<<+>>>>>>>>>>>>>>>][-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-+]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<++>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<+[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-]>>>+>>>>>>>>>>[-]>>>>>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<+<<<[<<<[-]<[-]<[-]+>>>>>-[<<<<+>>>>-]<<<<]<<[->>+>+<<<]>>[-<<+>>]<[>>[->>>>++<<<<]<<>>>>]>>[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<<<<+<<<[->>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<+>>>>>+>>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>+>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->+>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->++<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-]>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>[-]>>>>>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>-[<<<<+>>>>-]+<<<<]<<[->>+>+<<<]>>[-<<+>>]<[>>[->>>>+<<<<]<<>>>>]>>[->>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>][-]++<<[+-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]++>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>+>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>+>]<<<[[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-+]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>[-]<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>-[<<<<+>>>>-]<<<<]<<+[->>+>+<<<]>>[-<<+>>]<[>>[->>>>+<<<<]<<>>>>]>>[->>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<+<<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>>[-<+<<<<<<<<<<<<+>>>>>>>>>>>>+>][-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>+>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>+[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]+<<<[-]>>>]<<<[[-]<<<<<<<<<<<<<<<[-]<[-]<[-]>>>>>>>>>>>>>>>>>>[-]<<<<<[->>>>>++<<<<<]>>>>>[-<<<<<+<<<<<<<<<<<+>>>>>>>>>>>>>>>>][-]<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>+>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<<<<++>>>>-]<<<<]<<[-]>>>[<<<+>>>-]<<[>>>>]><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<<+<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>>[-<+<<<<<<<<<<<<+>>>>>>>>>>>>>+][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>+>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>+[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]+<<<[-]>>>]<<<[[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]+<<<<<[->>>>>+<<<<<]>>>>>[-<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>][-]+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<<<<+>>>>-]<<<<+]<<[-]>>>[<<<+>>>-]<<[>>>>]><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<<<<<[+->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>>[-<+<<<<<<<<<<<<+>>>>>>>>>>>>>][-]+++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]+<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-+<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<+[-]>>>]<<<[[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]<[-+]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<<<<<[->>+>>>+<<<<<]>>>>>[-<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<++>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>][-]<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-]<-[<<<<+>>>>-]<<+<<]<<[-]>>>[<<<+>>>-]<<[>>>>]><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>]>[-]>[-]<<<<<<<<<<<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>+>>>[-<+<<<<<<<<<<<<+>>>>>>>>>>>>>][-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<++>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>+>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<++>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>[-<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>+>>>]<]>[-]>[-]<<<<<<<<<<<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>+>>>>>>>>>>>[-<+<<<<<<<<<<<<+>>>>>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>+>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->+>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<+<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]>[-]<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>[-]>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>]<]>[-]>[-]+<<<<<<<<<<<<<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>>[-<+<<<<<<<<<<<<+>>>+>>>>>>>>>>][-]++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]+>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[-+>>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->++<]>[[-<+>]<<<[-]>>>]<<<[[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>+>>>]<]<[->>>>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]>>[-]<<+<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>[-]>>>>+>[-<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>+>>>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>+>[-]>>>>[-<<<<<<<<+>>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++>>-<]>[[-+]>[-]<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<]>>>>>>>>>>>[-]>>>>>+[-<<<<<<<<<<<<<<<<+>>>>>>>>>>>+>>>>>][-]<<<<<<<[->>>>>>>+<<<<<<<]>>>[-]>>>>[+-<<<<<<<+>>>+>>>>]<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>]<[-]++++++++++++++++>[-]+++++++++++++++>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][+-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]+<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-+<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<+[-]>>>]<<<[[-]<<<<+++++>>>>]>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>+[-<+<<<<<<<<+>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<+<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>+>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<++++++++++>>>][-]>[-]<<<<<<<<[->>>+>>>>>+<<<<<<<<]>>>>>>>>[-<+<<<<<<<+>>>>>>>>][-]+++++++++++++++++++++++++<<<[+-]>>[>>[-]<[->+<]>[-<+<<<+>>>>]<<-][-]<<[->>+<<]>>[-<<+<<+>>>>][-]<<<<<<<<<<+<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>][-]<<<<<<<<+<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>]>[-]>[-]<+<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-]+>>>+[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]+<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[+-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[+[-]<<<<----->>>>][-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<<<<<<+>>>->>>][-]++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>]>>>[-]>[-]<<<<<[->>>+>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>++>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<+[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]+>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<+<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>+[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[+-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<+]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<+<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<+<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<+<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>++<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>+>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<[-]>>>>>[-]<[->+<]>[[-<++>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>>>]<<[-<<<<->>>>]>]<<<[-]>[-]<<<<<[->>>+>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>+[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<++>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>+>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<+<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>+]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]+>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]+<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<+<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>++<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>+>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-+]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]+<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<+<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<--------------+------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<+<<<<<+>>>>>>]>>>[+-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->+>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]+>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>+[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>+]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->+>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-+]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<+<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[-+>>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<+<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>+>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<+<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<[-]>>>>+>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>>>]<<[-<<<<->>>>]>]<<<[+-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-+]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>+>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<++>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>+>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>+>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]+>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]+<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<+]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[-<<<->>+>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>+>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-+]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>+[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>+>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>+[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-+<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<+<<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][+-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>+>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>+>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<+]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>+>[-]>>[-<<<<<<<<<<<+>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]+<<<.>>>>>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>[-]>>[-<<<<<<<<<<<++>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[-+>>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<+[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-+]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]+[-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[+-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<+<<<]>[-]++++++++++.[-]+>[-]+>[-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<<[->>>+<<<]>>>[-<++<<+>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<+[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<+<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[+-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[+->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]+>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<+<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>++<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>+>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]+<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>+][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>+>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<+<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<+<<]<<[-]>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>>>]<<[-<<<<+->>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[+-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>+]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]+>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>++<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>+[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<+[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<+->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]+<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>+>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<+<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>+>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-+]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>+]<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>+>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>+>>>>]<<]<<<<<<--------------------------------.>[-]>[-]<<<<[->>>>+<<<<]>>>>[+-<+<<<+>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[+-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>+[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>+>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[+-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<+<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>+[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[-+>>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<+<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<++>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>+>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<+<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[+-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<+]<]<<<]<<[-]>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<+>>>>>>]<<[-+<<<<->>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<+<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<++>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<+<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[+->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>+>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]+<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<+[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<++>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<++>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>+[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<+[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]++>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[+-<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<+++++++++++++.<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[-]<-]<-]<<<<<]<<<<+>>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<+<<+>>>>>][-]++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>+>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->+>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]+>>>][-]<[->++<]>[[-<+>]<<<[-]+>>>]<<<]<<->>[-]<<[->>+<<]>>[[-<<+>>]<<<<<<<<-<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>+>>>>>>>>[-<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>-[<<<<+>+>>>-]<<<<]<<[->>+>+<<<]>>[-<<+>>]<[>>[->>>>+<<<<]<<>>>>]>>[->>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-]>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>[-]>>>>>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<<<<<<<<<+<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>+-[<<<<+>>>>-]<<<<]<<[->>+>+<<<]>>[-<<+>>]<[>>[->>>>+<<<<]<<>>>>]>>[->>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]<[-]<[-+]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>[-]<<<<<<<<<[+->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[-]<[-]<[-]+>>>+>>-[<<<<+>>>>-]<<<<]<<[->>+>+<<<]>>[-<<+>>]<[>>[->>>>+<<<<]<<>>>>]>>[->>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+[-]>[-]>>>>>>>[-]++++++++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>+>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>+[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<+<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[->+<]>[[-<+>]<<<[-]++>>>]<<<[<<<<<<<<--------->>+>>>>>>>[-]++++++++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>+>>+<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>+>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-+]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<+[->+<]>[[-<+>]<<<[-]+>>>]<<<]>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<+<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[+-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<+<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[->+<]>[[-<++>]<<<[-]+>>>]<<<[<<<<<<<<--->+>>>>>>>>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>++<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>++<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<+<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[-+>+<]>[[-<+>]<<<[-]+>>>]<<<]<<<<+>>>]<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+ parsers/Parsers/Brainfuck/inputs/helloworld.bf view
@@ -0,0 +1,22 @@+[Taken from https://esolangs.org/wiki/Brainfuck]++++++ +++++ initialize counter (cell #0) to 10+[ use loop to set the next four cells to 70/100/30/10+ > +++++ ++ add 7 to cell #1+ > +++++ +++++ add 10 to cell #2+ > +++ add 3 to cell #3+ > + add 1 to cell #4+ <<<< - decrement counter (cell #0)+]+> ++ . print 'H'+> + . print 'e'++++++ ++ . print 'l'+. print 'l'++++ . print 'o'+> ++ . print ' '+<< +++++ +++++ +++++ . print 'W'+> . print 'o'++++ . print 'r'+----- - . print 'l'+----- --- . print 'd'+> + . print '!'+> . print '\n'
+ parsers/Parsers/Brainfuck/inputs/helloworld_golfed.bf view
@@ -0,0 +1,1 @@+++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
+ parsers/Parsers/Nandlang.hs view
@@ -0,0 +1,130 @@+{-# LANGUAGE DeriveLift #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE NoMonomorphismRestriction #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE UnboxedTuples #-}+module Parsers.Nandlang where++import Data.Bool+import Data.Char (isSpace, isAlpha, isAlphaNum)+import Data.Char (Char)+import Data.Eq (Eq(..))+import Data.Ord (Ord(..))+import Data.String (String)+import qualified Data.Set as Set+import qualified Data.Text as Text++import qualified Symantic.Parser as P+import qualified Symantic.Typed.Lang as Prod++type Parser a = P.Parser Text.Text a++nandIdentStart :: Char -> Bool+nandIdentStart c = isAlpha c || c == '_'++nandIdentLetter :: Char -> Bool+nandIdentLetter c = isAlphaNum c || c == '_'++nandUnreservedName :: String -> Bool+nandUnreservedName = \s -> not (Set.member s keys)+ where+ keys = Set.fromList ["if", "else", "while", "function", "var"]++nandStringLetter :: Char -> Bool+nandStringLetter c = (c /= '"') && (c /= '\\') && (c > '\026')++grammar :: forall repr.+ P.Grammarable Char repr =>+ repr ()+grammar = whitespace P.*> P.skipMany funcdef P.<* P.eof+ where+ literal :: repr ()+ literal = bit P.<|> charLit+ bit :: repr ()+ bit = (P.char '0' P.<|> P.char '1') P.*> whitespace+ charLit :: repr ()+ charLit = P.between (P.char '\'') (symbol '\'') charChar+ charChar :: repr ()+ charChar = P.void (P.satisfy+ (P.production nandStringLetter [||nandStringLetter||])) P.<|> esc+ esc :: repr ()+ esc = P.char '\\' P.*> P.void (P.oneOf "0tnvfr")+ expr :: repr ()+ expr = nandexpr P.*> P.skipMany (symbol '!' P.*> nandexpr)+ nandexpr :: repr ()+ nandexpr = literal P.<|> funccallOrVar+ funccallOrVar :: repr ()+ funccallOrVar = identifier P.*> P.optional (parens exprlist P.<|> index)+ identifier :: repr ()+ identifier = P.try (identStart P.*> P.skipMany identLetter) P.*> whitespace+ identStart = P.satisfy+ (P.production nandIdentStart [||nandIdentStart||])++ exprlist = commaSep expr+ exprlist1 = commaSep1 expr+ varlist = commaSep variable+ varlist1 = commaSep1 variable+ variable :: repr ()+ variable = identifier P.*> P.optional index+ index :: repr ()+ index = brackets nat+ nat :: repr ()+ nat = decimal+ decimal :: repr ()+ decimal = number (P.oneOf ['0'..'9'])+ number :: repr a -> repr ()+ number digit = P.skipSome digit++ funcdef = keyword "function" P.*> identifier P.*> parens funcparam P.*> block+ funcparam = varlist P.*> P.optional (symbol ':' P.*> varlist)+ block = braces (P.skipMany statement)+ statement =+ ifstmt P.<|> whilestmt P.<|> P.try varstmt P.<|> expr P.<* semi+ -- P.pure Prod.unit+ ifstmt = keyword "if" -- P.*> expr P.*> block P.*> P.optional (keyword "else" P.*> block)+ whilestmt = keyword "while" P.*> expr P.*> block+ varstmt = P.optional (keyword "var") P.*> varlist1 P.*> symbol '=' P.*> exprlist1 P.<* semi+ keyword :: String -> repr ()+ keyword k = P.string k P.*> P.pure Prod.unit+ {-+ keyword s = P.try (P.string s P.*> notIdentLetter) P.*> whitespace+ notIdentLetter = P.negLook identLetter+ -}+ identLetter = P.satisfy+ (P.production nandIdentLetter [||nandIdentLetter||])++ -- hexadecimal = P.oneOf "xX" P.*> number (P.oneOf (['a'..'f'] <> ['A'..'F'] <> ['0'..'9']))+ -- octal = P.oneOf "oO" P.*> number (P.oneOf ['0'..'7'])++ symbol :: Char -> repr Char+ symbol c = P.char c P.<* whitespace+ parens :: repr a -> repr a+ parens = P.between (symbol '(') (symbol ')')+ brackets :: repr a -> repr a+ brackets = P.between (symbol '[') (symbol ']')+ braces :: repr a -> repr a+ braces = P.between (symbol '{') (symbol '}')+ semi :: repr Char+ semi = symbol ';'+ comma :: repr Char+ comma = symbol ','+ commaSep :: repr a -> repr ()+ commaSep p = P.optional (commaSep1 p)+ commaSep1 :: repr a -> repr ()+ commaSep1 p = p P.*> P.skipMany (comma P.*> p)++ space :: repr ()+ space = P.void (P.satisfy (P.production isSpace [||isSpace||]))+ whitespace :: repr ()+ whitespace = spaces+ {-+ whitespace = P.skipMany (spaces P.<|> oneLineComment)+ oneLineComment :: repr ()+ oneLineComment = P.void (P.string "//" P.*> P.skipMany (P.satisfy+ (P.production (/= '\n') [||(/= '\n')||])))+ -}+ spaces :: repr ()+ spaces = P.skipSome space
+ parsers/Parsers/Playground.hs view
@@ -0,0 +1,15 @@+{-# LANGUAGE NoMonomorphismRestriction #-}+{-# LANGUAGE TemplateHaskell #-}+module Parsers.Playground where++import Symantic.Parser+import qualified Symantic.Typed.Lang as Prod++boom :: CombApplicable repr => repr ()+boom =+ let foo = (-- newRegister_ unit (\r0 ->+ let goo = (-- newRegister_ unit (\r1 ->+ let hoo = {-get r0 <~> get r1 *>-} goo *> hoo in hoo+ ) *> goo+ in goo) *> pure Prod.unit+ in foo *> foo
+ parsers/Parsers/Utils.hs view
@@ -0,0 +1,25 @@+module Parsers.Utils+ ( module Parsers.Utils+ , w2c+ )+ where++import Data.Char (Char)+import Data.Function ((.), id)+import Data.Word (Word8)+import Prelude (Enum(..))+import Data.ByteString.Internal (w2c, c2w)++-- * Class 'CoerceEnum'+-- | Convenient helper to write generic grammars+-- consuming either 'Word8' or 'Char'.+class CoerceEnum a b where+ coerceEnum :: a -> b+ default coerceEnum :: Enum a => Enum b => a -> b+ coerceEnum = toEnum . fromEnum+instance CoerceEnum Word8 Char where+ coerceEnum = w2c+instance CoerceEnum Char Word8 where+ coerceEnum = c2w+instance CoerceEnum Char Char where+ coerceEnum = id
+ parsers/Parsers/Utils/Attoparsec.hs view
@@ -0,0 +1,107 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+module Parsers.Utils.Attoparsec where++import Control.Applicative hiding (some)+import Control.Monad (Monad(..), MonadPlus)+import Data.Attoparsec.Combinator+import Data.Bool (Bool(..))+import Data.Char (Char)+import Data.Either (Either(..))+import Data.Eq (Eq(..))+import Data.Function (flip, ($), id)+import Data.Functor (void)+import Data.Maybe (Maybe(..), maybe)+import Data.String (String)+import Data.Word (Word8)+import qualified Data.List as List+import qualified Data.Text as T+import qualified Data.ByteString as BS+import qualified Data.Attoparsec.Internal.Types as AP+import qualified Data.Attoparsec.ByteString as AP.ByteString+import qualified Data.Attoparsec.ByteString.Char8 as AP.ByteString.Char8+import qualified Data.Attoparsec.Text as AP.Text++-- * Class 'Inputable'+class AP.Chunk inp => Inputable inp where+ type Token inp+ null :: inp -> Bool+ empty :: inp+ uncons :: inp -> Maybe (Token inp, inp)+ satisfy :: (Token inp -> Bool) -> AP.Parser inp (Token inp)+ char :: Char -> AP.Parser inp Char+ notInClass :: String -> Token inp -> Bool+instance Inputable T.Text where+ type Token T.Text = Char+ null = T.null+ empty = T.empty+ uncons = T.uncons+ satisfy = AP.Text.satisfy+ char = AP.Text.char+ notInClass = AP.Text.notInClass+instance Inputable BS.ByteString where+ type Token BS.ByteString = Word8+ null = BS.null+ empty = BS.empty+ uncons = BS.uncons+ satisfy = AP.ByteString.satisfy+ char = AP.ByteString.Char8.char+ notInClass = AP.ByteString.notInClass++between :: Applicative f => f a -> f b -> f c -> f c+between o c p = o *> p <* c++match :: (Monad m, Eq a) => [a] -> m a -> (a -> m b) -> m b -> m b+match xs p f def = p >>= (\x -> if List.elem x xs then f x else def)++skipSome :: Alternative p => p a -> p ()+skipSome p = void (some p)++some :: Alternative p => p a -> p [a]+some = many1++maybeP :: Alternative p => p a -> p (Maybe a)+maybeP p = option Nothing (Just <$> p)++fromMaybeP :: Monad m => m (Maybe a) -> m a -> m a+fromMaybeP mmx d = mmx >>= maybe d return++(<+>) :: Alternative p => p a -> p b -> p (Either a b)+p <+> q = Left <$> p <|> Right <$> q++(<:>) :: Applicative p => p a -> p [a] -> p [a]+(<:>) = liftA2 (:)++(<~>) :: Applicative p => p a -> p b -> p (a, b)+(<~>) = liftA2 (,)++pfoldl1 :: Alternative p => (b -> a -> b) -> b -> p a -> p b+pfoldl1 f k p = List.foldl' f k <$> some p++(>?>) :: MonadPlus m => m a -> (a -> Bool) -> m a+m >?> f = m >>= \x -> if f x then return x else Control.Applicative.empty++chainPre :: Alternative p => p (a -> a) -> p a -> p a+chainPre op p = flip (List.foldr ($)) <$> many op <*> p++chainPost :: Alternative p => p a -> p (a -> a) -> p a+chainPost p op = List.foldl' (flip ($)) <$> p <*> many op++chainl1 :: Alternative p => p a -> p (a -> a -> a) -> p a+chainl1 p op = chainPost p (flip <$> op <*> p)++chainr1 :: Alternative p => p a -> p (a -> a -> a) -> p a+chainr1 p op = let go = p <**> ((flip <$> op <*> go) <|> pure id) in go++data Level p s a+ = InfixL [p (a -> a -> a)]+ | InfixR [p (a -> a -> a)]+ | Prefix [p (a -> a)]+ | Postfix [p (a -> a)]++precedence :: Alternative p => [Level p s a] -> p a -> p a+precedence levels atom = List.foldl' convert atom levels+ where+ convert x (InfixL ops) = chainl1 x (choice ops)+ convert x (InfixR ops) = chainr1 x (choice ops)+ convert x (Prefix ops) = chainPre (choice ops) x+ convert x (Postfix ops) = chainPost x (choice ops)
+ parsers/Parsers/Utils/Attoparsec/Text.hs view
@@ -0,0 +1,20 @@+module Parsers.Utils.Attoparsec.Text+ ( module Parsers.Utils.Attoparsec.Text+ , module Data.Attoparsec.Text+ ) where++import Data.Attoparsec.Combinator+import Data.Attoparsec.Text+import Data.Char (Char)+import Data.Function ((.))+import Data.Text (Text)+import qualified Data.Attoparsec.Text as AP.Text++token :: Text -> AP.Text.Parser Text+token = try . AP.Text.string++oneOf :: [Char] -> AP.Text.Parser Char+oneOf = AP.Text.satisfy . AP.Text.inClass++noneOf :: [Char] -> AP.Text.Parser Char+noneOf = AP.Text.satisfy . AP.Text.notInClass
+ parsers/Parsers/Utils/Handrolled.hs view
@@ -0,0 +1,26 @@+{-# LANGUAGE TypeFamilies #-}+module Parsers.Utils.Handrolled where++import Data.Bool (Bool)+import Data.Char (Char)+import Data.Maybe (Maybe(..))+import Data.Word (Word8)+import qualified Data.ByteString as BS+import qualified Data.Text as T++-- * Class 'Inputable'+class Inputable inp where+ type Token inp+ null :: inp -> Bool+ empty :: inp+ uncons :: inp -> Maybe (Token inp, inp)+instance Inputable T.Text where+ type Token T.Text = Char+ null = T.null+ empty = T.empty+ uncons = T.uncons+instance Inputable BS.ByteString where+ type Token BS.ByteString = Word8+ null = BS.null+ empty = BS.empty+ uncons = BS.uncons
+ src/Language/Haskell/TH/HideName.hs view
@@ -0,0 +1,135 @@+-- | This module enables to 'hideName'+-- to get reproductible dumps of TemplateHaskell slices.+module Language.Haskell.TH.HideName where++import Data.Functor ((<$>))+import Language.Haskell.TH+import Language.Haskell.TH.Syntax+import Prelude (undefined)++class HideName a where+ -- | Map all 'Name's to a constant in order to overcome+ -- cases where resetting 'TH.counter' is not enough+ -- to get deterministic 'TH.Name's.+ hideName :: a -> a+instance HideName Body where+ hideName (GuardedB gs) = GuardedB ((\(g, e) -> (hideName g, hideName e)) <$> gs)+ hideName (NormalB e) = NormalB (hideName e)+instance HideName Clause where+ hideName (Clause ps b ds) = Clause (hideName <$> ps) (hideName b) (hideName <$> ds)+instance HideName Dec where+ hideName (FunD f cs) = FunD (hideName f) (hideName <$> cs)+ hideName (ValD p r ds) = ValD (hideName p) (hideName r) (hideName <$> ds)+ -- Other alternatives are not used by Symantic.Parser, hence don't bother.+ hideName _ = undefined+instance HideName Exp where+ hideName (AppE e1 e2) = AppE (hideName e1) (hideName e2)+ hideName (AppTypeE e t) = AppTypeE (hideName e) (hideName t)+ hideName (ArithSeqE d) = ArithSeqE (hideName d)+ hideName (CaseE e ms) = CaseE (hideName e) (hideName <$> ms)+ hideName (CompE ss) = CompE (hideName <$> ss)+ hideName (ConE c) = ConE (hideName c)+ hideName (CondE guard true false) = CondE (hideName guard) (hideName true) (hideName false)+ hideName (DoE m ss) = DoE (hideName <$> m) (hideName <$> ss)+ hideName (ImplicitParamVarE n) = ImplicitParamVarE n+ hideName (InfixE e1 op e2) = InfixE (hideName <$> e1) (hideName op) (hideName <$> e2)+ hideName (LabelE s) = LabelE s+ hideName (LamCaseE ms) = LamCaseE (hideName <$> ms)+ hideName (LamE ps e) = LamE (hideName <$> ps) (hideName e)+ hideName (LetE ds e) = LetE (hideName <$> ds) (hideName e)+ hideName (ListE es) = ListE (hideName <$> es)+ hideName (LitE l) = LitE l+ hideName (MDoE m ss) = MDoE (hideName <$> m) (hideName <$> ss)+ hideName (MultiIfE alts) = MultiIfE ((\(g, e) -> (hideName g, hideName e)) <$> alts)+ hideName (ParensE e) = ParensE (hideName e)+ hideName (RecConE nm fs) = RecConE (hideName nm) ((\(n, e) -> (hideName n, hideName e)) <$> fs)+ hideName (RecUpdE e fs) = RecUpdE (hideName e) ((\(n, ee) -> (hideName n, hideName ee)) <$> fs)+ hideName (SigE e t) = SigE (hideName e) (hideName t)+ hideName (StaticE e) = StaticE (hideName e)+ hideName (TupE es) = TupE ((hideName <$>) <$> es)+ hideName (UInfixE e1 op e2) = UInfixE (hideName e1) (hideName op) (hideName e2)+ hideName (UnboundVarE v) = UnboundVarE (hideName v)+ hideName (UnboxedSumE e alt arity) = UnboxedSumE (hideName e) alt arity+ hideName (UnboxedTupE es) = UnboxedTupE ((hideName <$>) <$> es)+ hideName (VarE v) = VarE (hideName v)+instance HideName Guard where+ hideName (NormalG e) = NormalG (hideName e)+ hideName (PatG ss) = PatG (hideName <$> ss)+instance HideName Lit where+ hideName x = x+instance HideName Match where+ hideName (Match p b ds) = Match (hideName p) (hideName b) (hideName <$> ds)+instance HideName ModName where+ hideName (ModName n) = ModName n+instance HideName Name where+ -- This is the hidding+ hideName (Name (OccName on) (NameU _u)) = Name (OccName on) NameS+ hideName (Name (OccName on) (NameL _u)) = Name (OccName on) NameS+ hideName (Name on n) = Name (hideName on) (hideName n)+instance HideName NameFlavour where+ hideName (NameG n p m) = NameG n p m+ hideName (NameL n) = NameL n+ hideName (NameQ n) = NameQ n+ hideName NameS = NameS+ hideName (NameU n) = NameU n+instance HideName OccName where+ hideName (OccName n) = OccName n+instance HideName Range where+ hideName (FromR e) = FromR (hideName e)+ hideName (FromThenR f t) = FromThenR (hideName f) (hideName t)+ hideName (FromToR f t) = FromToR (hideName f) (hideName t)+ hideName (FromThenToR f t to) = FromThenToR (hideName f) (hideName t) (hideName to)+instance HideName Stmt where+ hideName (BindS p e) = BindS (hideName p) (hideName e)+ hideName (LetS ds) = LetS (hideName <$> ds)+ hideName (NoBindS e) = NoBindS (hideName e)+ hideName (ParS ss) = ParS ((hideName <$>) <$> ss)+ hideName (RecS ss) = RecS (hideName <$> ss)+instance HideName (TyVarBndr f) where+ hideName (PlainTV n f) = PlainTV (hideName n) f+ hideName (KindedTV n f k) = KindedTV (hideName n) f (hideName k)+instance HideName Type where+ hideName (ForallT vs ctx t) = ForallT (hideName <$> vs) (hideName <$> ctx) (hideName t)+ hideName (ForallVisT vs t) = ForallVisT (hideName <$> vs) (hideName t)+ hideName (AppT t x) = AppT (hideName t) (hideName x)+ hideName (AppKindT t k) = AppKindT (hideName t) (hideName k)+ hideName (SigT t k) = SigT (hideName t) (hideName k)+ hideName (VarT n) = VarT (hideName n)+ hideName (ConT n) = ConT (hideName n)+ hideName (PromotedT n) = PromotedT (hideName n)+ hideName (InfixT x n y) = InfixT (hideName x) (hideName n) (hideName y)+ hideName (UInfixT x n y) = UInfixT (hideName x) (hideName n) (hideName y)+ hideName (ParensT t) = ParensT (hideName t)+ hideName (TupleT x) = TupleT x+ hideName (UnboxedTupleT x) = UnboxedTupleT x+ hideName (UnboxedSumT x) = UnboxedSumT x+ hideName (ArrowT) = ArrowT+ hideName (MulArrowT) = MulArrowT+ hideName (EqualityT) = EqualityT+ hideName (ListT) = ListT+ hideName (PromotedTupleT x) = PromotedTupleT x+ hideName (PromotedNilT) = PromotedNilT+ hideName (PromotedConsT) = PromotedConsT+ hideName (StarT) = StarT+ hideName (ConstraintT) = ConstraintT+ hideName (LitT t) = LitT t+ hideName (WildCardT) = WildCardT+ hideName (ImplicitParamT n t) = ImplicitParamT n (hideName t)+instance HideName Pat where+ hideName (AsP v p) = AsP (hideName v) (hideName p)+ hideName (BangP p) = BangP (hideName p)+ hideName (ConP s ps) = ConP (hideName s) (hideName <$> ps)+ hideName (InfixP p1 n p2) = InfixP (hideName p1) (hideName n) (hideName p2)+ hideName (ListP ps) = ListP (hideName <$> ps)+ hideName (LitP l) = LitP (hideName l)+ hideName (ParensP p) = ParensP (hideName p)+ hideName (RecP nm fs) = RecP (nm) ((\(n,p) -> (hideName n, hideName p)) <$> fs)+ hideName (SigP p t) = SigP (hideName p) (hideName t)+ hideName (TildeP p) = TildeP (hideName p)+ hideName (TupP ps) = TupP (hideName <$> ps)+ hideName (UInfixP p1 n p2) = UInfixP (hideName p1) (hideName n) (hideName p2)+ hideName (UnboxedSumP p alt arity) = UnboxedSumP (hideName p) alt arity+ hideName (UnboxedTupP ps) = UnboxedTupP (hideName <$> ps)+ hideName (VarP v) = VarP (hideName v)+ hideName (ViewP e p) = ViewP (hideName e) (hideName p)+ hideName WildP = WildP
+ src/Language/Haskell/TH/Show.hs view
@@ -0,0 +1,42 @@+{-# OPTIONS_GHC -Wno-missing-methods #-} -- For TH.Quasi+-- | This module enables to 'showCode'+-- without requiring to be in 'IO'.+module Language.Haskell.TH.Show where++import Data.Function (($), (.))+import Data.String (String)+import Prelude (Integer, error, succ)+import Control.Applicative (Applicative(..))+import Control.Monad (Monad(..))+import Data.Functor (Functor)+import qualified Control.Monad as CM+import qualified Control.Monad.IO.Class as CM+import qualified Control.Monad.Trans.State as MT+import qualified Language.Haskell.TH as TH+import qualified Language.Haskell.TH.Syntax as TH+import qualified Language.Haskell.TH.Ppr as TH+import qualified Language.Haskell.TH.PprLib as TH+import qualified Text.PrettyPrint as Doc++newtype ShowQ a = ShowQ { unShowQ :: MT.State Integer a }+ deriving (Functor, Applicative, Monad)++runShowQ :: ShowQ a -> a+runShowQ = (`MT.evalState` 0) . unShowQ++showCode :: TH.Precedence -> TH.CodeQ a -> String+showCode p q = runShowQ $ do+ texp <- TH.runQ (TH.examineCode q)+ return $ Doc.render $ TH.to_HPJ_Doc $ TH.pprExp p $ TH.unType texp++-- | The whole point of ShowQ is to remove the need for IO,+-- but GHC's 'TH.Quasi' class forces it...+instance CM.MonadIO ShowQ+instance CM.MonadFail ShowQ where+ fail = error+-- | Only 'TH.qNewName' is needed and thus implemented.+instance TH.Quasi ShowQ where+ qNewName n = ShowQ $ do+ i <- MT.get+ MT.put (succ i)+ return (TH.mkNameU n i)
src/Symantic/Parser.hs view
@@ -1,28 +1,25 @@-{-# LANGUAGE TemplateHaskell #-} module Symantic.Parser ( module Symantic.Parser.Grammar , module Symantic.Parser.Machine , module Symantic.Parser ) where -import Data.Either (Either(..))-import Data.Ord (Ord)+import Data.Either (Either)+import Data.Function (($)) import Language.Haskell.TH (CodeQ)-import Text.Show (Show)-import Type.Reflection (Typeable) import qualified Language.Haskell.TH.Syntax as TH import Symantic.Parser.Grammar import Symantic.Parser.Machine +-- * Type 'Parser'+type Parser inp a = Machine Gen inp a+ runParser :: forall inp a.- Ord (InputToken inp) =>- Show (InputToken inp) =>- TH.Lift (InputToken inp) =>- Typeable (InputToken inp) =>- -- InputToken inp ~ Char =>- Input inp =>- Readable (InputToken inp) Gen =>+ Inputable inp =>+ Machinable (InputToken inp) Gen => Parser inp a -> CodeQ (inp -> Either (ParsingError inp) a)-runParser p = [|| \input -> $$(generateCode [||input||] (machine p)) ||]+runParser p = TH.Code $ do+ mach <- TH.runIO $ machine p+ TH.examineCode $ generateCode mach
src/Symantic/Parser/Grammar.hs view
@@ -1,43 +1,55 @@ {-# LANGUAGE AllowAmbiguousTypes #-} -- For grammar-{-# LANGUAGE ConstraintKinds #-} -- For Grammar+{-# LANGUAGE ConstraintKinds #-} -- For Grammarable module Symantic.Parser.Grammar ( module Symantic.Parser.Grammar , module Symantic.Parser.Grammar.Combinators- , module Symantic.Parser.Grammar.Fixity , module Symantic.Parser.Grammar.Optimize , module Symantic.Parser.Grammar.ObserveSharing+ , module Symantic.Parser.Grammar.Production , module Symantic.Parser.Grammar.Write , module Symantic.Parser.Grammar.View , Letable(..)+ , Letsable(..) ) where import Symantic.Parser.Grammar.Combinators-import Symantic.Parser.Grammar.View-import Symantic.Parser.Grammar.Fixity import Symantic.Parser.Grammar.ObserveSharing import Symantic.Parser.Grammar.Optimize+import Symantic.Parser.Grammar.Production+import Symantic.Parser.Grammar.View import Symantic.Parser.Grammar.Write +import Control.DeepSeq (NFData)+import Data.Eq (Eq)+import Data.Ord (Ord) import Data.Function ((.)) import Data.String (String)+import Data.Typeable (Typeable) import Text.Show (Show(..)) import qualified Language.Haskell.TH.Syntax as TH --- * Class 'Grammar'-type Grammar tok repr =- ( Applicable repr- , Alternable repr- , Satisfiable tok repr+-- * Class 'Grammarable'+type Grammarable tok repr =+ ( CombAlternable repr+ , CombApplicable repr+ , CombFoldable repr , Letable TH.Name repr- , Selectable repr- , Matchable repr- , Foldable repr- , Lookable repr+ , Letsable TH.Name repr+ , CombLookable repr+ , CombMatchable repr+ , CombSatisfiable tok repr+ , CombSelectable repr+ , Eq tok+ , Ord tok+ , TH.Lift tok+ , NFData tok+ , Show tok+ , Typeable tok ) -- | A usual pipeline to interpret 'Comb'inators: -- 'observeSharing' then 'optimizeGrammar' then a polymorphic @(repr)@. grammar ::- Grammar tok repr =>+ Grammarable tok repr => ObserveSharing TH.Name (OptimizeGrammar repr) a -> repr a@@ -45,8 +57,9 @@ -- | An usual pipeline to show 'Comb'inators: -- 'observeSharing' then 'optimizeGrammar' then 'viewGrammar' then 'show'.-showGrammar ::- ObserveSharing TH.Name- (OptimizeGrammar (ViewGrammar showName)) a ->- String-showGrammar = show . viewGrammar . optimizeGrammar . observeSharing+showGrammar :: forall showName a tok repr.+ repr ~ ObserveSharing TH.Name (OptimizeGrammar (ViewGrammar showName)) =>+ ShowLetName showName TH.Name =>+ Grammarable tok repr =>+ repr a -> String+showGrammar = show . viewGrammar . grammar @tok
src/Symantic/Parser/Grammar/Combinators.hs view
@@ -1,502 +1,666 @@ -- The default type signature of type class methods are changed--- to introduce a Liftable constraint and the same type class but on the 'Output' repr,+-- to introduce a 'LiftDerived'* constraint and the same type class but on the 'Derived' repr, -- this setup avoids to define the method with boilerplate code when its default--- definition with lift* and 'trans' does what is expected by an instance+-- definition with 'liftDerived'* and 'derive' does what is expected by an instance -- of the type class. This is almost as explained in: -- https://ro-che.info/articles/2016-02-03-finally-tagless-boilerplate {-# LANGUAGE DefaultSignatures #-}-{-# LANGUAGE DeriveLift #-} -- For TH.Lift (ErrorItem tok)-{-# LANGUAGE StandaloneDeriving #-} -- For Show (ErrorItem (InputToken inp))+{-# LANGUAGE DeriveGeneric #-} -- For NFData instances+{-# LANGUAGE DeriveAnyClass #-} -- For NFData instances+{-# LANGUAGE DeriveLift #-} -- For TH.Lift (Exception tok)+{-# LANGUAGE PatternSynonyms #-} -- For Failure+{-# LANGUAGE StandaloneDeriving #-} -- For Show (Exception (InputToken inp))+{-# LANGUAGE InstanceSigs #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE ViewPatterns #-} -- For unSomeFailure -- | Semantic of the grammar combinators used to express parsers, -- in the convenient tagless-final encoding. module Symantic.Parser.Grammar.Combinators where +import Data.Proxy (Proxy(..))+import Control.Monad (Monad(..))+import Control.DeepSeq (NFData(..))+import GHC.Generics (Generic)+-- import Data.Set (Set)+-- import GHC.TypeLits (KnownSymbol) import Data.Bool (Bool(..), not, (||)) import Data.Char (Char) import Data.Either (Either(..)) import Data.Eq (Eq(..))+import Data.Ord (Ord(..), Ordering(..)) import Data.Function ((.), flip, const) import Data.Int (Int)+import Data.Kind (Type, Constraint) import Data.Maybe (Maybe(..))-import Data.Ord (Ord)+import Data.Set (Set) import Data.String (String) import Text.Show (Show(..))+import Type.Reflection (Typeable, typeRep, eqTypeRep, (:~~:)(..), SomeTypeRep(..)) import qualified Data.Functor as Functor import qualified Data.List as List+import qualified Data.Set as Set import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH -import qualified Symantic.Univariant.Trans as Sym-import qualified Symantic.Parser.Haskell as H+import Symantic.Typed.Derive+import qualified Symantic.Typed.Lang as Prod+import Symantic.Parser.Grammar.Production --- * Type 'TermGrammar'-type TermGrammar = H.Term H.ValueCode+-- * Type 'ReprComb'+type ReprComb = Type -> Type --- * Class 'Applicable'+-- * Class 'CombAlternable'+class CombAlternable repr where+ -- | @('alt' es l r)@ parses @(l)@ and return its return value or,+ -- if it fails with an 'Exception' within @(es)@,+ -- parses @(r)@ from where @(l)@ has left the input stream,+ -- and returns its return value,+ -- otherwise throw the 'Exception' again.+ alt :: Exception -> repr a -> repr a -> repr a+ throw :: ExceptionLabel -> repr a+ -- | @('try' ra)@ records the input stream position,+ -- then parses like @(ra)@ and either returns its value it it succeeds or fails+ -- if it fails but with a reset of the input stream to the recorded position.+ -- Generally used on the first alternative: @('try' rl '<|>' rr)@.+ try :: repr a -> repr a+ default alt ::+ FromDerived2 CombAlternable repr =>+ Exception -> repr a -> repr a -> repr a+ default throw ::+ FromDerived CombAlternable repr =>+ ExceptionLabel -> repr a+ default try ::+ FromDerived1 CombAlternable repr =>+ repr a -> repr a+ alt = liftDerived2 . alt+ throw = liftDerived . throw+ try = liftDerived1 try++ failure :: SomeFailure -> repr a+ default failure ::+ FromDerived CombAlternable repr =>+ SomeFailure -> repr a+ failure = liftDerived . failure++ -- | @(empty)@ parses nothing, always failing to return a value.+ empty :: repr a+ empty = failure (SomeFailure FailureEmpty)++data instance Failure CombAlternable+ = FailureEmpty+ deriving (Eq, Ord, Show, TH.Lift, Generic, NFData)++-- ** Data family 'Failure'+-- | 'Failure's of the 'Grammar'.+-- This is an extensible data-type.+data family Failure+ (comb :: ReprComb -> Constraint)+ :: Type++{-+-- | Convenient utility to pattern-match a 'SomeFailure'.+pattern Failure :: Typeable comb => Failure comb -> SomeFailure+pattern Failure x <- (unSomeFailure -> Just x)+-}++-- ** Type 'SomeFailure'+data SomeFailure =+ forall comb.+ ( Eq (Failure comb)+ , Ord (Failure comb)+ , Show (Failure comb)+ , TH.Lift (Failure comb)+ , NFData (Failure comb)+ , Typeable comb+ ) =>+ SomeFailure (Failure comb {-repr a-})+instance Eq SomeFailure where+ SomeFailure (x::Failure x) == SomeFailure (y::Failure y) =+ case typeRep @x `eqTypeRep` typeRep @y of+ Just HRefl -> x == y+ Nothing -> False+instance Ord SomeFailure where+ SomeFailure (x::Failure x) `compare` SomeFailure (y::Failure y) =+ -- WARNING: this ordering is convenient to make a 'Set' of 'SomeFailure's+ -- but it is based upon a hash which changes with packages' ABI+ -- and also if the install is "inplace" or not.+ -- Therefore this 'Ord' is not stable enough to put 'SomeFailure'+ -- in golden tests.+ let xT = typeRep @x in+ let yT = typeRep @y in+ case SomeTypeRep xT `compare` SomeTypeRep yT of+ EQ | Just HRefl <- xT `eqTypeRep` yT -> compare x y+ o -> o+instance Show SomeFailure where+ showsPrec p (SomeFailure x) = showsPrec p x+instance TH.Lift SomeFailure where+ liftTyped (SomeFailure x) = [|| SomeFailure $$(TH.liftTyped x) ||]+instance NFData SomeFailure where+ rnf (SomeFailure x) = rnf x++{-+instance Derivable (SomeFailure repr) where+ derive (SomeFailure x) = derive x+-}++-- | @(unSomeFailure c :: 'Maybe' ('Failure' comb repr a))@+-- extract the data-constructor from the given 'SomeFailure'+-- iif. it belongs to the @('Failure' comb repr a)@ data-instance.+unSomeFailure :: forall comb. Typeable comb => SomeFailure -> Maybe (Failure comb)+unSomeFailure (SomeFailure (c::Failure c)) =+ case typeRep @comb `eqTypeRep` typeRep @c of+ Just HRefl -> Just c+ Nothing -> Nothing++-- ** Type 'Exception'+data Exception+ = ExceptionLabel ExceptionLabel+ | ExceptionFailure+ deriving (Eq, Ord, Show, TH.Lift, Generic, NFData)+type ExceptionLabel = String+-- type Exceptions = Set Exception++-- | Like @('<|>')@ but with different returning types for the alternatives,+-- and a return value wrapped in an 'Either' accordingly.+(<+>) :: CombApplicable repr => CombAlternable repr => repr a -> repr b -> repr (Either a b)+p <+> q = Prod.left <$> p <|> Prod.right <$> q++(<|>) :: CombAlternable repr => repr a -> repr a -> repr a+(<|>) = alt ExceptionFailure++infixl 3 <|>, <+>++optionally :: CombApplicable repr => CombAlternable repr => repr a -> Production b -> repr b+optionally p x = p $> x <|> pure x++optional :: CombApplicable repr => CombAlternable repr => repr a -> repr ()+optional = flip optionally Prod.unit++option :: CombApplicable repr => CombAlternable repr => Production a -> repr a -> repr a+option x p = p <|> pure x++choice :: CombAlternable repr => [repr a] -> repr a+choice = List.foldr (<|>) empty+ -- FIXME: Here hlint suggests to use Data.Foldable.asum,+ -- but at this point there is no asum for our own (<|>)++maybeP :: CombApplicable repr => CombAlternable repr => repr a -> repr (Maybe a)+maybeP p = option Prod.nothing (Prod.just <$> p)++manyTill :: CombApplicable repr => CombAlternable repr => repr a -> repr b -> repr [a]+manyTill p end = let go = end $> Prod.nil <|> p <:> go in go++-- * Class 'CombApplicable' -- | This is like the usual 'Functor' and 'Applicative' type classes--- from the @base@ package, but using @('TermGrammar' a)@ instead of just @(a)@--- to be able to use and pattern match on some usual terms of type @(a)@ (like 'H.id')+-- from the @base@ package, but using @('Production' a)@ instead of just @(a)@+-- to be able to use and pattern match on some usual terms of type @(a)@ (like 'Prod.id') -- and thus apply some optimizations. -- @(repr)@, for "representation", is the usual tagless-final abstraction -- over the many semantics that this syntax (formed by the methods -- of type class like this one) will be interpreted.-class Applicable repr where+class CombApplicable repr where -- | @(a2b '<$>' ra)@ parses like @(ra)@ but maps its returned value with @(a2b)@.- (<$>) :: TermGrammar (a -> b) -> repr a -> repr b+ (<$>) :: Production (a -> b) -> repr a -> repr b (<$>) f = (pure f <*>)+ (<$>%) :: (Production a -> Production b) -> repr a -> repr b+ a2b <$>% ma = Prod.lam a2b <$> ma -- | Like '<$>' but with its arguments 'flip'-ped.- (<&>) :: repr a -> TermGrammar (a -> b) -> repr b+ (<&>) :: repr a -> Production (a -> b) -> repr b (<&>) = flip (<$>) -- | @(a '<$' rb)@ parses like @(rb)@ but discards its returned value by replacing it with @(a)@.- (<$) :: TermGrammar a -> repr b -> repr a+ (<$) :: Production a -> repr b -> repr a (<$) x = (pure x <*) -- | @(ra '$>' b)@ parses like @(ra)@ but discards its returned value by replacing it with @(b)@.- ($>) :: repr a -> TermGrammar b -> repr b+ ($>) :: repr a -> Production b -> repr b ($>) = flip (<$) -- | @('pure' a)@ parses the empty string, always succeeding in returning @(a)@.- pure :: TermGrammar a -> repr a+ pure :: Production a -> repr a default pure ::- Sym.Liftable repr => Applicable (Sym.Output repr) =>- TermGrammar a -> repr a- pure = Sym.lift . pure+ FromDerived CombApplicable repr =>+ Production a -> repr a+ pure = liftDerived . pure -- | @(ra2b '<*>' ra)@ parses sequentially @(ra2b)@ and then @(ra)@, -- and returns the application of the function returned by @(ra2b)@ -- to the value returned by @(ra)@. (<*>) :: repr (a -> b) -> repr a -> repr b default (<*>) ::- Sym.Liftable2 repr => Applicable (Sym.Output repr) =>+ FromDerived2 CombApplicable repr => repr (a -> b) -> repr a -> repr b- (<*>) = Sym.lift2 (<*>)-- -- | @('liftA2' a2b2c ra rb)@ parses sequentially @(ra)@ and then @(rb)@,- -- and returns the application of @(a2b2c)@ to the values returned by those parsers.- liftA2 :: TermGrammar (a -> b -> c) -> repr a -> repr b -> repr c- liftA2 f x = (<*>) (f <$> x)+ (<*>) = liftDerived2 (<*>) -- | @(ra '<*' rb)@ parses sequentially @(ra)@ and then @(rb)@, -- and returns like @(ra)@, discarding the return value of @(rb)@. (<*) :: repr a -> repr b -> repr a- (<*) = liftA2 H.const+ (<*) = liftA2 Prod.const -- | @(ra '*>' rb)@ parses sequentially @(ra)@ and then @(rb)@, -- and returns like @(rb)@, discarding the return value of @(ra)@. (*>) :: repr a -> repr b -> repr b- x *> y = (H.id <$ x) <*> y+ x *> y = (Prod.id <$ x) <*> y -- | Like '<*>' but with its arguments 'flip'-ped. (<**>) :: repr a -> repr (a -> b) -> repr b- (<**>) = liftA2 (H.flip H..@ (H.$))+ (<**>) = liftA2 (Prod.flip Prod..@ (Prod.$)) {- (<**>) :: repr a -> repr (a -> b) -> repr b (<**>) = liftA2 (\a f -> f a) -}-infixl 4 <$>, <&>, <$, $>, <*>, <*, *>, <**>+ -- | @('liftA2' a2b2c ra rb)@ parses sequentially @(ra)@ and then @(rb)@,+ -- and returns the application of @(a2b2c)@ to the values returned by those parsers.+ liftA2 :: Production (a -> b -> c) -> repr a -> repr b -> repr c+ liftA2 f x = (<*>) (f <$> x) --- * Class 'Alternable'-class Alternable repr where- -- | @(rl '<|>' rr)@ parses @(rl)@ and return its return value or,- -- if it fails, parses @(rr)@ from where @(rl)@ has left the input stream,- -- and returns its return value.- (<|>) :: repr a -> repr a -> repr a- -- | @(empty)@ parses nothing, always failing to return a value.- empty :: repr a- -- | @('try' ra)@ records the input stream position,- -- then parses like @(ra)@ and either returns its value it it succeeds or fails- -- if it fails but with a reset of the input stream to the recorded position.- -- Generally used on the first alternative: @('try' rl '<|>' rr)@.- try :: repr a -> repr a- default (<|>) ::- Sym.Liftable2 repr => Alternable (Sym.Output repr) =>- repr a -> repr a -> repr a- default empty ::- Sym.Liftable repr => Alternable (Sym.Output repr) =>- repr a- default try ::- Sym.Liftable1 repr => Alternable (Sym.Output repr) =>- repr a -> repr a- (<|>) = Sym.lift2 (<|>)- empty = Sym.lift empty- try = Sym.lift1 try- -- | Like @('<|>')@ but with different returning types for the alternatives,- -- and a return value wrapped in an 'Either' accordingly.- (<+>) :: Applicable repr => Alternable repr => repr a -> repr b -> repr (Either a b)- p <+> q = H.left <$> p <|> H.right <$> q-infixl 3 <|>, <+>+infixl 4 <*>, <*, *>, <**>+data instance Failure CombApplicable -optionally :: Applicable repr => Alternable repr => repr a -> TermGrammar b -> repr b-optionally p x = p $> x <|> pure x -optional :: Applicable repr => Alternable repr => repr a -> repr ()-optional = flip optionally H.unit--option :: Applicable repr => Alternable repr => TermGrammar a -> repr a -> repr a-option x p = p <|> pure x+{-# INLINE (<:>) #-}+infixl 4 <:>+(<:>) :: CombApplicable repr => repr a -> repr [a] -> repr [a]+(<:>) = liftA2 Prod.cons -choice :: Alternable repr => [repr a] -> repr a-choice = List.foldr (<|>) empty- -- FIXME: Here hlint suggests to use Data.Foldable.asum,- -- but at this point there is no asum for our own (<|>)+sequence :: CombApplicable repr => [repr a] -> repr [a]+sequence = List.foldr (<:>) (pure Prod.nil) -maybeP :: Applicable repr => Alternable repr => repr a -> repr (Maybe a)-maybeP p = option H.nothing (H.just <$> p)+traverse :: CombApplicable repr => (a -> repr b) -> [a] -> repr [b]+traverse f = sequence . List.map f+ -- FIXME: Here hlint suggests to use Control.Monad.mapM,+ -- but at this point there is no mapM for our own sequence -manyTill :: Applicable repr => Alternable repr => repr a -> repr b -> repr [a]-manyTill p end = let go = end $> H.nil <|> p <:> go in go+repeat :: CombApplicable repr => Int -> repr a -> repr [a]+repeat n p = traverse (const p) [1..n] --- * Class 'Selectable'-class Selectable repr where- branch :: repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c- default branch ::- Sym.Liftable3 repr => Selectable (Sym.Output repr) =>- repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c- branch = Sym.lift3 branch+between :: CombApplicable repr => repr o -> repr c -> repr a -> repr a+between open close p = open *> p <* close --- * Class 'Matchable'-class Matchable repr where- conditional ::- Eq a => repr a -> [TermGrammar (a -> Bool)] -> [repr b] -> repr b -> repr b- default conditional ::- Sym.Unliftable repr => Sym.Liftable1 repr => Matchable (Sym.Output repr) =>- Eq a => repr a -> [TermGrammar (a -> Bool)] -> [repr b] -> repr b -> repr b- conditional a ps bs = Sym.lift1 (conditional (Sym.trans a) ps (Sym.trans Functor.<$> bs))+void :: CombApplicable repr => repr a -> repr ()+void p = p *> unit - match :: Eq a => repr a -> [TermGrammar a] -> (TermGrammar a -> repr b) -> repr b -> repr b- match a as a2b = conditional a ((H.eq H..@) Functor.<$> as) (a2b Functor.<$> as)- -- match a as a2b = conditional a (((H.eq H..@ H.qual) H..@) Functor.<$> as) (a2b Functor.<$> as)+unit :: CombApplicable repr => repr ()+unit = pure Prod.unit --- * Class 'Foldable'-class Foldable repr where+-- * Class 'CombFoldable'+class CombFoldable repr where chainPre :: repr (a -> a) -> repr a -> repr a chainPost :: repr a -> repr (a -> a) -> repr a {- default chainPre ::- Sym.Liftable2 repr => Foldable (Sym.Output repr) =>+ FromDerived2 CombFoldable repr => repr (a -> a) -> repr a -> repr a default chainPost ::- Sym.Liftable2 repr => Foldable (Sym.Output repr) =>+ FromDerived2 CombFoldable repr => repr a -> repr (a -> a) -> repr a- chainPre = Sym.lift2 chainPre- chainPost = Sym.lift2 chainPost+ chainPre = liftDerived2 chainPre+ chainPost = liftDerived2 chainPost -} default chainPre ::- Applicable repr =>- Alternable repr =>+ CombApplicable repr =>+ CombAlternable repr => repr (a -> a) -> repr a -> repr a default chainPost ::- Applicable repr =>- Alternable repr =>+ CombApplicable repr =>+ CombAlternable repr => repr a -> repr (a -> a) -> repr a- chainPre op p = go <*> p- where go = (H..) <$> op <*> go <|> pure H.id- chainPost p op = p <**> go- where go = (H..) <$> op <*> go <|> pure H.id+ chainPre op p = go <*> p where go = (Prod..) <$> op <*> go <|> pure Prod.id+ chainPost p op = p <**> go where go = (Prod..) <$> op <*> go <|> pure Prod.id+ {-+ chainPre op p = flip (foldr ($)) <$> many op <*> p+ chainPost p op = foldl' (flip ($)) <$> p <*> many op+ -}+data instance Failure CombFoldable {--conditional :: Selectable repr => [(TermGrammar (a -> Bool), repr b)] -> repr a -> repr b -> repr b+conditional :: CombSelectable repr => [(Production (a -> Bool), repr b)] -> repr a -> repr b -> repr b conditional cs p def = match p fs qs def where (fs, qs) = List.unzip cs -} --- * Class 'Satisfiable'-class Satisfiable tok repr where- satisfy :: [ErrorItem tok] -> TermGrammar (tok -> Bool) -> repr tok- default satisfy ::- Sym.Liftable repr => Satisfiable tok (Sym.Output repr) =>- [ErrorItem tok] ->- TermGrammar (tok -> Bool) -> repr tok- satisfy es = Sym.lift . satisfy es-- item :: repr tok- item = satisfy [] (H.const H..@ H.bool True)---- ** Type 'ErrorItem'-data ErrorItem tok- = ErrorItemToken tok- | ErrorItemLabel String- | ErrorItemHorizon Int- | ErrorItemEnd-deriving instance Eq tok => Eq (ErrorItem tok)-deriving instance Ord tok => Ord (ErrorItem tok)-deriving instance Show tok => Show (ErrorItem tok)-deriving instance TH.Lift tok => TH.Lift (ErrorItem tok)---- * Class 'Lookable'-class Lookable repr where- look :: repr a -> repr a- negLook :: repr a -> repr ()- default look :: Sym.Liftable1 repr => Lookable (Sym.Output repr) => repr a -> repr a- default negLook :: Sym.Liftable1 repr => Lookable (Sym.Output repr) => repr a -> repr ()- look = Sym.lift1 look- negLook = Sym.lift1 negLook-- eof :: repr ()- eof = Sym.lift eof- default eof :: Sym.Liftable repr => Lookable (Sym.Output repr) => repr ()- -- eof = negLook (satisfy @Char [ErrorItemAny] (H.const H..@ H.bool True))- -- (item @Char)--{-# INLINE (<:>) #-}-infixl 4 <:>-(<:>) :: Applicable repr => repr a -> repr [a] -> repr [a]-(<:>) = liftA2 H.cons--sequence :: Applicable repr => [repr a] -> repr [a]-sequence = List.foldr (<:>) (pure H.nil)--traverse :: Applicable repr => (a -> repr b) -> [a] -> repr [b]-traverse f = sequence . List.map f- -- FIXME: Here hlint suggests to use Control.Monad.mapM,- -- but at this point there is no mapM for our own sequence--repeat :: Applicable repr => Int -> repr a -> repr [a]-repeat n p = traverse (const p) [1..n]--between :: Applicable repr => repr o -> repr c -> repr a -> repr a-between open close p = open *> p <* close--string ::- Applicable repr => Alternable repr =>- Satisfiable Char repr =>- [Char] -> repr [Char]-string = try . traverse char--oneOf ::- TH.Lift tok => Eq tok =>- Satisfiable tok repr =>- [tok] -> repr tok-oneOf ts = satisfy [ErrorItemLabel "oneOf"]- (Sym.trans H.ValueCode- { value = (`List.elem` ts)- , code = [||\t -> $$(ofChars ts [||t||])||] })--noneOf ::- TH.Lift tok => Eq tok =>- Satisfiable tok repr =>- [tok] -> repr tok-noneOf cs = satisfy (ErrorItemToken Functor.<$> cs) (Sym.trans H.ValueCode- { value = not . (`List.elem` cs)- , code = [||\c -> not $$(ofChars cs [||c||])||]- })--ofChars ::- TH.Lift tok => Eq tok =>- {-alternatives-}[tok] ->- {-input-}TH.CodeQ tok ->- TH.CodeQ Bool-ofChars = List.foldr (\alt acc ->- \inp -> [|| alt == $$inp || $$(acc inp) ||])- (const [||False||])--more :: Applicable repr => Satisfiable Char repr => Lookable repr => repr ()-more = look (void (item @Char))--char ::- Applicable repr => Satisfiable Char repr =>- Char -> repr Char-char c = satisfy [ErrorItemToken c] (H.eq H..@ H.char c) $> H.char c--- char c = satisfy [ErrorItemToken c] (H.eq H..@ H.qual H..@ H.char c) $> H.char c--anyChar :: Satisfiable Char repr => repr Char-anyChar = satisfy [] (H.const H..@ H.bool True)--token ::- TH.Lift tok => Show tok => Eq tok =>- Applicable repr => Satisfiable tok repr =>- tok -> repr tok-token tok = satisfy [ErrorItemToken tok] (H.eq H..@ H.char tok) $> H.char tok--- token tok = satisfy [ErrorItemToken tok] (H.eq H..@ H.qual H..@ H.char tok) $> H.char tok--tokens ::- TH.Lift tok => Eq tok => Show tok =>- Applicable repr => Alternable repr =>- Satisfiable tok repr => [tok] -> repr [tok]-tokens = try . traverse token---- Composite Combinators--- someTill :: repr a -> repr b -> repr [a]--- someTill p end = negLook end *> (p <:> manyTill p end)--void :: Applicable repr => repr a -> repr ()-void p = p *> unit--unit :: Applicable repr => repr ()-unit = pure H.unit--{--constp :: Applicable repr => repr a -> repr (b -> a)-constp = (H.const <$>)----- Alias Operations-infixl 1 >>-(>>) :: Applicable repr => repr a -> repr b -> repr b-(>>) = (*>)---- Monoidal Operations--infixl 4 <~>-(<~>) :: Applicable repr => repr a -> repr b -> repr (a, b)-(<~>) = liftA2 (H.runtime (,))--infixl 4 <~-(<~) :: Applicable repr => repr a -> repr b -> repr a-(<~) = (<*)--infixl 4 ~>-(~>) :: Applicable repr => repr a -> repr b -> repr b-(~>) = (*>)---- Lift Operations-liftA2 ::- Applicable repr =>- TermGrammar (a -> b -> c) -> repr a -> repr b -> repr c-liftA2 f x = (<*>) (fmap f x)--liftA3 ::- Applicable repr =>- TermGrammar (a -> b -> c -> d) -> repr a -> repr b -> repr c -> repr d-liftA3 f a b c = liftA2 f a b <*> c---}- -- Parser Folds pfoldr ::- Applicable repr => Foldable repr =>- TermGrammar (a -> b -> b) -> TermGrammar b -> repr a -> repr b+ CombApplicable repr => CombFoldable repr =>+ Production (a -> b -> b) -> Production b -> repr a -> repr b pfoldr f k p = chainPre (f <$> p) (pure k) pfoldr1 ::- Applicable repr => Foldable repr =>- TermGrammar (a -> b -> b) -> TermGrammar b -> repr a -> repr b+ CombApplicable repr => CombFoldable repr =>+ Production (a -> b -> b) -> Production b -> repr a -> repr b pfoldr1 f k p = f <$> p <*> pfoldr f k p pfoldl ::- Applicable repr => Foldable repr =>- TermGrammar (b -> a -> b) -> TermGrammar b -> repr a -> repr b-pfoldl f k p = chainPost (pure k) ((H.flip <$> pure f) <*> p)+ CombApplicable repr => CombFoldable repr =>+ Production (b -> a -> b) -> Production b -> repr a -> repr b+pfoldl f k p = chainPost (pure k) ((Prod.flip <$> pure f) <*> p) pfoldl1 ::- Applicable repr => Foldable repr =>- TermGrammar (b -> a -> b) -> TermGrammar b -> repr a -> repr b-pfoldl1 f k p = chainPost (f <$> pure k <*> p) ((H.flip <$> pure f) <*> p)+ CombApplicable repr => CombFoldable repr =>+ Production (b -> a -> b) -> Production b -> repr a -> repr b+pfoldl1 f k p = chainPost (f <$> pure k <*> p) ((Prod.flip <$> pure f) <*> p) -- Chain Combinators chainl1' ::- Applicable repr => Foldable repr =>- TermGrammar (a -> b) -> repr a -> repr (b -> a -> b) -> repr b-chainl1' f p op = chainPost (f <$> p) (H.flip <$> op <*> p)+ CombApplicable repr => CombFoldable repr =>+ Production (a -> b) -> repr a -> repr (b -> a -> b) -> repr b+chainl1' f p op = chainPost (f <$> p) (Prod.flip <$> op <*> p) chainl1 ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => repr a -> repr (a -> a -> a) -> repr a-chainl1 = chainl1' H.id+chainl1 = chainl1' Prod.id {- chainr1' :: ParserOps rep => rep (a -> b) -> repr a -> repr (a -> b -> b) -> repr b-chainr1' f p op = newRegister_ H.id $ \acc ->+chainr1' f p op = newRegister_ Prod.id $ \acc -> let go = bind p $ \x ->- modify acc (H.flip (H..@) <$> (op <*> x)) *> go+ modify acc (Prod.flip (Prod..@) <$> (op <*> x)) *> go <|> f <$> x in go <**> get acc chainr1 :: repr a -> repr (a -> a -> a) -> repr a-chainr1 = chainr1' H.id+chainr1 = chainr1' Prod.id -chainr :: repr a -> repr (a -> a -> a) -> TermGrammar a -> repr a+chainr :: repr a -> repr (a -> a -> a) -> Production a -> repr a chainr p op x = option x (chainr1 p op) -} chainl ::- Applicable repr => Alternable repr => Foldable repr =>- repr a -> repr (a -> a -> a) -> TermGrammar a -> repr a+ CombApplicable repr => CombAlternable repr => CombFoldable repr =>+ repr a -> repr (a -> a -> a) -> Production a -> repr a chainl p op x = option x (chainl1 p op) -- Derived Combinators many ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => repr a -> repr [a]-many = pfoldr H.cons H.nil+many = pfoldr Prod.cons Prod.nil manyN ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => Int -> repr a -> repr [a] manyN n p = List.foldr (const (p <:>)) (many p) [1..n] some ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => repr a -> repr [a] some = manyN 1 skipMany ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => repr a -> repr () --skipMany p = let skipManyp = p *> skipManyp <|> unit in skipManyp-skipMany = void . pfoldl H.const H.unit -- the void here will encourage the optimiser to recognise that the register is unused+skipMany = void . pfoldl Prod.const Prod.unit -- the void here will encourage the optimiser to recognise that the register is unused skipManyN ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => Int -> repr a -> repr () skipManyN n p = List.foldr (const (p *>)) (skipMany p) [1..n] skipSome ::- Applicable repr => Foldable repr =>+ CombApplicable repr => CombFoldable repr => repr a -> repr () skipSome = skipManyN 1 sepBy ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a]-sepBy p sep = option H.nil (sepBy1 p sep)+sepBy p sep = option Prod.nil (sepBy1 p sep) sepBy1 ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a] sepBy1 p sep = p <:> many (sep *> p) endBy ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a] endBy p sep = many (p <* sep) endBy1 ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a] endBy1 p sep = some (p <* sep) sepEndBy ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a]-sepEndBy p sep = option H.nil (sepEndBy1 p sep)+sepEndBy p sep = option Prod.nil (sepEndBy1 p sep) sepEndBy1 ::- Applicable repr => Alternable repr => Foldable repr =>+ CombApplicable repr => CombAlternable repr => CombFoldable repr => repr a -> repr b -> repr [a] sepEndBy1 p sep =- let seb1 = p <**> (sep *> (H.flip H..@ H.cons <$> option H.nil seb1)- <|> pure (H.flip H..@ H.cons H..@ H.nil))+ let seb1 = p <**> (sep *> (Prod.flip Prod..@ Prod.cons <$> option Prod.nil seb1)+ <|> pure (Prod.flip Prod..@ Prod.cons Prod..@ Prod.nil)) in seb1 {- sepEndBy1 :: repr a -> repr b -> repr [a]-sepEndBy1 p sep = newRegister_ H.id $ \acc ->- let go = modify acc ((H.flip (H..)) H..@ H.cons <$> p)+sepEndBy1 p sep = newRegister_ Prod.id $ \acc ->+ let go = modify acc ((Prod.flip (Prod..)) Prod..@ Prod.cons <$> p) *> (sep *> (go <|> get acc) <|> get acc)- in go <*> pure H.nil+ in go <*> pure Prod.nil -} +-- * Class 'CombMatchable'+class CombMatchable repr where+ conditional ::+ Eq a => repr a -> [Production (a -> Bool)] -> [repr b] -> repr b -> repr b+ default conditional ::+ FromDerived1 CombMatchable repr => Derivable repr =>+ Eq a => repr a -> [Production (a -> Bool)] -> [repr b] -> repr b -> repr b+ conditional a ps bs = liftDerived1 (conditional (derive a) ps (derive Functor.<$> bs))++ match :: Eq a => repr a -> [Production a] -> (Production a -> repr b) -> repr b -> repr b+ match a as a2b = conditional a ((Prod.equal Prod..@) Functor.<$> as) (a2b Functor.<$> as)+ -- match a as a2b = conditional a (((Prod.eq Prod..@ Prod.qual) Prod..@) Functor.<$> as) (a2b Functor.<$> as)+data instance Failure CombMatchable++-- * Class 'CombSatisfiable'+class CombSatisfiable tok repr where+ -- | Like 'satisfyOrFail' but with no custom failure.+ satisfy :: Production (tok -> Bool) -> repr tok+ satisfy = satisfyOrFail Set.empty+ -- | Like 'satisfy' but with a custom set of 'SomeFailure's.+ satisfyOrFail ::+ Set SomeFailure ->+ Production (tok -> Bool) -> repr tok+ default satisfyOrFail ::+ FromDerived (CombSatisfiable tok) repr =>+ Set SomeFailure ->+ Production (tok -> Bool) -> repr tok+ satisfyOrFail fs = liftDerived . satisfyOrFail fs++data instance Failure (CombSatisfiable tok)+ = FailureAny+ -- FIXME: this 'Failure' is a bit special since multiple ones+ -- with different 'Horizon's makes no sense.+ -- This should likely be treated separately in 'ParsingError'.+ | FailureHorizon Int -- FIXME: use Natural?+ | FailureLabel String+ | FailureToken tok+ deriving (Eq, Ord, Show, Typeable, Generic, NFData)+-- | Global 'TH.Name' to refer to the @(InputToken inp)@ type+-- from TemplateHaskell code.+inputTokenProxy :: TH.Name+inputTokenProxy = TH.mkName "inputToken"+instance TH.Lift tok => TH.Lift (Failure (CombSatisfiable tok)) where+ liftTyped :: forall m. TH.Quote m => Failure (CombSatisfiable tok) -> TH.Code m (Failure (CombSatisfiable tok))+ liftTyped x = [||+ case+ $$(let inputToken :: TH.Code m (Proxy tok) =+ TH.unsafeCodeCoerce (return (TH.VarE inputTokenProxy))+ in inputToken) of+ (Proxy :: Proxy tok') ->+ $$(case x of+ FailureAny -> [|| FailureAny @tok' ||]+ FailureHorizon h -> [|| FailureHorizon @tok' h ||]+ FailureLabel lbl -> [|| FailureLabel @tok' lbl ||]+ FailureToken tok -> [|| FailureToken $$(TH.liftTyped tok) ||]+ )+ ||]++char ::+ CombApplicable repr =>+ CombSatisfiable Char repr =>+ Char -> repr Char+char c = satisfyOrFail+ (Set.singleton (SomeFailure (FailureToken c)))+ (Prod.equal Prod..@ Prod.char c)+ $> Prod.char c++item :: forall tok repr.+ Ord tok => Show tok => Typeable tok => TH.Lift tok => NFData tok =>+ CombSatisfiable tok repr => repr tok+item = satisfyOrFail+ (Set.singleton (SomeFailure (FailureAny @tok)))+ (Prod.const Prod..@ Prod.bool True)++anyChar ::+ CombAlternable repr =>+ CombSatisfiable Char repr =>+ repr Char+anyChar = item++string ::+ CombApplicable repr => CombAlternable repr =>+ CombSatisfiable Char repr =>+ [Char] -> repr [Char]+string = try . traverse char++oneOf ::+ Ord tok => Show tok => Typeable tok => TH.Lift tok => NFData tok =>+ CombSatisfiable tok repr =>+ [tok] -> repr tok+oneOf ts = satisfyOrFail+ (Set.fromList (SomeFailure . FailureToken Functor.<$> ts))+ (production+ (`List.elem` ts)+ [||\t -> $$(ofChars ts [||t||])||])++noneOf ::+ TH.Lift tok => Eq tok =>+ CombSatisfiable tok repr =>+ [tok] -> repr tok+noneOf cs = satisfy (production+ (not . (`List.elem` cs))+ [||\c -> not $$(ofChars cs [||c||])||])++ofChars ::+ TH.Lift tok => Eq tok =>+ {-alternatives-}[tok] ->+ {-input-}TH.CodeQ tok ->+ TH.CodeQ Bool+ofChars = List.foldr (\tok acc ->+ \inp -> [|| tok == $$inp || $$(acc inp) ||])+ (const [||False||])++more ::+ CombAlternable repr =>+ CombApplicable repr =>+ CombSatisfiable Char repr =>+ CombLookable repr => repr ()+more = look (void (item @Char))++token ::+ TH.Lift tok => Show tok => Eq tok => Typeable tok =>+ CombAlternable repr =>+ CombApplicable repr =>+ CombSatisfiable tok repr =>+ tok -> repr tok+token tok = satisfy (Prod.equal Prod..@ Prod.constant tok) $> Prod.constant tok+-- token tok = satisfy [ExceptionToken tok] (Prod.eq Prod..@ Prod.qual Prod..@ Prod.char tok) $> Prod.char tok++tokens ::+ TH.Lift tok => Eq tok => Show tok => Typeable tok =>+ CombApplicable repr => CombAlternable repr =>+ CombSatisfiable tok repr => [tok] -> repr [tok]+tokens = try . traverse token++-- * Class 'CombSelectable'+class CombSelectable repr where+ branch :: repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c+ default branch ::+ FromDerived3 CombSelectable repr =>+ repr (Either a b) -> repr (a -> c) -> repr (b -> c) -> repr c+ branch = liftDerived3 branch+data instance Failure CombSelectable++-- * Class 'CombLookable'+class CombLookable repr where+ look :: repr a -> repr a+ negLook :: repr a -> repr ()+ default look ::+ FromDerived1 CombLookable repr =>+ repr a -> repr a+ default negLook ::+ FromDerived1 CombLookable repr =>+ repr a -> repr ()+ look = liftDerived1 look+ negLook = liftDerived1 negLook++ eof :: repr ()+ eof = liftDerived eof+ default eof ::+ FromDerived CombLookable repr =>+ repr ()+ -- eof = negLook (satisfy @Char (Prod.const Prod..@ Prod.bool True))+ -- (item @Char)+data instance Failure CombLookable+ = FailureEnd+ deriving (Eq, Ord, Show, Typeable, TH.Lift, Generic, NFData)++-- Composite Combinators+-- someTill :: repr a -> repr b -> repr [a]+-- someTill p end = negLook end *> (p <:> manyTill p end)+ {-+constp :: CombApplicable repr => repr a -> repr (b -> a)+constp = (Prod.const <$>)+++-- Alias Operations+infixl 1 >>+(>>) :: CombApplicable repr => repr a -> repr b -> repr b+(>>) = (*>)++-- Monoidal Operations++infixl 4 <~>+(<~>) :: CombApplicable repr => repr a -> repr b -> repr (a, b)+(<~>) = liftA2 (Prod.runtime (,))++infixl 4 <~+(<~) :: CombApplicable repr => repr a -> repr b -> repr a+(<~) = (<*)++infixl 4 ~>+(~>) :: CombApplicable repr => repr a -> repr b -> repr b+(~>) = (*>)++-- Lift Operations+liftA2 ::+ CombApplicable repr =>+ Production (a -> b -> c) -> repr a -> repr b -> repr c+liftA2 f x = (<*>) (fmap f x)++liftA3 ::+ CombApplicable repr =>+ Production (a -> b -> c -> d) -> repr a -> repr b -> repr c -> repr d+liftA3 f a b c = liftA2 f a b <*> c++-}++{- -- Combinators interpreters for 'Sym.Any'.-instance Applicable repr => Applicable (Sym.Any repr)-instance Satisfiable repr => Satisfiable (Sym.Any repr)-instance Alternable repr => Alternable (Sym.Any repr)-instance Selectable repr => Selectable (Sym.Any repr)-instance Matchable repr => Matchable (Sym.Any repr)-instance Lookable repr => Lookable (Sym.Any repr)-instance Foldable repr => Foldable (Sym.Any repr)+instance CombApplicable repr => CombApplicable (Sym.Any repr)+instance CombSatisfiable repr => CombSatisfiable (Sym.Any repr)+instance CombAlternable repr => CombAlternable (Sym.Any repr)+instance CombSelectable repr => CombSelectable (Sym.Any repr)+instance CombMatchable repr => CombMatchable (Sym.Any repr)+instance CombLookable repr => CombLookable (Sym.Any repr)+instance CombFoldable repr => CombFoldable (Sym.Any repr) -}
− src/Symantic/Parser/Grammar/Fixity.hs
@@ -1,115 +0,0 @@-module Symantic.Parser.Grammar.Fixity where--import Data.Bool-import Data.Eq (Eq(..))-import Data.Function ((.))-import Data.Int (Int)-import Data.Maybe (Maybe(..))-import Data.Ord (Ord(..))-import Data.Semigroup-import Data.String (String, IsString(..))-import Text.Show (Show(..))---- * Type 'Fixity'-data Fixity- = Fixity1 Unifix- | Fixity2 Infix- deriving (Eq, Show)---- ** Type 'Unifix'-data Unifix- = Prefix { unifix_precedence :: Precedence }- | Postfix { unifix_precedence :: Precedence }- deriving (Eq, Show)---- ** Type 'Infix'-data Infix- = Infix- { infix_associativity :: Maybe Associativity- , infix_precedence :: Precedence- } deriving (Eq, Show)--infixL :: Precedence -> Infix-infixL = Infix (Just AssocL)--infixR :: Precedence -> Infix-infixR = Infix (Just AssocR)--infixB :: Side -> Precedence -> Infix-infixB = Infix . Just . AssocB--infixN :: Precedence -> Infix-infixN = Infix Nothing--infixN0 :: Infix-infixN0 = infixN 0--infixN5 :: Infix-infixN5 = infixN 5---- | Given 'Precedence' and 'Associativity' of its parent operator,--- and the operand 'Side' it is in,--- return whether an 'Infix' operator--- needs to be enclosed by a 'Pair'.-isPairNeeded :: (Infix, Side) -> Infix -> Bool-isPairNeeded (po, lr) op =- infix_precedence op < infix_precedence po- || infix_precedence op == infix_precedence po- && not associate- where- associate =- case (lr, infix_associativity po) of- (_, Just AssocB{}) -> True- (SideL, Just AssocL) -> True- (SideR, Just AssocR) -> True- _ -> False---- | If 'isPairNeeded' is 'True',--- enclose the given 'IsString' by given 'Pair',--- otherwise returns the same 'IsString'.-pairIfNeeded ::- Semigroup s => IsString s =>- Pair -> (Infix, Side) -> Infix ->- s -> s-pairIfNeeded (o,c) po op s =- if isPairNeeded po op- then fromString o <> s <> fromString c- else s---- * Type 'Precedence'-type Precedence = Int---- ** Class 'PrecedenceOf'-class PrecedenceOf a where- precedence :: a -> Precedence-instance PrecedenceOf Fixity where- precedence (Fixity1 uni) = precedence uni- precedence (Fixity2 inf) = precedence inf-instance PrecedenceOf Unifix where- precedence = unifix_precedence-instance PrecedenceOf Infix where- precedence = infix_precedence---- * Type 'Associativity'-data Associativity- = AssocL -- ^ Associate to the left: @a ¹ b ² c == (a ¹ b) ² c@- | AssocR -- ^ Associate to the right: @a ¹ b ² c == a ¹ (b ² c)@- | AssocB Side -- ^ Associate to both sides, but to 'Side' when reading.- deriving (Eq, Show)---- ** Type 'Side'-data Side- = SideL -- ^ Left- | SideR -- ^ Right- deriving (Eq, Show)---- ** Type 'Pair'-type Pair = (String, String)-pairAngle :: Pair-pairBrace :: Pair-pairBracket :: Pair-pairParen :: Pair-pairAngle = ("<",">")-pairBrace = ("{","}")-pairBracket = ("[","]")-pairParen = ("(",")")
src/Symantic/Parser/Grammar/ObserveSharing.hs view
@@ -1,68 +1,52 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Symantic.Parser.Grammar.ObserveSharing- ( module Symantic.Univariant.Letable+ ( module Symantic.Typed.ObserveSharing , module Symantic.Parser.Grammar.ObserveSharing ) where import Control.Monad (mapM)-import Data.Eq (Eq(..)) import Data.Function (($), (.)) import Data.Hashable (Hashable, hashWithSalt) import Text.Show (Show(..)) import qualified Control.Applicative as Functor import Symantic.Parser.Grammar.Combinators-import Symantic.Univariant.Letable hiding (observeSharing)-import qualified Symantic.Univariant.Letable as Letable+import Symantic.Typed.Derive+import Symantic.Typed.ObserveSharing hiding (observeSharing)+import qualified Symantic.Typed.ObserveSharing as ObserveSharing import qualified Language.Haskell.TH.Syntax as TH-import qualified Symantic.Univariant.Trans as Sym --- | Like 'Letable.observeSharing'+-- | Like 'Observable.observeSharing' -- but type-binding @(letName)@ to 'TH.Name' -- to avoid the trouble to always set it.-observeSharing :: ObserveSharing TH.Name repr a -> repr a-observeSharing = Letable.observeSharing+observeSharing :: Letsable TH.Name repr => ObserveSharing TH.Name repr a -> repr a+observeSharing os = lets defs body+ where (body, defs) = ObserveSharing.observeSharing os -- | Needed by 'observeSharing'. instance Hashable TH.Name where hashWithSalt s = hashWithSalt s . show+instance MakeLetName TH.Name where+ makeLetName _ = TH.qNewName "name" -- Combinators semantics for the 'ObserveSharing' interpreter.-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Satisfiable tok repr- ) => Satisfiable tok (ObserveSharing letName repr)-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Alternable repr- ) => Alternable (ObserveSharing letName repr)-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Applicable repr- ) => Applicable (ObserveSharing letName repr)-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Selectable repr- ) => Selectable (ObserveSharing letName repr)+instance (Letable TH.Name repr, CombAlternable repr) =>+ CombAlternable (ObserveSharing TH.Name repr)+instance (Letable TH.Name repr, CombApplicable repr) =>+ CombApplicable (ObserveSharing TH.Name repr) instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Matchable repr- ) => Matchable (ObserveSharing letName repr) where+ ( Letable TH.Name repr+ , CombFoldable repr+ {- TODO: the following constraints are for the current CombFoldable,+ - they will have to be removed when CombFoldable will have 'liftDerived2' as defaults+ -}+ , CombApplicable repr+ , CombAlternable repr+ ) => CombFoldable (ObserveSharing TH.Name repr)+instance (Letable TH.Name repr, CombLookable repr) =>+ CombLookable (ObserveSharing TH.Name repr)+instance (Letable TH.Name repr, CombMatchable repr) =>+ CombMatchable (ObserveSharing TH.Name repr) where -- Here the default definition does not fit -- since there is no lift* for the type of 'conditional' -- and its default definition does not handles 'bs'@@ -73,39 +57,24 @@ Functor.<*> Functor.pure cs Functor.<*> mapM unObserveSharing bs Functor.<*> unObserveSharing b-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Foldable repr- {- TODO: the following constraints are for the current Foldable,- - they will have to be removed when Foldable will have Sym.lift2 as defaults- -}- , Applicable repr- , Alternable repr- ) => Foldable (ObserveSharing letName repr)-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- , Lookable repr- ) => Lookable (ObserveSharing letName repr)+instance (Letable TH.Name repr, CombSelectable repr) =>+ CombSelectable (ObserveSharing TH.Name repr)+instance (Letable TH.Name repr, CombSatisfiable tok repr) =>+ CombSatisfiable tok (ObserveSharing TH.Name repr) --- Combinators semantics for the 'CleanDefs' interpreter.-instance Applicable repr => Applicable (CleanDefs letName repr)-instance Alternable repr => Alternable (CleanDefs letName repr)-instance Satisfiable tok repr => Satisfiable tok (CleanDefs letName repr)-instance Selectable repr => Selectable (CleanDefs letName repr)-instance Matchable repr => Matchable (CleanDefs letName repr) where- conditional a cs bs b = CleanDefs $+-- Combinators semantics for the 'FinalizeSharing' interpreter.+instance CombApplicable repr => CombApplicable (FinalizeSharing TH.Name repr)+instance CombAlternable repr => CombAlternable (FinalizeSharing TH.Name repr)+instance CombFoldable repr => CombFoldable (FinalizeSharing TH.Name repr) where+ chainPre = liftDerived2 chainPre+ chainPost = liftDerived2 chainPost+instance CombLookable repr => CombLookable (FinalizeSharing TH.Name repr)+instance CombMatchable repr => CombMatchable (FinalizeSharing TH.Name repr) where+ conditional a cs bs b = FinalizeSharing $ conditional- Functor.<$> unCleanDefs a+ Functor.<$> unFinalizeSharing a Functor.<*> Functor.pure cs- Functor.<*> mapM unCleanDefs bs- Functor.<*> unCleanDefs b-instance Lookable repr => Lookable (CleanDefs letName repr)-instance Foldable repr => Foldable (CleanDefs letName repr) where- chainPre = Sym.lift2 chainPre- chainPost = Sym.lift2 chainPost+ Functor.<*> mapM unFinalizeSharing bs+ Functor.<*> unFinalizeSharing b+instance CombSatisfiable tok repr => CombSatisfiable tok (FinalizeSharing TH.Name repr)+instance CombSelectable repr => CombSelectable (FinalizeSharing TH.Name repr)
src/Symantic/Parser/Grammar/Optimize.hs view
@@ -9,22 +9,25 @@ import Data.Bool (Bool(..)) import Data.Either (Either(..), either) import Data.Eq (Eq(..))-import Data.Function ((.))+import Data.Function (($), (.))+import Data.Kind (Constraint) import Data.Maybe (Maybe(..))-import qualified Data.Functor as Functor+import Data.Set (Set)+import Data.Functor.Identity (Identity(..))+import Data.Functor.Product (Product(..))+import Type.Reflection (Typeable, typeRep, eqTypeRep, (:~~:)(..)) import qualified Data.Foldable as Foldable+import qualified Data.Functor as Functor import qualified Data.List as List-import qualified Language.Haskell.TH.Syntax as TH-import Data.Kind (Constraint, Type)-import Type.Reflection (Typeable, typeRep, eqTypeRep, (:~~:)(..)) -import Symantic.Parser.Grammar.Combinators as Comb-import Symantic.Parser.Haskell ()-import Symantic.Univariant.Letable-import Symantic.Univariant.Trans-import qualified Symantic.Parser.Haskell as H+import Symantic.Parser.Grammar.Combinators+import Symantic.Parser.Grammar.Production+import Symantic.Typed.Derive+import Symantic.Typed.ObserveSharing+import qualified Symantic.Typed.Data as Prod+import qualified Symantic.Typed.Lang as Prod -{- Uncomment to trace optimizations+{- import Data.Function (($), flip) import Debug.Trace (trace) @@ -36,27 +39,22 @@ type OptimizeGrammar = SomeComb optimizeGrammar ::- Trans (SomeComb repr) repr =>+ Derivable (SomeComb repr) => SomeComb repr a -> repr a-optimizeGrammar = trans+optimizeGrammar = derive -- * Data family 'Comb' -- | 'Comb'inators of the 'Grammar'. -- This is an extensible data-type. data family Comb (comb :: ReprComb -> Constraint)- (repr :: ReprComb)- :: ReprComb+ :: ReprComb -> ReprComb+type instance Derived (Comb comb repr) = repr -- | Convenient utility to pattern-match a 'SomeComb'.-pattern Comb :: Typeable comb =>- Comb comb repr a ->- SomeComb repr a+pattern Comb :: Typeable comb => Comb comb repr a -> SomeComb repr a pattern Comb x <- (unSomeComb -> Just x) --- ** Type 'ReprComb'-type ReprComb = Type -> Type- -- ** Type 'SomeComb' -- | Some 'Comb'inator existentialized over the actual combinator symantic class. -- Useful to handle a list of 'Comb'inators@@ -67,14 +65,15 @@ -- -- The optimizations are directly applied within it, -- to avoid introducing an extra newtype,--- this also give a more comprehensible code.+-- this also give a more understandable code. data SomeComb repr a = forall comb.- (Trans (Comb comb repr) repr, Typeable comb) =>+ (Derivable (Comb comb repr), Typeable comb) => SomeComb (Comb comb repr a) -instance Trans (SomeComb repr) repr where- trans (SomeComb x) = trans x+type instance Derived (SomeComb repr) = repr+instance Derivable (SomeComb repr) where+ derive (SomeComb x) = derive x -- | @(unSomeComb c :: 'Maybe' ('Comb' comb repr a))@ -- extract the data-constructor from the given 'SomeComb'@@ -88,35 +87,81 @@ Just HRefl -> Just c Nothing -> Nothing --- Applicable-data instance Comb Applicable repr a where- Pure :: TermGrammar a -> Comb Applicable repr a- (:<*>:) :: SomeComb repr (a -> b) -> SomeComb repr a -> Comb Applicable repr b- (:<*:) :: SomeComb repr a -> SomeComb repr b -> Comb Applicable repr a- (:*>:) :: SomeComb repr a -> SomeComb repr b -> Comb Applicable repr b+-- CombAlternable+data instance Comb CombAlternable repr a where+ Alt :: Exception -> SomeComb repr a -> SomeComb repr a -> Comb CombAlternable repr a+ Empty :: Comb CombAlternable repr a+ Failure :: SomeFailure -> Comb CombAlternable repr a+ Throw :: ExceptionLabel -> Comb CombAlternable repr a+ Try :: SomeComb repr a -> Comb CombAlternable repr a+instance CombAlternable repr => Derivable (Comb CombAlternable repr) where+ derive = \case+ Alt exn x y -> alt exn (derive x) (derive y)+ Empty -> empty+ Failure sf -> failure sf+ Throw exn -> throw exn+ Try x -> try (derive x)+instance+ ( CombAlternable repr+ , CombApplicable repr+ , CombLookable repr+ , CombMatchable repr+ , CombSelectable repr+ ) => CombAlternable (SomeComb repr) where+ empty = SomeComb Empty+ failure sf = SomeComb (Failure sf)++ alt _exn p@(Comb Pure{}) _ = p+ -- & trace "Left Catch Law"+ alt _exn (Comb Empty) u = u+ -- & trace "Left Neutral Law"+ alt _exn u (Comb Empty) = u+ -- & trace "Right Neutral Law"+ alt exn (Comb (Alt exn' u v)) w | exn' == exn = u <|> (v <|> w)+ -- See Lemma 1 (Associativity of choice for labeled PEGs)+ -- in https://doi.org/10.1145/2851613.2851750+ -- & trace "Associativity Law"+ alt exn (Comb (Look p)) (Comb (Look q)) = look (alt exn (try p) q)+ -- & trace "Distributivity Law"+ alt exn x y = SomeComb (Alt exn x y)++ throw exn = SomeComb (Throw exn)++ try (Comb (p :$>: x)) = try p $> x+ -- & trace "Try Interchange Law"+ try (Comb (f :<$>: p)) = f <$> try p+ -- & trace "Try Interchange Law"+ try x = SomeComb (Try x)++-- CombApplicable+data instance Comb CombApplicable repr a where+ Pure :: Production a -> Comb CombApplicable repr a+ (:<*>:) :: SomeComb repr (a -> b) -> SomeComb repr a -> Comb CombApplicable repr b+ (:<*:) :: SomeComb repr a -> SomeComb repr b -> Comb CombApplicable repr a+ (:*>:) :: SomeComb repr a -> SomeComb repr b -> Comb CombApplicable repr b infixl 4 :<*>:, :<*:, :*>:-pattern (:<$>:) :: TermGrammar (a -> b) -> SomeComb repr a -> Comb Applicable repr b+pattern (:<$>:) :: Production (a -> b) -> SomeComb repr a -> Comb CombApplicable repr b pattern t :<$>: x <- Comb (Pure t) :<*>: x-pattern (:$>:) :: SomeComb repr a -> TermGrammar b -> Comb Applicable repr b+pattern (:$>:) :: SomeComb repr a -> Production b -> Comb CombApplicable repr b pattern x :$>: t <- x :*>: Comb (Pure t)-instance Applicable repr => Trans (Comb Applicable repr) repr where- trans = \case- Pure x -> pure (H.optimizeTerm x)- f :<*>: x -> trans f <*> trans x- x :<*: y -> trans x <* trans y- x :*>: y -> trans x *> trans y+instance CombApplicable repr => Derivable (Comb CombApplicable repr) where+ derive = \case+ Pure x -> pure (optimizeProduction x)+ f :<*>: x -> derive f <*> derive x+ x :<*: y -> derive x <* derive y+ x :*>: y -> derive x *> derive y instance- ( Applicable repr- , Alternable repr- , Lookable repr- , Matchable repr- , Selectable repr- ) => Applicable (SomeComb repr) where+ ( CombApplicable repr+ , CombAlternable repr+ , CombLookable repr+ , CombMatchable repr+ , CombSelectable repr+ ) => CombApplicable (SomeComb repr) where pure = SomeComb . Pure f <$> Comb (Branch b l r) = branch b- ((H..) H..@ f <$> l)- ((H..) H..@ f <$> r)+ ((Prod..) Prod..@ f <$> l)+ ((Prod..) Prod..@ f <$> r) -- & trace "Branch Distributivity Law" f <$> Comb (Conditional a ps bs d) = conditional a ps@@ -135,18 +180,20 @@ -- & trace "App Right Absorption Law" u <*> Comb Empty = u *> empty -- & trace "App Failure Weakening Law"- Comb (Pure f) <*> Comb (Pure x) = pure (f H..@ x)+ Comb (Pure f) <*> Comb (Pure x) = pure (f Prod..@ x) -- & trace "Homomorphism Law"+ {- Comb (Pure f) <*> Comb (g :<$>: p) = -- This is basically a shortcut,- -- it can be caught by the Composition Law- -- and Homomorphism Law.- (H..) H..@ f H..@ g <$> p+ -- it can be caught by one Composition Law+ -- and two Homomorphism Law.+ (Prod..) Prod..@ f Prod..@ g <$> p -- & trace "Functor Composition Law"- u <*> Comb (v :<*>: w) = (((H..) <$> u) <*> v) <*> w- -- & trace "Composition Law"- u <*> Comb (Pure x) = H.flip H..@ (H.$) H..@ x <$> u+ -}+ u <*> Comb (Pure x) = Prod.flip Prod..@ (Prod.$) Prod..@ x <$> u -- & trace "Interchange Law"+ u <*> Comb (v :<*>: w) = (((Prod..) <$> u) <*> v) <*> w+ -- & trace "Composition Law" Comb (u :*>: v) <*> w = u *> (v <*> w) -- & trace "Reassociation Law 1" u <*> Comb (v :<*: w) = (u <*> v) <* w@@ -154,7 +201,7 @@ u <*> Comb (v :$>: x) = (u <*> pure x) <* v -- & trace "Reassociation Law 3" p <*> Comb (NegLook q) =- (p <*> pure H.unit) <* negLook (q)+ (p <*> pure Prod.unit) <* negLook q -- & trace "Absorption Law" x <*> y = SomeComb (x :<*>: y) @@ -184,162 +231,65 @@ -- & trace "Associativity Law" x <* y = SomeComb (x :<*: y) --- Alternable-data instance Comb Alternable repr a where- Empty :: Comb Alternable repr a- (:<|>:) :: SomeComb repr a -> SomeComb repr a -> Comb Alternable repr a- Try :: SomeComb repr a -> Comb Alternable repr a-infixl 3 :<|>:-instance Alternable repr => Trans (Comb Alternable repr) repr where- trans = \case- Empty -> empty- f :<|>: x -> trans f <|> trans x- Try x -> try (trans x)-instance- ( Alternable repr- , Applicable repr- , Lookable repr- , Matchable repr- , Selectable repr- ) => Alternable (SomeComb repr) where- empty = SomeComb Empty-- p@(Comb Pure{}) <|> _ = p- -- & trace "Left Catch Law"- Comb Empty <|> u = u- -- & trace "Left Neutral Law"- u <|> Comb Empty = u- -- & trace "Right Neutral Law"- Comb (u :<|>: v) <|> w = u <|> (v <|> w)- -- & trace "Associativity Law"- Comb (Look p) <|> Comb (Look q) = look (try p <|> q)- -- & trace "Distributivity Law"- x <|> y = SomeComb (x :<|>: y)-- try (Comb (p :$>: x)) = try p $> x- -- & trace "Try Interchange Law"- try (Comb (f :<$>: p)) = f <$> try p- -- & trace "Try Interchange Law"- try x = SomeComb (Try x)+-- CombFoldable+data instance Comb CombFoldable repr a where+ ChainPreC :: SomeComb repr (a -> a) -> SomeComb repr a -> Comb CombFoldable repr a+ ChainPostC :: SomeComb repr a -> SomeComb repr (a -> a) -> Comb CombFoldable repr a+instance CombFoldable repr => Derivable (Comb CombFoldable repr) where+ derive = \case+ ChainPreC x y -> chainPre (derive x) (derive y)+ ChainPostC x y -> chainPost (derive x) (derive y)+instance CombFoldable repr => CombFoldable (SomeComb repr) where+ chainPre x = SomeComb . ChainPreC x+ chainPost x = SomeComb . ChainPostC x --- Selectable-data instance Comb Selectable repr a where- Branch ::- SomeComb repr (Either a b) ->- SomeComb repr (a -> c) ->- SomeComb repr (b -> c) ->- Comb Selectable repr c-instance Selectable repr => Trans (Comb Selectable repr) repr where- trans = \case- Branch lr l r -> branch (trans lr) (trans l) (trans r)+-- Letable+data instance Comb (Letable letName) repr a where+ Shareable :: letName -> SomeComb repr a -> Comb (Letable letName) repr a+ Ref :: Bool -> letName -> Comb (Letable letName) repr a instance- ( Applicable repr- , Alternable repr- , Lookable repr- , Selectable repr- , Matchable repr- ) => Selectable (SomeComb repr) where- branch (Comb Empty) _ _ = empty- -- & trace "Branch Absorption Law"- branch b (Comb Empty) (Comb Empty) = b *> empty- -- & trace "Branch Weakening Law"- branch (Comb (Pure (trans -> lr))) l r =- case H.value lr of- Left value -> l <*> pure (trans H.ValueCode{..})- where code = [|| case $$(H.code lr) of Left x -> x ||]- Right value -> r <*> pure (trans H.ValueCode{..})- where code = [|| case $$(H.code lr) of Right x -> x ||]- -- & trace "Branch Pure Left/Right Law" $- branch b (Comb (Pure (trans -> l))) (Comb (Pure (trans -> r))) =- trans H.ValueCode{..} <$> b- -- & trace "Branch Generalised Identity Law"- where- value = either (H.value l) (H.value r)- code = [|| either $$(H.code l) $$(H.code r) ||]- branch (Comb (x :*>: y)) p q = x *> branch y p q- -- & trace "Interchange Law"- branch b l (Comb Empty) =- branch (pure (trans (H.ValueCode{..})) <*> b) empty l- -- & trace "Negated Branch Law"- where- value = either Right Left- code = [||either Right Left||]- branch (Comb (Branch b (Comb Empty) (Comb (Pure (trans -> lr))))) (Comb Empty) br =- branch (pure (trans H.ValueCode{..}) <*> b) empty br- -- & trace "Branch Fusion Law"- where- value Left{} = Left ()- value (Right r) = case H.value lr r of- Left _ -> Left ()- Right rr -> Right rr- code = [|| \case Left{} -> Left ()- Right r -> case $$(H.code lr) r of- Left _ -> Left ()- Right rr -> Right rr ||]- branch b l r = SomeComb (Branch b l r)---- Matchable-data instance Comb Matchable repr a where- Conditional :: Eq a =>- SomeComb repr a ->- [TermGrammar (a -> Bool)] ->- [SomeComb repr b] ->- SomeComb repr b ->- Comb Matchable repr b-instance Matchable repr => Trans (Comb Matchable repr) repr where- trans = \case- Conditional a ps bs b -> conditional (trans a) ps (trans Functor.<$> bs) (trans b)+ Letable letName repr =>+ Derivable (Comb (Letable letName) repr) where+ derive = \case+ Shareable n x -> shareable n (derive x)+ Ref isRec n -> ref isRec n instance- ( Applicable repr- , Alternable repr- , Lookable repr- , Selectable repr- , Matchable repr- ) => Matchable (SomeComb repr) where- conditional (Comb Empty) _ _ d = d- -- & trace "Conditional Absorption Law"- conditional p _ qs (Comb Empty)- | Foldable.all (\case { Comb Empty -> True; _ -> False }) qs = p *> empty- -- & trace "Conditional Weakening Law"- conditional a _ps bs (Comb Empty)- | Foldable.all (\case { Comb Empty -> True; _ -> False }) bs = a *> empty- -- & trace "Conditional Weakening Law"- conditional (Comb (Pure (trans -> a))) ps bs d =- Foldable.foldr (\(trans -> p, b) next ->- if H.value p (H.value a) then b else next- ) d (List.zip ps bs)- -- & trace "Conditional Pure Law"- conditional a ps bs d = SomeComb (Conditional a ps bs d)+ (Letable letName repr, Typeable letName) =>+ Letable letName (SomeComb repr) where+ shareable n = SomeComb . Shareable n+ ref isRec = SomeComb . Ref isRec --- Foldable-data instance Comb Foldable repr a where- ChainPreC :: SomeComb repr (a -> a) -> SomeComb repr a -> Comb Foldable repr a- ChainPostC :: SomeComb repr a -> SomeComb repr (a -> a) -> Comb Foldable repr a-instance Foldable repr => Trans (Comb Foldable repr) repr where- trans = \case- ChainPreC x y -> chainPre (trans x) (trans y)- ChainPostC x y -> chainPost (trans x) (trans y)-instance Foldable repr => Foldable (SomeComb repr) where- chainPre x = SomeComb . ChainPreC x- chainPost x = SomeComb . ChainPostC x+-- Letsable+data instance Comb (Letsable letName) repr a where+ Lets :: LetBindings letName (SomeComb repr) ->+ SomeComb repr a -> Comb (Letsable letName) repr a+instance+ Letsable letName repr =>+ Derivable (Comb (Letsable letName) repr) where+ derive = \case+ Lets defs x -> lets ((\(SomeLet sub) -> SomeLet (derive sub)) Functor.<$> defs) (derive x)+instance+ (Letsable letName repr, Typeable letName) =>+ Letsable letName (SomeComb repr) where+ lets defs = SomeComb . Lets defs --- Lookable-data instance Comb Lookable repr a where- Look :: SomeComb repr a -> Comb Lookable repr a- NegLook :: SomeComb repr a -> Comb Lookable repr ()- Eof :: Comb Lookable repr ()-instance Lookable repr => Trans (Comb Lookable repr) repr where- trans = \case- Look x -> look (trans x)- NegLook x -> negLook (trans x)+-- CombLookable+data instance Comb CombLookable repr a where+ Look :: SomeComb repr a -> Comb CombLookable repr a+ NegLook :: SomeComb repr a -> Comb CombLookable repr ()+ Eof :: Comb CombLookable repr ()+instance CombLookable repr => Derivable (Comb CombLookable repr) where+ derive = \case+ Look x -> look (derive x)+ NegLook x -> negLook (derive x) Eof -> eof instance- ( Alternable repr- , Applicable repr- , Lookable repr- , Selectable repr- , Matchable repr- ) => Lookable (SomeComb repr) where+ ( CombAlternable repr+ , CombApplicable repr+ , CombLookable repr+ , CombSelectable repr+ , CombMatchable repr+ ) => CombLookable (SomeComb repr) where look p@(Comb Pure{}) = p -- & trace "Pure Look Law" look p@(Comb Empty) = p@@ -356,15 +306,16 @@ negLook (Comb Pure{}) = empty -- & trace "Pure Negative-Look"- negLook (Comb Empty) = pure H.unit+ negLook (Comb Empty) = pure Prod.unit -- & trace "Dead Negative-Look"- negLook (Comb (NegLook x)) = look (try x *> pure H.unit)+ negLook (Comb (NegLook x)) = look (try x *> pure Prod.unit) -- & trace "Double Negation Law" negLook (Comb (Try x)) = negLook x -- & trace "Zero Consumption Law" negLook (Comb (Look x)) = negLook x -- & trace "Right Identity Law"- negLook (Comb (Comb (Try p) :<|>: q)) = negLook p *> negLook q+ negLook (Comb (Alt _exn (Comb (Try p)) q)) = negLook p *> negLook q+ -- FIXME: see if this really holds for all exceptions. -- & trace "Transparency Law" negLook (Comb (p :$>: _)) = negLook p -- & trace "NegLook Idempotence Law"@@ -372,38 +323,127 @@ eof = SomeComb Eof --- Satisfiable-data instance Comb (Satisfiable tok) repr a where- Satisfy ::- Satisfiable tok repr =>- [ErrorItem tok] ->- TermGrammar (tok -> Bool) ->- Comb (Satisfiable tok) repr tok- Item ::- Satisfiable tok repr =>- Comb (Satisfiable tok) repr tok-instance Satisfiable tok repr => Trans (Comb (Satisfiable tok) repr) repr where- trans = \case- Satisfy es p -> satisfy es p- Item -> item+-- CombMatchable+data instance Comb CombMatchable repr a where+ Conditional :: Eq a =>+ SomeComb repr a ->+ [Production (a -> Bool)] ->+ [SomeComb repr b] ->+ SomeComb repr b ->+ Comb CombMatchable repr b+instance CombMatchable repr => Derivable (Comb CombMatchable repr) where+ derive = \case+ Conditional a ps bs b ->+ conditional (derive a)+ (optimizeProduction Functor.<$> ps)+ (derive Functor.<$> bs) (derive b) instance- (Satisfiable tok repr, Typeable tok) =>- Satisfiable tok (SomeComb repr) where- satisfy es = SomeComb . Satisfy es- item = SomeComb Item+ ( CombApplicable repr+ , CombAlternable repr+ , CombLookable repr+ , CombSelectable repr+ , CombMatchable repr+ ) => CombMatchable (SomeComb repr) where+ conditional (Comb Empty) _ _ d = d+ -- & trace "Conditional Absorption Law"+ conditional p _ qs (Comb Empty)+ | Foldable.all (\case { Comb Empty -> True; _ -> False }) qs = p *> empty+ -- & trace "Conditional Weakening Law"+ conditional a _ps bs (Comb Empty)+ | Foldable.all (\case { Comb Empty -> True; _ -> False }) bs = a *> empty+ -- & trace "Conditional Weakening Law"+ conditional (Comb (Pure a)) ps bs d =+ Foldable.foldr (\(p, b) next ->+ if runValue (p Prod..@ a) then b else next+ ) d (List.zip ps bs)+ -- & trace "Conditional Pure Law"+ conditional a ps bs d = SomeComb (Conditional a ps bs d) --- Letable-data instance Comb (Letable letName) repr a where- Def :: letName -> SomeComb repr a -> Comb (Letable letName) repr a- Ref :: Bool -> letName -> Comb (Letable letName) repr a-instance Letable letName repr => Trans (Comb (Letable letName) repr) repr where- trans = \case- Def n v -> def n (trans v)- Ref isRec n -> ref isRec n+-- CombSatisfiable+data instance Comb (CombSatisfiable tok) repr a where+ -- | To include the @('Set' 'SomeFailure')@ is a little kludge+ -- it would be cleaner to be able to pattern-match+ -- on @(alt exn (Comb 'Satisfy'{}) (Failure{}))@+ -- when generating 'Program', but this is not easily possible then+ -- because data types have already been converted back to class methods,+ -- hence pattern-matching is no longer possible+ -- (at least not without reintroducing data types).+ SatisfyOrFail ::+ CombSatisfiable tok repr =>+ Set SomeFailure ->+ Production (tok -> Bool) ->+ Comb (CombSatisfiable tok) repr tok instance- (Letable letName repr, Typeable letName) =>- Letable letName (SomeComb repr) where- def n = SomeComb . Def n- ref isRec = SomeComb . Ref isRec-instance MakeLetName TH.Name where- makeLetName _ = TH.qNewName "name"+ CombSatisfiable tok repr =>+ Derivable (Comb (CombSatisfiable tok) repr) where+ derive = \case+ SatisfyOrFail fs p -> satisfyOrFail fs (optimizeProduction p)+instance+ (CombSatisfiable tok repr, Typeable tok) =>+ CombSatisfiable tok (SomeComb repr) where+ satisfyOrFail fs = SomeComb . SatisfyOrFail fs++-- CombSelectable+data instance Comb CombSelectable repr a where+ Branch ::+ SomeComb repr (Either a b) ->+ SomeComb repr (a -> c) ->+ SomeComb repr (b -> c) ->+ Comb CombSelectable repr c+instance CombSelectable repr => Derivable (Comb CombSelectable repr) where+ derive = \case+ Branch lr l r -> branch (derive lr) (derive l) (derive r)+instance+ ( CombApplicable repr+ , CombAlternable repr+ , CombLookable repr+ , CombSelectable repr+ , CombMatchable repr+ ) => CombSelectable (SomeComb repr) where+ branch (Comb Empty) _ _ = empty+ -- & trace "Branch Absorption Law"+ branch b (Comb Empty) (Comb Empty) = b *> empty+ -- & trace "Branch Weakening Law"+ branch (Comb (Pure lr)) l r =+ case runValue lr of+ Left value -> l <*> pure (Pair v c)+ where+ v = Prod.SomeData $ Prod.Var $ Identity value+ c = Prod.SomeData $ Prod.Var+ [|| case $$(runCode lr) of Left x -> x ||]+ Right value -> r <*> pure (Pair v c)+ where+ v = Prod.SomeData $ Prod.Var $ Identity value+ c = Prod.SomeData $ Prod.Var+ [|| case $$(runCode lr) of Right x -> x ||]+ -- & trace "Branch Pure Either Law"+ branch b (Comb (Pure l)) (Comb (Pure r)) =+ Pair v c <$> b+ -- & trace "Branch Generalised Identity Law"+ where+ v = Prod.SomeData $ Prod.Var $ Identity $ either (runValue l) (runValue r)+ c = Prod.SomeData $ Prod.Var [|| either $$(runCode l) $$(runCode r) ||]+ branch (Comb (x :*>: y)) p q = x *> branch y p q+ -- & trace "Interchange Law"+ branch b l (Comb Empty) =+ branch (pure (Pair v c) <*> b) empty l+ -- & trace "Negated Branch Law"+ where+ v = Prod.SomeData $ Prod.Var $ Identity $ either Right Left+ c = Prod.SomeData $ Prod.Var $ [||either Right Left||]+ branch (Comb (Branch b (Comb Empty) (Comb (Pure lr)))) (Comb Empty) br =+ branch (pure (Pair v c) <*> b) empty br+ -- & trace "Branch Fusion Law"+ where+ v = Prod.SomeData $ Prod.Var $ Identity $ \case+ Left{} -> Left ()+ Right r ->+ case runValue lr r of+ Left{} -> Left ()+ Right rr -> Right rr+ c = Prod.SomeData $ Prod.Var+ [|| \case Left{} -> Left ()+ Right r -> case $$(runCode lr) r of+ Left{} -> Left ()+ Right rr -> Right rr ||]+ branch b l r = SomeComb (Branch b l r)
+ src/Symantic/Parser/Grammar/Production.hs view
@@ -0,0 +1,189 @@+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE StandaloneDeriving #-} -- For prodCon+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE DeriveLift #-}+{-# LANGUAGE UndecidableInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Symantic.Parser.Grammar.Production where++import Control.Monad (Monad(..))+import Data.Functor.Identity (Identity(..))+import Data.Functor.Product (Product(..))+import Prelude (Num(..), undefined)+import Text.Show (Show(..), showString)+import Type.Reflection (Typeable)+import qualified Data.Either as Either+import qualified Data.Eq as Eq+import qualified Data.Function as Fun+import qualified Data.Maybe as Maybe+import qualified Language.Haskell.TH as TH+import qualified Language.Haskell.TH.Syntax as TH+import qualified Language.Haskell.TH.Show as TH++import Symantic.Typed.Data+import Symantic.Typed.Lang+import Symantic.Typed.Optimize+import Symantic.Typed.Derive++type Production = Product+ (SomeData Identity)+ (SomeData TH.CodeQ)++{-# INLINE prodValue #-}+prodValue :: Production a -> SomeData Identity a+prodValue (Pair v _) = v+{-# INLINE prodCode #-}+prodCode :: Production a -> SomeData TH.CodeQ a+prodCode (Pair _ c) = c++{-# INLINE production #-}+production :: a -> TH.CodeQ a -> Production a+production v c = Pair+ (SomeData (Var (Identity v)))+ (SomeData (Var c))++{-# INLINE prod #-}+prod :: TH.Lift a => a -> Production a+prod x = production x [||x||]++{-# INLINE runValue #-}+runValue :: Production a -> a+runValue (Pair v _c) = runIdentity (derive v)+{-# INLINE runCode #-}+runCode :: Production a -> TH.CodeQ a+runCode (Pair _v c) = derive c++-- Missing instances in 'Language.Haskell.TH',+-- needed for 'prodCon'.+deriving instance TH.Lift TH.OccName+deriving instance TH.Lift TH.NameFlavour+deriving instance TH.Lift TH.ModName+deriving instance TH.Lift TH.PkgName+deriving instance TH.Lift TH.NameSpace+deriving instance TH.Lift TH.Name++-- | @$(prodCon 'SomeConstructor)@ generates the 'Production' for @SomeConstructor@.+prodCon :: TH.Name -> TH.Q TH.Exp+prodCon name = do+ info <- TH.reify name+ case info of+ TH.DataConI n _ty _pn ->+ [| production $(return (TH.ConE n))+ (TH.unsafeCodeCoerce (return (TH.ConE $(TH.lift n)))) |]++instance Show (SomeData TH.CodeQ a) where+ -- The 'Derivable' constraint contained in 'SomeData'+ -- is 'TH.CodeQ', hence 'Symantic.Typed.View' cannot be used here.+ -- Fortunately 'TH.showCode' can be implemented.+ showsPrec p = showString Fun.. TH.showCode p Fun.. derive++instance (Abstractable f, Abstractable g) => Abstractable (Product f g) where+ -- Those 'undefined' are not unreachables by 'f'+ -- but this is the cost to pay for defining this instance.+ -- In particular, 'f' must not define the 'TH.CodeQ' part+ -- using the 'Identity' part.+ lam f = Pair+ (lam (\x -> let Pair fx _ = f (Pair x undefined) in fx))+ (lam (\y -> let Pair _ fy = f (Pair undefined y) in fy))+ lam1 f = Pair+ (lam1 (\x -> let Pair fx _ = f (Pair x undefined) in fx))+ (lam1 (\y -> let Pair _ fy = f (Pair undefined y) in fy))+ const = Pair const const+ var = Fun.id+ id = Pair id id+ flip = Pair flip flip+ Pair f1 f2 .@ Pair x1 x2 = Pair (f1 .@x1) (f2 .@x2)+ (.) = Pair (.) (.)+ ($) = Pair ($) ($)+instance (Num (f a), Num (g a)) => Num (Product f g a) where+ Pair x1 x2 + Pair y1 y2 = Pair (x1 + y1) (x2 + y2)+ Pair x1 x2 * Pair y1 y2 = Pair (x1 * y1) (x2 * y2)+ Pair x1 x2 - Pair y1 y2 = Pair (x1 - y1) (x2 - y2)+ abs (Pair x1 x2) = Pair (abs x1) (abs x2)+ fromInteger i = Pair (fromInteger i) (fromInteger i)+ negate (Pair x1 x2) = Pair (negate x1) (negate x2)+ signum (Pair x1 x2) = Pair (signum x1) (signum x2)+instance (Eitherable f, Eitherable g) => Eitherable (Product f g) where+ left = Pair left left+ right = Pair right right+instance (TH.Lift c, Typeable c) => Constantable c Production where+ constant c = Pair (constant c) (constant c)+instance Maybeable Production where+ nothing = Pair nothing nothing+ just = Pair just just+instance Listable Production where+ nil = Pair nil nil+ cons = Pair cons cons+instance Equalable Production where+ equal = Pair equal equal++optimizeProduction :: Production a -> Production a+optimizeProduction (Pair v c) = Pair (normalOrderReduction v) (normalOrderReduction c)++-- Identity+instance Anythingable Identity+instance Abstractable Identity where+ f .@ x = Identity (runIdentity f (runIdentity x))+ lam f = Identity (runIdentity Fun.. f Fun.. Identity)+ lam1 = lam+ var = Fun.id+ const = Identity Fun.const+ flip = Identity Fun.flip+ id = Identity Fun.id+ ($) = Identity (Fun.$)+ (.) = Identity (Fun..)+instance Constantable c Identity where+ constant = Identity+instance Eitherable Identity where+ left = Identity Either.Left+ right = Identity Either.Right+instance Equalable Identity where+ equal = Identity (Eq.==)+instance IfThenElseable Identity where+ ifThenElse test ok ko = Identity+ (if runIdentity test+ then runIdentity ok+ else runIdentity ko)+instance Listable Identity where+ cons = Identity (:)+ nil = Identity []+instance Maybeable Identity where+ nothing = Identity Maybe.Nothing+ just = Identity Maybe.Just++-- TH.CodeQ+instance Anythingable TH.CodeQ+instance Abstractable TH.CodeQ where+ (.@) f x = [|| $$f $$x ||]+ lam f = [|| \x -> $$(f [||x||]) ||]+ lam1 = lam+ var = Fun.id+ id = [|| \x -> x ||]+ const = [|| Fun.const ||]+ flip = [|| \f x y -> f y x ||]+ ($) = [|| (Fun.$) ||]+ (.) = [|| (Fun..) ||]+instance TH.Lift c => Constantable c TH.CodeQ where+ constant c = [|| c ||]+instance Eitherable TH.CodeQ where+ left = [|| Either.Left ||]+ right = [|| Either.Right ||]+instance Equalable TH.CodeQ where+ equal = [|| (Eq.==) ||]+instance IfThenElseable TH.CodeQ where+ ifThenElse test ok ko = [|| if $$test then $$ok else $$ko ||]+instance Listable TH.CodeQ where+ cons = [|| (:) ||]+ nil = [|| [] ||]+instance Maybeable TH.CodeQ where+ nothing = [|| Maybe.Nothing ||]+ just = [|| Maybe.Just ||]+instance Num a => Num (TH.CodeQ a) where+ x + y = [|| $$x + $$y||]+ x * y = [|| $$x * $$y||]+ x - y = [|| $$x - $$y||]+ abs x = [|| abs $$x ||]+ fromInteger i = [|| fromInteger $$(TH.liftTyped i) ||]+ negate x = [|| negate $$x ||]+ signum x = [|| signum $$x ||]
src/Symantic/Parser/Grammar/View.hs view
@@ -1,74 +1,92 @@+{-# LANGUAGE OverloadedStrings #-} module Symantic.Parser.Grammar.View where import Data.Bool (Bool)-import Data.Function (($), (.), id)+import Data.Eq (Eq(..))+import Data.Function (($), (.), id, on)+import Data.Ord (Ord(..)) import Data.Semigroup (Semigroup(..))-import Data.String (String, IsString(..))+import Data.String (String)+import Data.Tuple (fst) import Text.Show (Show(..))-import qualified Control.Applicative as Fct-import qualified Data.Tree as Tree+import qualified Data.Functor as Functor+import qualified Data.HashMap.Strict as HM import qualified Data.List as List+import qualified Data.Tree as Tree -import Symantic.Univariant.Letable+import Symantic.Typed.ObserveSharing import Symantic.Parser.Grammar.Combinators+import qualified Symantic.Parser.Grammar.Production as Prod -- * Type 'ViewGrammar' newtype ViewGrammar (showName::Bool) a = ViewGrammar { unViewGrammar ::- Tree.Tree String }+ Tree.Tree (String, String) } viewGrammar :: ViewGrammar sN a -> ViewGrammar sN a viewGrammar = id instance Show (ViewGrammar sN a) where- show = drawTree . unViewGrammar+ show = List.unlines . draw . unViewGrammar where- drawTree :: Tree.Tree String -> String- drawTree = List.unlines . draw- draw :: Tree.Tree String -> [String]- draw (Tree.Node x ts0) = List.lines x <> drawSubTrees ts0- where- drawSubTrees [] = []- drawSubTrees [t] = shift "` " " " (draw t)- drawSubTrees (t:ts) = shift "+ " "| " (draw t) <> drawSubTrees ts- shift first other = List.zipWith (<>) (first : List.repeat other)-instance IsString (ViewGrammar sN a) where- fromString s = ViewGrammar $ Tree.Node (fromString s) []+ draw :: Tree.Tree (String, String) -> [String]+ draw (Tree.Node (x, n) ts0) =+ (List.zipWith (<>) (List.lines x) (n : List.repeat "")) <>+ (drawTrees ts0)+ drawTrees [] = []+ drawTrees [t] = shift "` " " " (draw t)+ drawTrees (t:ts) = shift "+ " "| " (draw t) <> drawTrees ts+ shift ind0 ind = List.zipWith (<>) (ind0 : List.repeat ind) +instance CombAlternable (ViewGrammar sN) where+ empty = ViewGrammar $ Tree.Node ("empty", "") []+ alt exn x y = ViewGrammar $ Tree.Node+ ("<|>" <> if exn == ExceptionFailure then "" else ("^"<>show exn), "")+ [unViewGrammar x, unViewGrammar y]+ throw exn = ViewGrammar $ Tree.Node ("throw "<>show exn, "") []+ failure _sf = ViewGrammar $ Tree.Node ("failure", "") []+ try x = ViewGrammar $ Tree.Node ("try", "") [unViewGrammar x]+instance CombApplicable (ViewGrammar sN) where+ _f <$> x = ViewGrammar $ Tree.Node ("<$>", "") [unViewGrammar x]+ pure a = ViewGrammar $ Tree.Node ("pure " <> showsPrec 10 (Prod.prodCode a) "", "") []+ x <*> y = ViewGrammar $ Tree.Node ("<*>", "") [unViewGrammar x, unViewGrammar y]+ x <* y = ViewGrammar $ Tree.Node ("<*", "") [unViewGrammar x, unViewGrammar y]+ x *> y = ViewGrammar $ Tree.Node ("*>", "") [unViewGrammar x, unViewGrammar y]+instance CombFoldable (ViewGrammar sN) where+ chainPre f x = ViewGrammar $ Tree.Node ("chainPre", "") [unViewGrammar f, unViewGrammar x]+ chainPost x f = ViewGrammar $ Tree.Node ("chainPost", "") [unViewGrammar x, unViewGrammar f] instance ShowLetName sN letName => Letable letName (ViewGrammar sN) where- def name x = ViewGrammar $- Tree.Node ("def "<>showLetName @sN name) [unViewGrammar x]- ref rec name = ViewGrammar $+ shareable name x = ViewGrammar $+ Tree.Node ("shareable", " "<>showLetName @sN name) [unViewGrammar x]+ ref isRec name = ViewGrammar $ Tree.Node- ( (if rec then "rec " else "ref ")- <> showLetName @sN name+ ( if isRec then "rec" else "ref"+ , " "<>showLetName @sN name ) []-instance Applicable (ViewGrammar sN) where- _f <$> x = ViewGrammar $ Tree.Node "<$>" [unViewGrammar x]- pure a = ViewGrammar $ Tree.Node ("pure "<>showsPrec 10 a "") []- x <*> y = ViewGrammar $ Tree.Node "<*>" [unViewGrammar x, unViewGrammar y]- x <* y = ViewGrammar $ Tree.Node "<*" [unViewGrammar x, unViewGrammar y]- x *> y = ViewGrammar $ Tree.Node "*>" [unViewGrammar x, unViewGrammar y]-instance Alternable (ViewGrammar sN) where- empty = ViewGrammar $ Tree.Node "empty" []- x <|> y = ViewGrammar $ Tree.Node "<|>" [unViewGrammar x, unViewGrammar y]- try x = ViewGrammar $ Tree.Node "try" [unViewGrammar x]-instance Satisfiable tok (ViewGrammar sN) where- satisfy _es _p = ViewGrammar $ Tree.Node "satisfy" []-instance Selectable (ViewGrammar sN) where- branch lr l r = ViewGrammar $ Tree.Node "branch"- [ unViewGrammar lr, unViewGrammar l, unViewGrammar r ]-instance Matchable (ViewGrammar sN) where- conditional a _ps bs b = ViewGrammar $ Tree.Node "conditional"+instance+ ShowLetName sN letName =>+ Letsable letName (ViewGrammar sN) where+ lets defs x = ViewGrammar $+ Tree.Node ("lets", "") $+ (<> [unViewGrammar x]) $+ List.sortBy (compare `on` (((fst Functor.<$>) Functor.<$>) . Tree.levels)) $+ HM.foldrWithKey'+ (\name (SomeLet val) ->+ (Tree.Node ("let", " "<>showLetName @sN name) [unViewGrammar val] :))+ [] defs+instance CombLookable (ViewGrammar sN) where+ look x = ViewGrammar $ Tree.Node ("look", "") [unViewGrammar x]+ negLook x = ViewGrammar $ Tree.Node ("negLook", "") [unViewGrammar x]+ eof = ViewGrammar $ Tree.Node ("eof", "") []+instance CombMatchable (ViewGrammar sN) where+ conditional a _ps bs b = ViewGrammar $ Tree.Node ("conditional", "") [ unViewGrammar a- , Tree.Node "bs" (unViewGrammar Fct.<$> bs)+ , Tree.Node ("branches", "") (unViewGrammar Functor.<$> bs) , unViewGrammar b ]-instance Lookable (ViewGrammar sN) where- look x = ViewGrammar $ Tree.Node "look" [unViewGrammar x]- negLook x = ViewGrammar $ Tree.Node "negLook" [unViewGrammar x]- eof = ViewGrammar $ Tree.Node "eof" []-instance Foldable (ViewGrammar sN) where- chainPre f x = ViewGrammar $ Tree.Node "chainPre" [unViewGrammar f, unViewGrammar x]- chainPost x f = ViewGrammar $ Tree.Node "chainPost" [unViewGrammar x, unViewGrammar f]+instance CombSatisfiable tok (ViewGrammar sN) where+ satisfyOrFail _fs _p = ViewGrammar $ Tree.Node ("satisfy", "") []+instance CombSelectable (ViewGrammar sN) where+ branch lr l r = ViewGrammar $ Tree.Node ("branch", "")+ [ unViewGrammar lr, unViewGrammar l, unViewGrammar r ]
src/Symantic/Parser/Grammar/Write.hs view
@@ -8,17 +8,20 @@ import Data.Monoid (Monoid(..)) import Data.Semigroup (Semigroup(..)) import Data.String (IsString(..))-import qualified Data.Functor as Pre+import Text.Show (Show(..))+import qualified Data.Functor as Functor+import qualified Data.HashMap.Strict as HM import qualified Data.List as List import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Builder as TLB -import Symantic.Univariant.Letable+import Symantic.Typed.ObserveSharing+import Symantic.Typed.Fixity import Symantic.Parser.Grammar.Combinators-import Symantic.Parser.Grammar.Fixity -- * Type 'WriteGrammar'-newtype WriteGrammar (showName::Bool) a = WriteGrammar { unWriteGrammar :: WriteGrammarInh -> Maybe TLB.Builder }+newtype WriteGrammar (showName::Bool) a = WriteGrammar { unWriteGrammar ::+ WriteGrammarInh -> Maybe TLB.Builder } instance IsString (WriteGrammar sN a) where fromString s = WriteGrammar $ \_inh ->@@ -41,7 +44,9 @@ } writeGrammar :: WriteGrammar sN a -> TL.Text-writeGrammar (WriteGrammar r) = TLB.toLazyText $ fromMaybe "" $ r emptyWriteGrammarInh+writeGrammar (WriteGrammar go) =+ TLB.toLazyText $ fromMaybe "" $+ go emptyWriteGrammarInh pairWriteGrammarInh :: Semigroup s => IsString s =>@@ -52,23 +57,32 @@ else s where (o,c) = writeGrammarInh_pair inh -instance- ShowLetName sN letName =>- Letable letName (WriteGrammar sN) where- def name x = WriteGrammar $ \inh ->+instance CombAlternable (WriteGrammar sN) where+ alt exn x y = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "def "- <> Just (fromString (showLetName @sN name))- <> unWriteGrammar x inh+ unWriteGrammar x inh+ { writeGrammarInh_op = (op, SideL)+ , writeGrammarInh_pair = pairParen+ } <>+ Just (" |^"<>fromString (show exn)<>" ") <>+ unWriteGrammar y inh+ { writeGrammarInh_op = (op, SideR)+ , writeGrammarInh_pair = pairParen+ }+ where op = infixB SideL 3+ throw exn = WriteGrammar $ \inh ->+ pairWriteGrammarInh inh op $+ Just ("throw "<>fromString (show exn)) where op = infixN 9- ref rec name = WriteGrammar $ \inh ->+ failure _sf = "failure"+ empty = "empty"+ try x = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just (if rec then "rec " else "ref ") <>- Just (fromString (showLetName @sN name))+ Just "try " <> unWriteGrammar x inh where op = infixN 9-instance Applicable (WriteGrammar sN) where+instance CombApplicable (WriteGrammar sN) where pure _ = WriteGrammar $ return Nothing -- pure _ = "pure" WriteGrammar x <*> WriteGrammar y = WriteGrammar $ \inh ->@@ -86,50 +100,50 @@ Just $ xt <> ", " <> yt where op = infixN 1-instance Alternable (WriteGrammar sN) where- empty = "empty"- try x = WriteGrammar $ \inh ->+instance CombFoldable (WriteGrammar sN) where+ chainPre f x = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "try " <> unWriteGrammar x inh+ Just "chainPre " <>+ unWriteGrammar f inh <> Just " " <>+ unWriteGrammar x inh+ where op = infixN 9+ chainPost f x = WriteGrammar $ \inh ->+ pairWriteGrammarInh inh op $+ Just "chainPost " <>+ unWriteGrammar f inh <> Just " " <>+ unWriteGrammar x inh+ where op = infixN 9+instance+ ShowLetName sN letName =>+ Letable letName (WriteGrammar sN) where+ shareable name x = WriteGrammar $ \inh ->+ pairWriteGrammarInh inh op $+ Just "shareable "+ <> Just (fromString (showLetName @sN name))+ <> unWriteGrammar x inh where op = infixN 9- x <|> y = WriteGrammar $ \inh ->- pairWriteGrammarInh inh op $- unWriteGrammar x inh- { writeGrammarInh_op = (op, SideL)- , writeGrammarInh_pair = pairParen- } <>- Just " | " <>- unWriteGrammar y inh- { writeGrammarInh_op = (op, SideR)- , writeGrammarInh_pair = pairParen- }- where op = infixB SideL 3-instance Satisfiable tok (WriteGrammar sN) where- satisfy _es _f = "satisfy"-instance Selectable (WriteGrammar sN) where- branch lr l r = WriteGrammar $ \inh ->+ ref rec name = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "branch " <>- unWriteGrammar lr inh <> Just " " <>- unWriteGrammar l inh <> Just " " <>- unWriteGrammar r inh+ Just (if rec then "rec " else "ref ") <>+ Just (fromString (showLetName @sN name)) where op = infixN 9-instance Matchable (WriteGrammar sN) where- conditional a _ps bs d = WriteGrammar $ \inh ->+instance+ ShowLetName sN letName =>+ Letsable letName (WriteGrammar sN) where+ lets defs x = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "conditional " <>- unWriteGrammar a inh <>- Just " [" <>- Just (mconcat (List.intersperse ", " $- catMaybes $ (Pre.<$> bs) $ \x ->- unWriteGrammar x inh{writeGrammarInh_op=(infixN 0, SideL)})) <>- Just "] " <>- unWriteGrammar d inh+ Just "let "+ <> HM.foldMapWithKey+ (\name (SomeLet val) ->+ Just (fromString (showLetName @sN name))+ <> unWriteGrammar val inh)+ defs+ <> unWriteGrammar x inh where op = infixN 9-instance Lookable (WriteGrammar sN) where+instance CombLookable (WriteGrammar sN) where look x = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $ Just "look " <> unWriteGrammar x inh@@ -139,16 +153,27 @@ Just "negLook " <> unWriteGrammar x inh where op = infixN 9 eof = "eof"-instance Foldable (WriteGrammar sN) where- chainPre f x = WriteGrammar $ \inh ->+instance CombMatchable (WriteGrammar sN) where+ conditional a _ps bs d = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "chainPre " <>- unWriteGrammar f inh <> Just " " <>- unWriteGrammar x inh- where op = infixN 9- chainPost f x = WriteGrammar $ \inh ->+ Just "conditional " <>+ unWriteGrammar a inh <>+ Just " [" <>+ Just (mconcat (List.intersperse ", " $+ catMaybes $ (Functor.<$> bs) $ \x ->+ unWriteGrammar x inh{writeGrammarInh_op=(infixN 0, SideL)})) <>+ Just "] " <>+ unWriteGrammar d inh+ where+ op = infixN 9+instance CombSatisfiable tok (WriteGrammar sN) where+ satisfyOrFail _fs _f = "satisfy"+instance CombSelectable (WriteGrammar sN) where+ branch lr l r = WriteGrammar $ \inh -> pairWriteGrammarInh inh op $- Just "chainPost " <>- unWriteGrammar f inh <> Just " " <>- unWriteGrammar x inh- where op = infixN 9+ Just "branch " <>+ unWriteGrammar lr inh <> Just " " <>+ unWriteGrammar l inh <> Just " " <>+ unWriteGrammar r inh+ where+ op = infixN 9
− src/Symantic/Parser/Haskell.hs
@@ -1,8 +0,0 @@-module Symantic.Parser.Haskell- ( module Symantic.Parser.Haskell.Optimize- , module Symantic.Parser.Haskell.Term- , module Symantic.Parser.Haskell.View- ) where-import Symantic.Parser.Haskell.Optimize-import Symantic.Parser.Haskell.Term-import Symantic.Parser.Haskell.View
− src/Symantic/Parser/Haskell/Optimize.hs
@@ -1,194 +0,0 @@-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE ViewPatterns #-}-module Symantic.Parser.Haskell.Optimize where--import Data.Bool (Bool(..))-import Data.Functor.Identity (Identity(..))-import Data.String (String)-import Prelude (undefined)-import Text.Show (Show(..))-import qualified Data.Eq as Eq-import qualified Data.Function as Fun-import qualified Language.Haskell.TH as TH-import qualified Language.Haskell.TH.Syntax as TH--import Symantic.Univariant.Trans-import Symantic.Parser.Haskell.Term---- * Type 'Term'--- | Initial encoding of some 'Termable' symantics,--- useful for some optimizations in 'optimizeTerm'.-data Term repr a where- -- | Black-box for all terms neither interpreted nor pattern-matched.- Term :: { unTerm :: repr a } -> Term repr a-- -- Terms useful for 'optimizeTerm'.- (:@) :: Term repr (a->b) -> Term repr a -> Term repr b- Lam :: (Term repr a -> Term repr b) -> Term repr (a->b)- Lam1 :: (Term repr a -> Term repr b) -> Term repr (a->b)- Var :: String -> Term repr a-- -- Terms useful for prettier dumps.- Char :: (TH.Lift tok, Show tok) => tok -> Term repr tok- Cons :: Term repr (a -> [a] -> [a])- Eq :: Eq.Eq a => Term repr (a -> a -> Bool)- {-- Const :: Term repr (a -> b -> a)- Flip :: Term repr ((a -> b -> c) -> b -> a -> c)- Id :: Term repr (a->a)- (:$) :: Term repr ((a->b) -> a -> b)- -- (:.) :: Term repr ((b->c) -> (a->b) -> a -> c)--- infixr 0 :$--- infixr 9 :.- -}-infixl 9 :@--type instance Output (Term repr) = repr-instance Trans repr (Term repr) where- trans = Term--instance Termable repr => Termable (Term repr) where- lam = Lam- lam1 = Lam1- (.@) = (:@)- cons = Cons- eq = Eq- unit = Term unit- bool b = Term (bool b)- char = Char- nil = Term nil- left = Term left- right = Term right- nothing = Term nothing- just = Term just- const = Lam1 (\x -> Lam1 (\_y -> x))- flip = Lam1 (\f -> Lam1 (\x -> Lam1 (\y -> f .@ y .@ x)))- id = Lam1 (\x -> x)- ($) = Lam1 (\f -> Lam1 (\x -> f .@ x))- (.) = Lam1 (\f -> Lam1 (\g -> Lam1 (\x -> f .@ (g .@ x))))---- | Beta-reduce the left-most outer-most lambda abstraction (aka. normal-order reduction),--- but to avoid duplication of work, only those manually marked--- as using their variable at most once.--- This is mainly to get prettier splices.--- --- DOC: Demonstrating Lambda Calculus Reduction, Peter Sestoft, 2001,--- https://www.itu.dk/people/sestoft/papers/sestoft-lamreduce.pdf-optimizeTerm :: Term repr a -> Term repr a-optimizeTerm = nor- where- -- | normal-order reduction- nor :: Term repr a -> Term repr a- nor = \case- Lam f -> Lam (nor Fun.. f)- Lam1 f -> Lam1 (nor Fun.. f)- x :@ y -> case whnf x of- Lam1 f -> nor (f y)- x' -> nor x' :@ nor y- x -> x- -- | weak-head normal-form- whnf :: Term repr a -> Term repr a- whnf = \case- x :@ y -> case whnf x of- Lam1 f -> whnf (f y)- x' -> x' :@ y- x -> x--instance Trans (Term Identity) Identity where- trans = \case- Cons -> cons- Char t -> char t- Eq -> eq- Term repr -> repr- x :@ y -> Identity (runIdentity (trans x) (runIdentity (trans y)))- Lam f -> Identity (runIdentity Fun.. trans Fun.. f Fun.. Term Fun.. Identity)- Lam1 f -> trans (Lam f)- Var{} -> undefined- {-- Const -> const- Flip -> flip- Id -> id- (:$) -> ($)- -}-instance Trans (Term TH.CodeQ) TH.CodeQ where- -- Superfluous pattern-matches are only- -- out of a cosmetic concerns when reading *.dump-splices,- -- not for optimizing, which is done in 'optimizeTerm'.- trans = \case- Cons :@ x :@ y -> [|| $$(trans x) : $$(trans y) ||]- Cons :@ x -> [|| ($$(trans x) :) ||]- Cons -> cons- Char t -> char t- Eq :@ x :@ y -> [|| $$(trans x) Eq.== $$(trans y) ||]- Eq :@ x -> [|| ($$(trans x) Eq.==) ||]- Eq -> eq- Term repr -> repr- -- (:$) :@ x -> [|| ($$(trans x) Fun.$) ||]- -- (:.) :@ f :@ g -> [|| \xx -> $$(trans f) ($$(trans g) xx) ||]- -- (:.) :@ (:.) -> [|| \f x -> (\g y -> (f x) (g y)) ||]- -- (:.) :@ x :@ y -> [|| $$(trans x) Fun.. $$(trans y) ||]- -- (:.) :@ x -> [|| ($$(trans x) Fun..) ||]- -- (:.) :@ f -> [|| \g x -> $$(trans f) (g x) ||]- -- (:.) -> (.)- x :@ y -> [|| $$(trans x) $$(trans y) ||]- Lam f -> [|| \x -> $$(trans (f (Term [||x||]))) ||]- Lam1 f -> trans (Lam f)- Var{} -> undefined- {-- Const -> const- Flip -> flip- Id -> id- (:$) -> ($)- -}-instance Trans (Term ValueCode) ValueCode where- trans = \case- Term x -> x- Char c -> char c- Cons -> cons- Eq -> eq- (:@) f x -> (.@) (trans f) (trans x)- Lam f -> ValueCode- { value = value Fun.. trans Fun.. f Fun.. Term Fun.. (`ValueCode` undefined)- , code = [|| \x -> $$(code Fun.. trans Fun.. f Fun.. Term Fun.. (undefined `ValueCode`) Fun.$ [||x||]) ||]- }- Lam1 f -> trans (Lam f)- Var{} -> undefined- {-- Const -> const- Flip -> flip- Id -> id- (:$) -> ($)- -}-instance Trans (Term ValueCode) (Term TH.CodeQ) where- trans = \case- Term x -> Term (code x)- Char c -> char c- Cons -> cons- Eq -> eq- (:@) f x -> (.@) (trans f) (trans x)- Lam f -> Lam (\x -> trans (f (trans x)))- Lam1 f -> Lam1 (\x -> trans (f (trans x)))- Var v -> Var v- {-- Const -> const- Flip -> flip- Id -> id- (:$) -> ($)- -}-instance Trans (Term TH.CodeQ) (Term ValueCode) where- trans = \case- Term x -> Term (ValueCode undefined x)- Char c -> char c- Cons -> cons- Eq -> eq- (:@) f x -> (.@) (trans f) (trans x)- Lam f -> Lam (\x -> trans (f (trans x)))- Lam1 f -> Lam1 (\x -> trans (f (trans x)))- Var v -> Var v- {-- Const -> const- Flip -> flip- Id -> id- (:$) -> ($)- -}
− src/Symantic/Parser/Haskell/Term.hs
@@ -1,194 +0,0 @@-{-# LANGUAGE DefaultSignatures #-}-{-# LANGUAGE TemplateHaskell #-}--- | Haskell terms which are interesting--- to pattern-match when optimizing.-module Symantic.Parser.Haskell.Term where--import Data.Bool (Bool(..))-import Data.Either (Either(..))-import Data.Eq (Eq)-import Data.Maybe (Maybe(..))-import Data.Functor.Identity (Identity(..))-import Prelude (undefined)-import Text.Show (Show(..))-import qualified Data.Eq as Eq-import qualified Data.Function as Fun-import qualified Language.Haskell.TH as TH-import qualified Language.Haskell.TH.Syntax as TH--import qualified Symantic.Univariant.Trans as Sym---- * Class 'Termable'--- | Single-out some Haskell terms in order to -class Termable repr where- -- | Application, aka. unabstract.- (.@) :: repr (a->b) -> repr a -> repr b- -- | Lambda term abstraction, in HOAS (Higher-Order Abstract Syntax) style.- lam :: (repr a -> repr b) -> repr (a->b)- -- | Like 'lam' but whose argument is used only once,- -- hence safe to beta-reduce (inline) without duplicating work.- lam1 :: (repr a -> repr b) -> repr (a->b)-- -- Singled-out terms- bool :: Bool -> repr Bool- char :: (TH.Lift tok, Show tok) => tok -> repr tok- cons :: repr (a -> [a] -> [a])- nil :: repr [a]- eq :: Eq a => repr (a -> a -> Bool)- unit :: repr ()- left :: repr (l -> Either l r)- right :: repr (r -> Either l r)- nothing :: repr (Maybe a)- just :: repr (a -> Maybe a)- const :: repr (a -> b -> a)- flip :: repr ((a -> b -> c) -> b -> a -> c)- id :: repr (a->a)- (.) :: repr ((b->c) -> (a->b) -> a -> c)- ($) :: repr ((a->b) -> a -> b)-- default (.@) ::- Sym.Liftable2 repr => Termable (Sym.Output repr) =>- repr (a->b) -> repr a -> repr b- default lam ::- Sym.Liftable repr => Sym.Unliftable repr => Termable (Sym.Output repr) =>- (repr a -> repr b) -> repr (a->b)- default lam1 ::- Sym.Liftable repr => Sym.Unliftable repr => Termable (Sym.Output repr) =>- (repr a -> repr b) -> repr (a->b)- default bool ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- Bool -> repr Bool- default char ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- TH.Lift tok => Show tok =>- tok -> repr tok- default cons ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (a -> [a] -> [a])- default nil ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr [a]- default eq ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- Eq a => repr (a -> a -> Bool)- default unit ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr ()- default left ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (l -> Either l r)- default right ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (r -> Either l r)- default nothing ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (Maybe a)- default just ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (a -> Maybe a)- default const ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (a -> b -> a)- default flip ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr ((a -> b -> c) -> b -> a -> c)- default id ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr (a->a)- default (.) ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr ((b->c) -> (a->b) -> a -> c)- default ($) ::- Sym.Liftable repr => Termable (Sym.Output repr) =>- repr ((a->b) -> a -> b)-- (.@) = Sym.lift2 (.@)- lam f = Sym.lift (lam (Sym.trans Fun.. f Fun.. Sym.trans))- lam1 f = Sym.lift (lam1 (Sym.trans Fun.. f Fun.. Sym.trans))- bool = Sym.lift Fun.. bool- char = Sym.lift Fun.. char- cons = Sym.lift cons- nil = Sym.lift nil- eq = Sym.lift eq- unit = Sym.lift unit- left = Sym.lift left- right = Sym.lift right- nothing = Sym.lift nothing- just = Sym.lift just- const = Sym.lift const- flip = Sym.lift flip- id = Sym.lift id- (.) = Sym.lift (.)- ($) = Sym.lift ($)-infixr 0 $-infixr 9 .-infixl 9 .@---- * Type 'ValueCode'-data ValueCode a = ValueCode- { value :: a- , code :: TH.CodeQ a- }-instance Termable ValueCode where- f .@ x = ValueCode- { value = runIdentity (Identity (value f) .@ (Identity (value x)))- , code = code f .@ code x- }- lam f = ValueCode- { value = runIdentity (lam (Identity Fun.. value Fun.. f Fun.. (`ValueCode` undefined) Fun.. runIdentity))- , code = lam (code Fun.. f Fun.. ValueCode undefined)- }- lam1 = lam- bool b = ValueCode (runIdentity (bool b)) (bool b)- char c = ValueCode (runIdentity (char c)) (char c)- cons = ValueCode (runIdentity cons) cons- nil = ValueCode (runIdentity nil) nil- eq = ValueCode (runIdentity eq) eq- unit = ValueCode (runIdentity unit) unit- left = ValueCode (runIdentity left) left- right = ValueCode (runIdentity right) right- nothing = ValueCode (runIdentity nothing) nothing- just = ValueCode (runIdentity just) just- const = ValueCode (runIdentity const) const- flip = ValueCode (runIdentity flip) flip- id = ValueCode (runIdentity id) id- ($) = ValueCode (runIdentity ($)) ($)- (.) = ValueCode (runIdentity (.)) (.)-instance Termable Identity where- f .@ x = Identity (runIdentity f (runIdentity x))- lam f = Identity (runIdentity Fun.. f Fun.. Identity)- lam1 = lam- bool = Identity- char = Identity- cons = Identity (:)- nil = Identity []- eq = Identity (Eq.==)- unit = Identity ()- left = Identity Left- right = Identity Right- nothing = Identity Nothing- just = Identity Just- const = Identity Fun.const- flip = Identity Fun.flip- id = Identity Fun.id- ($) = Identity (Fun.$)- (.) = Identity (Fun..)-instance Termable TH.CodeQ where- (.@) f x = [|| $$f $$x ||]- lam f = [|| \x -> $$(f [||x||]) ||]- lam1 = lam- bool b = [|| b ||]- char c = [|| c ||]- cons = [|| (:) ||]- nil = [|| [] ||]- eq = [|| (Eq.==) ||]- unit = [|| () ||]- left = [|| Left ||]- right = [|| Right ||]- nothing = [|| Nothing ||]- just = [|| Just ||]- const = [|| Fun.const ||]- id = [|| \x -> x ||]- flip = [|| \f x y -> f y x ||]- ($) = [|| (Fun.$) ||]- (.) = [|| (Fun..) ||]
− src/Symantic/Parser/Haskell/View.hs
@@ -1,114 +0,0 @@-{-# LANGUAGE DerivingStrategies #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-module Symantic.Parser.Haskell.View where--import Data.Bool-import Data.Function (($), (.))-import Data.Int (Int)-import Data.Semigroup (Semigroup(..))-import Data.String (IsString(..), String)-import Prelude ((+))-import Text.Show (Show(..), ShowS, shows, showParen, showString)-import qualified Data.Function as Fun--import Symantic.Parser.Grammar.Fixity-import qualified Symantic.Parser.Haskell.Optimize as H---- * Type 'ViewTerm'-newtype ViewTerm a = ViewTerm { unViewTerm :: ViewTermInh -> ShowS }--instance IsString (ViewTerm a) where- fromString s = ViewTerm $ \_inh -> showString s---- ** Type 'ViewTermInh'-data ViewTermInh- = ViewTermInh- { viewTermInh_op :: (Infix, Side)- , viewTermInh_pair :: Pair- , viewTermInh_lamDepth :: Int- }--pairViewTerm :: ViewTermInh -> Infix -> ShowS -> ShowS-pairViewTerm inh op s =- if isPairNeeded (viewTermInh_op inh) op- then showString o . s . showString c- else s- where (o,c) = viewTermInh_pair inh--instance Show (ViewTerm a) where- showsPrec p v = unViewTerm v ViewTermInh- { viewTermInh_op = (infixN p, SideL)- , viewTermInh_pair = pairParen- , viewTermInh_lamDepth = 1- }-instance Show (H.Term repr a) where- showsPrec p = showsPrec p . go- where- go :: forall b. H.Term repr b -> ViewTerm b- go = \case- H.Term{} -> "Term"- {-- (H.:.) H.:@ f H.:@ g -> ViewTerm $ \inh ->- pairViewTerm inh op Fun.$- unViewTerm (go f) inh{viewTermInh_op=op} Fun..- showString " . " Fun..- unViewTerm (go g) inh{viewTermInh_op=op}- where op = infixR 9- (H.:.) -> "(.)"- -}- {-- H.Char t -> ViewTerm $ \_inh ->- showString "(char " .- shows t .- showString ")"- -}- H.Char t -> ViewTerm $ \_inh -> shows t- H.Cons H.:@ x H.:@ xs -> ViewTerm $ \inh ->- pairViewTerm inh op Fun.$- unViewTerm (go x) inh{viewTermInh_op=(op, SideL)} Fun..- showString " : " Fun..- unViewTerm (go xs) inh{viewTermInh_op=(op, SideR)}- where op = infixN 5- H.Cons -> "cons"- H.Eq H.:@ x H.:@ y -> ViewTerm $ \inh ->- pairViewTerm inh op Fun.$- unViewTerm (go x) inh{viewTermInh_op=(op, SideL)} Fun..- showString " == " Fun..- unViewTerm (go y) inh{viewTermInh_op=(op, SideR)}- where op = infixN 4- H.Eq H.:@ x -> ViewTerm $ \inh ->- showParen True Fun.$- unViewTerm (go x) inh{viewTermInh_op=(op, SideL)} Fun..- showString " =="- where op = infixN 4- H.Eq -> "(==)"- H.Var v -> fromString v- H.Lam1 f -> viewLam "u" f- H.Lam f -> viewLam "x" f- f H.:@ x -> ViewTerm $ \inh ->- pairViewTerm inh op $- unViewTerm (go f) inh{viewTermInh_op = (op, SideL) } .- -- showString " :@ " .- showString " " .- unViewTerm (go x) inh{viewTermInh_op = (op, SideR) }- where op = infixN 10- {-- H.Const -> "const"- H.Flip -> "flip"- H.Id -> "id"- (H.:$) -> "($)"- -}- viewLam :: forall b c. String -> (H.Term repr b -> H.Term repr c) -> ViewTerm (b -> c)- viewLam v f = ViewTerm $ \inh ->- pairViewTerm inh op $- let x = v<>show (viewTermInh_lamDepth inh) in- -- showString "Lam1 (" .- showString "\\" . showString x . showString " -> " .- (unViewTerm (go (f (H.Var x))) inh- { viewTermInh_op = (op, SideL)- , viewTermInh_lamDepth = viewTermInh_lamDepth inh + 1- })- -- . showString ")"- where op = infixN 0
src/Symantic/Parser/Machine.hs view
@@ -8,8 +8,7 @@ , module Symantic.Parser.Machine.View ) where import Data.Function ((.))-import Data.Ord (Ord)-import Text.Show (Show)+import System.IO (IO) import qualified Language.Haskell.TH.Syntax as TH import Symantic.Parser.Grammar@@ -20,21 +19,15 @@ import Symantic.Parser.Machine.Program import Symantic.Parser.Machine.View --- * Type 'Parser'-type Parser inp = ParserRepr Gen inp---- | Like a 'Parser' but not bound to the 'Gen' interpreter.-type ParserRepr repr inp =+-- * Type 'Machine'+type Machine repr inp = ObserveSharing TH.Name (OptimizeGrammar (Program repr inp)) -- | Build a 'Machine' able to 'generateCode' for the given 'Parser'. machine :: forall inp repr a.- Ord (InputToken inp) =>- Show (InputToken inp) =>- TH.Lift (InputToken inp) =>- Grammar (InputToken inp) (Program repr inp) =>- Machine (InputToken inp) repr =>- ParserRepr repr inp a ->- repr inp '[] ('Succ 'Zero) a+ Grammarable (InputToken inp) (Program repr inp) =>+ Machinable (InputToken inp) repr =>+ Machine repr inp a ->+ IO (repr inp '[] a) machine = optimizeMachine . grammar @(InputToken inp)
src/Symantic/Parser/Machine/Generate.hs view
@@ -1,366 +1,612 @@ {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE DeriveAnyClass #-} -- For NFData instances+{-# LANGUAGE DeriveGeneric #-} -- For NFData instances {-# LANGUAGE StandaloneDeriving #-} -- For Show (ParsingError inp)+{-# LANGUAGE ConstraintKinds #-} -- For Dict {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TupleSections #-} {-# LANGUAGE UnboxedTuples #-} -- For nextInput {-# LANGUAGE UndecidableInstances #-} -- For Show (ParsingError inp)+{-# OPTIONS_GHC -fno-warn-orphans #-} module Symantic.Parser.Machine.Generate where +import Control.DeepSeq (NFData(..)) import Control.Monad (Monad(..)) import Data.Bool (Bool) import Data.Char (Char)-import Data.Either (Either(..))-import Data.Function (($), (.))-import Data.Functor ((<$>))+import Data.Either (Either(..), either)+import Data.Foldable (foldMap', toList, null)+import Data.Function (($), (.), id, const, on)+import Data.Functor (Functor, (<$>), (<$)) import Data.Int (Int)-import Data.List (minimum)+import Data.List.NonEmpty (NonEmpty(..)) import Data.Map (Map) import Data.Maybe (Maybe(..)) import Data.Ord (Ord(..), Ordering(..))+import Data.Proxy (Proxy(..)) import Data.Semigroup (Semigroup(..)) import Data.Set (Set)-import Language.Haskell.TH (CodeQ, Code(..))-import Prelude ((+), (-))-import Text.Show (Show(..))+import Data.String (String)+import Data.Traversable (Traversable(..))+import Data.Typeable (Typeable)+import Data.Word (Word8)+import GHC.Generics (Generic)+import GHC.Show (showCommaSpace)+import Language.Haskell.TH (CodeQ)+import Prelude ((+), (-), error)+import Text.Show (Show(..), showParen, showString)+import qualified Data.HashMap.Strict as HM+import qualified Data.List as List+import qualified Data.List.NonEmpty as NE+import qualified Data.Map.Internal as Map_ import qualified Data.Map.Strict as Map import qualified Data.Set as Set+import qualified Data.Set.Internal as Set_+import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH--- import qualified Control.Monad.Trans.Writer as Writer -import Symantic.Univariant.Trans-import Symantic.Parser.Grammar.Combinators (ErrorItem(..))+import Symantic.Typed.Derive+import Symantic.Typed.ObserveSharing+import Symantic.Parser.Grammar.Combinators (Exception(..), Failure(..), SomeFailure(..), inputTokenProxy) import Symantic.Parser.Machine.Input import Symantic.Parser.Machine.Instructions-import qualified Symantic.Parser.Haskell as H+import qualified Language.Haskell.TH.HideName as TH+import qualified Symantic.Typed.Lang as Prod+import qualified Symantic.Typed.Optimize as Prod -genCode :: TermInstr a -> CodeQ a-genCode = trans+--import Debug.Trace +-- | Convenient utility to generate some final 'TH.CodeQ'.+genCode :: Splice a -> CodeQ a+genCode = derive . Prod.normalOrderReduction+ -- * Type 'Gen' -- | Generate the 'CodeQ' parsing the input.-data Gen inp vs es a = Gen- { minHorizon :: Map TH.Name Horizon -> Horizon- -- ^ Synthetized (bottom-up) minimal input length- -- required by the parser to not fail.- -- This requires a 'minHorizonByName'- -- containing the minimal 'Horizon's of all the 'TH.Name's- -- this parser 'call's, 'jump's or 'refJoin's to.+data Gen inp vs a = Gen+ { genAnalysisByLet :: LetMapFix (CallTrace -> GenAnalysis)+ -- ^ 'genAnalysis' for each 'defLet' and 'defJoin' of the 'Machine'.+ , genAnalysis :: LetMapTo (CallTrace -> GenAnalysis)+ -- ^ Synthetized (bottom-up) static genAnalysis of the 'Machine'. , unGen ::- GenCtx inp vs es a ->+ GenCtx inp vs a -> CodeQ (Either (ParsingError inp) a) } +-- | @('generateCode' input mach)@ generates @TemplateHaskell@ code+-- parsing the given 'input' according to the given 'Machine'.+generateCode ::+ {-+ Eq (InputToken inp) =>+ NFData (InputToken inp) =>+ Show (InputToken inp) =>+ Typeable (InputToken inp) =>+ TH.Lift (InputToken inp) =>+ -}+ -- InputToken inp ~ Char =>+ Inputable inp =>+ Show (Cursor inp) =>+ Gen inp '[] a ->+ CodeQ (inp -> Either (ParsingError inp) a)+generateCode k = [|| \(input :: inp) ->+ -- Pattern bindings containing unlifted types+ -- should use an outermost bang pattern.+ let !(# init, readMore, readNext #) = $$(cursorOf [||input||])+ finalRet = \_farInp _farExp v _inp -> Right v+ finalRaise :: forall b. (Catcher inp b)+ = \ !exn _failInp !farInp !farExp ->+ Left ParsingError+ { parsingErrorOffset = offset farInp+ , parsingErrorException = exn+ , parsingErrorUnexpected =+ if readMore farInp+ then Just (let (# c, _ #) = readNext farInp in c)+ else Nothing+ , parsingErrorExpecting = farExp+ }+ in+ $$(+ let defInputTokenProxy exprCode =+ TH.unsafeCodeCoerce $ do+ value <- TH.unTypeQ $ TH.examineCode [||Proxy :: Proxy (InputToken inp)||]+ expr <- TH.unTypeQ (TH.examineCode exprCode)+ return $ TH.LetE [+ TH.FunD inputTokenProxy [TH.Clause [] (TH.NormalB value) []]+ ] expr+ in defInputTokenProxy $+ unGen k GenCtx+ { valueStack = ValueStackEmpty+ , catchStackByLabel = Map.empty+ , defaultCatch = [||finalRaise||]+ , callStack = []+ , retCode = [||finalRet||]+ , input = [||init||]+ , nextInput = [||readNext||]+ , moreInput = [||readMore||]+ -- , farthestError = [||Nothing||]+ , farthestInput = [||init||]+ , farthestExpecting = [||Set.empty||]+ , checkedHorizon = 0+ , horizonStack = []+ , finalGenAnalysisByLet = runGenAnalysis (genAnalysisByLet k)+ }+ )+ ||]+ -- ** Type 'ParsingError' data ParsingError inp- = ParsingErrorStandard+ = ParsingError { parsingErrorOffset :: Offset- -- | Note that if an 'ErrorItemHorizon' greater than 1- -- is amongst the 'parsingErrorExpecting'- -- then this is only the 'InputToken'- -- at the begining of the expected 'Horizon'.+ , parsingErrorException :: Exception+ -- | Note: if a 'FailureHorizon' greater than 1+ -- is amongst the 'parsingErrorExpecting'+ -- then 'parsingErrorUnexpected' is only the 'InputToken'+ -- at the begining of the expected 'Horizon'. , parsingErrorUnexpected :: Maybe (InputToken inp)- , parsingErrorExpecting :: Set (ErrorItem (InputToken inp))- }-deriving instance Show (InputToken inp) => Show (ParsingError inp)+ , parsingErrorExpecting :: Set SomeFailure+ } deriving (Generic)+deriving instance NFData (InputToken inp) => NFData (ParsingError inp)+--deriving instance Show (InputToken inp) => Show (ParsingError inp)+instance Show (InputToken inp) => Show (ParsingError inp) where+ showsPrec p ParsingError{..} =+ showParen (p >= 11) $+ showString "ParsingErrorStandard {" .+ showString "parsingErrorOffset = " .+ showsPrec 0 parsingErrorOffset .+ showCommaSpace .+ showString "parsingErrorException = " .+ showsPrec 0 parsingErrorException .+ showCommaSpace .+ showString "parsingErrorUnexpected = " .+ showsPrec 0 parsingErrorUnexpected .+ showCommaSpace .+ showString "parsingErrorExpecting = fromList " .+ showsPrec 0 (+ -- Sort on the string representation+ -- because the 'Ord' of the 'SomeFailure'+ -- is based upon hashes ('typeRepFingerprint')+ -- depending on packages' ABI and whether+ -- cabal-install's setup is --inplace or not,+ -- and that would be too unstable for golden tests.+ List.sortBy (compare `on` show) $+ Set.toList parsingErrorExpecting+ ) .+ showString "}" +-- ** Type 'ErrorLabel'+type ErrorLabel = String++-- * Type 'GenAnalysis'+data GenAnalysis = GenAnalysis+ { minReads :: Either Exception Horizon+ , mayRaise :: Map Exception ()+ } deriving (Show)++-- | Tie the knot between mutually recursive 'TH.Name's+-- introduced by 'defLet' and 'defJoin'.+-- and provide the empty initial 'CallTrace' stack+runGenAnalysis ::+ LetMapFix (CallTrace -> GenAnalysis) ->+ LetMap GenAnalysis+runGenAnalysis ga = (($ []) <$>) $ polyfix ga++-- | Poly-variadic fixpoint combinator.+-- Used to express mutual recursion and to transparently introduce memoization,+-- more precisely to "tie the knot"+-- between observed sharing ('defLet', 'call', 'jump')+-- and also between join points ('defJoin', 'refJoin').+-- Because it's enough for its usage here,+-- all mutually dependent functions are restricted to the same polymorphic type @(a)@.+-- See http://okmij.org/ftp/Computation/fixed-point-combinators.html#Poly-variadic+polyfix :: Functor f => f (f a -> a) -> f a+polyfix fs = fix $ \finals -> ($ finals) <$> fs++fix :: (a -> a) -> a+fix f = final where final = f final++type LetMap = HM.HashMap TH.Name+type LetMapTo a = LetMap a -> a+type LetMapFix a = LetMap (LetMap a -> a)++-- | Call trace stack updated by 'call' and 'refJoin'.+-- Used to avoid infinite loops when tying the knot with 'polyfix'.+type CallTrace = [TH.Name]+ -- ** Type 'Offset' type Offset = Int- -- ** Type 'Horizon'--- | Synthetized minimal input length--- required for a successful parsing.--- Used with 'checkedHorizon' to factorize input length checks,--- instead of checking the input length--- one 'InputToken' at a time at each 'read'.+-- | Minimal input length required for a successful parsing. type Horizon = Offset --- ** Type 'Cont'-type Cont inp v a =- {-farthestInput-}Cursor inp ->- {-farthestExpecting-}[ErrorItem (InputToken inp)] ->- v ->- Cursor inp ->- Either (ParsingError inp) a+-- altGenAnalysis = List.foldl' (\acc x -> either Left (\h -> Right (either (const h) (min h) acc)) x)+-- | Merge given 'GenAnalysis' as sequences.+seqGenAnalysis :: NonEmpty GenAnalysis -> GenAnalysis+seqGenAnalysis aas@(a:|as) = GenAnalysis+ { minReads = List.foldl' (\acc x ->+ acc >>= \r -> (r +) <$> minReads x+ ) (minReads a) as+ , mayRaise = sconcat (mayRaise <$> aas)+ }+-- | Merge given 'GenAnalysis' as alternatives.+altGenAnalysis :: NonEmpty GenAnalysis -> GenAnalysis+altGenAnalysis aas@(a:|as) = GenAnalysis+ { minReads = List.foldl' (\acc x ->+ either+ (\l -> either (const (Left l)) Right)+ (\r -> either (const (Right r)) (Right . min r))+ acc (minReads x)+ ) (minReads a) as+ , mayRaise = sconcat (mayRaise <$> aas)+ } --- ** Type 'FailHandler'-type FailHandler inp a =- {-failureInput-}Cursor inp ->- {-farthestInput-}Cursor inp ->- {-farthestExpecting-}[ErrorItem (InputToken inp)] ->- Either (ParsingError inp) a {- -- *** Type 'FarthestError' data FarthestError inp = FarthestError { farthestInput :: Cursor inp- , farthestExpecting :: [ErrorItem (InputToken inp)]+ , farthestExpecting :: [Failure (InputToken inp)] } -} --- | @('generateCode' input mach)@ generates @TemplateHaskell@ code--- parsing the given 'input' according to the given 'Machine'.-generateCode ::- forall inp ret.- Ord (InputToken inp) =>- Show (InputToken inp) =>- TH.Lift (InputToken inp) =>- -- InputToken inp ~ Char =>- Input inp =>- CodeQ inp ->- Show (Cursor inp) =>- Gen inp '[] ('Succ 'Zero) ret ->- CodeQ (Either (ParsingError inp) ret)-generateCode input k = [||- -- Pattern bindings containing unlifted types- -- should use an outermost bang pattern.- let !(# init, readMore, readNext #) = $$(cursorOf input) in- let finalRet = \_farInp _farExp v _inp -> Right v in- let finalFail _failInp !farInp !farExp =- Left ParsingErrorStandard- { parsingErrorOffset = offset farInp- , parsingErrorUnexpected =- if readMore farInp- then Just (let (# c, _ #) = readNext farInp in c)- else Nothing- , parsingErrorExpecting = Set.fromList farExp- } in- $$(unGen k GenCtx- { valueStack = ValueStackEmpty- , failStack = FailStackCons [||finalFail||] FailStackEmpty- , retCode = [||finalRet||]- , input = [||init||]- , nextInput = [||readNext||]- , moreInput = [||readMore||]- -- , farthestError = [||Nothing||]- , farthestInput = [||init||]- , farthestExpecting = [|| [] ||]- , checkedHorizon = 0- , minHorizonByName = Map.empty- })- ||]- -- ** Type 'GenCtx' -- | This is an inherited (top-down) context -- only present at compile-time, to build TemplateHaskell splices.-data GenCtx inp vs (es::Peano) a =- ( TH.Lift (InputToken inp)- , Cursorable (Cursor inp)+data GenCtx inp vs a =+ ( Cursorable (Cursor inp)+ {-+ , TH.Lift (InputToken inp) , Show (InputToken inp)- -- , InputToken inp ~ Char+ , Eq (InputToken inp)+ , Typeable (InputToken inp)+ , NFData (InputToken inp)+ -} ) => GenCtx { valueStack :: ValueStack vs- , failStack :: FailStack inp a es- --, failStacks :: FailStack inp es a+ , catchStackByLabel :: Map Exception (NonEmpty (CodeQ (Catcher inp a)))+ -- | Default 'Catcher' defined at the begining of the generated 'CodeQ',+ -- hence a constant within the 'Gen'eration.+ , defaultCatch :: forall b. CodeQ (Catcher inp b)+ -- | Used by 'checkToken' to get 'GenAnalysis' from 'genAnalysis'.+ , callStack :: [TH.Name] , retCode :: CodeQ (Cont inp a a) , input :: CodeQ (Cursor inp) , moreInput :: CodeQ (Cursor inp -> Bool) , nextInput :: CodeQ (Cursor inp -> (# InputToken inp, Cursor inp #)) , farthestInput :: CodeQ (Cursor inp)- , farthestExpecting :: CodeQ [ErrorItem (InputToken inp)]+ , farthestExpecting :: CodeQ (Set SomeFailure) -- | Remaining horizon already checked.+ -- Use to factorize 'input' length checks,+ -- instead of checking the 'input' length+ -- one 'InputToken' at a time at each 'read'. -- Updated by 'checkHorizon' -- and reset elsewhere when needed.- , checkedHorizon :: Offset- -- | Minimal horizon for each 'subroutine' or 'defJoin'.- -- This can be done as an inherited attribute because- -- 'OverserveSharing' introduces 'def' as an ancestor node- -- of all the 'ref's pointing to it.- -- Same for 'defJoin' and its 'refJoin's.- , minHorizonByName :: Map TH.Name Offset+ , checkedHorizon :: Horizon+ -- | Used by 'pushInput' and 'loadInput'+ -- to restore the 'Horizon' at the restored 'input'.+ , horizonStack :: [Horizon]+ -- | Output of 'runGenAnalysis'.+ , finalGenAnalysisByLet :: LetMap GenAnalysis } -- ** Type 'ValueStack' data ValueStack vs where ValueStackEmpty :: ValueStack '[] ValueStackCons ::- { valueStackHead :: TermInstr v+ { valueStackHead :: Splice v , valueStackTail :: ValueStack vs } -> ValueStack (v ': vs) --- ** Type 'FailStack'-data FailStack inp a es where- FailStackEmpty :: FailStack inp a 'Zero- FailStackCons ::- { failStackHead :: CodeQ (FailHandler inp a)- , failStackTail :: FailStack inp a es- } ->- FailStack inp a ('Succ es)--instance Stackable Gen where- push x k = k- { unGen = \ctx -> unGen k ctx+instance InstrValuable Gen where+ pushValue x k = k+ { unGen = \ctx -> {-trace "unGen.pushValue" $-} unGen k ctx { valueStack = ValueStackCons x (valueStack ctx) } }- pop k = k- { unGen = \ctx -> unGen k ctx+ popValue k = k+ { unGen = \ctx -> {-trace "unGen.popValue" $-} unGen k ctx { valueStack = valueStackTail (valueStack ctx) } }- liftI2 f k = k- { unGen = \ctx -> unGen k ctx+ lift2Value f k = k+ { unGen = \ctx -> {-trace "unGen.lift2Value" $-} unGen k ctx { valueStack =- let ValueStackCons y (ValueStackCons x xs) = valueStack ctx in- ValueStackCons (f H.:@ x H.:@ y) xs+ let ValueStackCons y (ValueStackCons x vs) = valueStack ctx in+ ValueStackCons (f Prod..@ x Prod..@ y) vs } }- swap k = k- { unGen = \ctx -> unGen k ctx+ swapValue k = k+ { unGen = \ctx -> {-trace "unGen.swapValue" $-} unGen k ctx { valueStack =- let ValueStackCons y (ValueStackCons x xs) = valueStack ctx in- ValueStackCons x (ValueStackCons y xs)+ let ValueStackCons y (ValueStackCons x vs) = valueStack ctx in+ ValueStackCons x (ValueStackCons y vs) } }-instance Branchable Gen where- caseI kx ky = Gen- { minHorizon = \ls ->- minHorizon kx ls `min` minHorizon ky ls- , unGen = \ctx ->+instance InstrBranchable Gen where+ caseBranch kx ky = Gen+ { genAnalysisByLet = genAnalysisByLet kx <> genAnalysisByLet ky+ , genAnalysis = \final ct -> altGenAnalysis $ genAnalysis kx final ct :| [genAnalysis ky final ct]+ , unGen = \ctx -> {-trace "unGen.caseBranch" $-} let ValueStackCons v vs = valueStack ctx in [|| case $$(genCode v) of- Left x -> $$(unGen kx ctx{ valueStack = ValueStackCons (H.Term [||x||]) vs })- Right y -> $$(unGen ky ctx{ valueStack = ValueStackCons (H.Term [||y||]) vs })+ Left x -> $$(unGen kx ctx{ valueStack = ValueStackCons (splice [||x||]) vs })+ Right y -> $$(unGen ky ctx{ valueStack = ValueStackCons (splice [||y||]) vs }) ||] }- choices fs ks kd = Gen- { minHorizon = \hs -> minimum $- minHorizon kd hs :- (($ hs) . minHorizon <$> ks)- , unGen = \ctx ->+ choicesBranch fs ks kd = Gen+ { genAnalysisByLet = sconcat $ genAnalysisByLet kd :| (genAnalysisByLet <$> ks)+ , genAnalysis = \final ct -> altGenAnalysis $ (\k -> genAnalysis k final ct) <$> (kd:|ks)+ , unGen = \ctx -> {-trace "unGen.choicesBranch" $-} let ValueStackCons v vs = valueStack ctx in go ctx{valueStack = vs} v fs ks } where go ctx x (f:fs') (k:ks') = [||- if $$(genCode (f H.:@ x))- then $$(unGen k ctx)- else $$(go ctx x fs' ks')+ if $$(genCode (f Prod..@ x))+ then+ let _ = "choicesBranch.then" in+ $$({-trace "unGen.choicesBranch.k" $-} unGen k ctx)+ else+ let _ = "choicesBranch.else" in+ $$(go ctx x fs' ks') ||] go ctx _ _ _ = unGen kd ctx-instance Failable Gen where- fail failExp = Gen- { minHorizon = \_hs -> 0- , unGen = \ctx@GenCtx{} -> [||- let (# farInp, farExp #) =- case $$compareOffset $$(farthestInput ctx) $$(input ctx) of- LT -> (# $$(input ctx), failExp #)- EQ -> (# $$(farthestInput ctx), ($$(farthestExpecting ctx) <> failExp) #)- GT -> (# $$(farthestInput ctx), $$(farthestExpecting ctx) #) in- $$(failStackHead (failStack ctx))- $$(input ctx) farInp farExp+instance InstrExceptionable Gen where+ raise exn = Gen+ { genAnalysisByLet = HM.empty+ , genAnalysis = \_final _ct -> GenAnalysis+ { minReads = Left (ExceptionLabel exn)+ , mayRaise = Map.singleton (ExceptionLabel exn) ()+ }+ , unGen = \ctx@GenCtx{} -> {-trace ("unGen.raise: "<>show exn) $-} [||+ $$(raiseException ctx (ExceptionLabel exn))+ (ExceptionLabel $$(TH.liftTyped exn))+ {-failInp-}$$(input ctx)+ {-farInp-}$$(input ctx)+ $$(farthestExpecting ctx) ||] }- popFail k = k- { unGen = \ctx ->- unGen k ctx{failStack = failStackTail (failStack ctx)}+ fail fs = Gen+ { genAnalysisByLet = HM.empty+ , genAnalysis = \_final _ct -> GenAnalysis+ { minReads = Left ExceptionFailure+ , mayRaise = Map.singleton ExceptionFailure ()+ }+ , unGen = \ctx@GenCtx{} -> {-trace ("unGen.fail: "<>show exn) $-}+ if null fs+ then [|| -- Raise without updating the farthest error.+ $$(raiseException ctx ExceptionFailure)+ ExceptionFailure+ {-failInp-}$$(input ctx)+ $$(farthestInput ctx)+ $$(farthestExpecting ctx)+ ||]+ else raiseFailure ctx [||fs||] }- catchFail ok ko = Gen- { minHorizon = \ls -> minHorizon ok ls `min` minHorizon ko ls- , unGen = \ctx@GenCtx{} -> unGen ok ctx- { failStack = FailStackCons [|| \ !failInp !farInp !farExp ->- -- trace ("catchFail: " <> "farExp="<>show farExp) $- $$(unGen ko ctx- -- Push the input as it was when entering the catchFail.- { valueStack = ValueStackCons (H.Term (input ctx)) (valueStack ctx)- -- Move the input to the failing position.- , input = [||failInp||]- -- Set the farthestInput to the farthest computed by 'fail'- , farthestInput = [||farInp||]- , farthestExpecting = [||farExp||]- })- ||] (failStack ctx)+ commit exn k = k+ { unGen = \ctx -> {-trace ("unGen.commit: "<>show exn) $-}+ unGen k ctx{catchStackByLabel =+ Map.update (\case+ _r0:|(r1:rs) -> Just (r1:|rs)+ _ -> Nothing+ )+ exn (catchStackByLabel ctx)+ }+ }+ catch exn ok ko = Gen+ { genAnalysisByLet = genAnalysisByLet ok <> genAnalysisByLet ko+ , genAnalysis = \final ct ->+ let okGA = genAnalysis ok final ct in+ altGenAnalysis $+ okGA{ mayRaise = Map.delete exn (mayRaise okGA) } :|+ [ genAnalysis ko final ct ]+ , unGen = \ctx@GenCtx{} -> {-trace ("unGen.catch: "<>show exn) $-} [||+ let _ = $$(liftTypedString ("catch "<>show exn)) in+ let catchHandler !_exn !failInp !farInp !farExp =+ let _ = $$(liftTypedString ("catch.ko "<>show exn)) in+ $$({-trace ("unGen.catch.ko: "<>show exn) $-} unGen ko ctx+ -- Push 'input' and 'checkedHorizon'+ -- as they were when entering 'catch',+ -- they will be available to 'loadInput', if any.+ { valueStack =+ ValueStackCons (splice (input ctx)) $+ --ValueStackCons (Prod.var [||exn||]) $+ valueStack ctx+ , horizonStack =+ checkedHorizon ctx : horizonStack ctx+ -- Note that 'catchStackByLabel' is reset.+ -- Move the input to the failing position.+ , input = [||failInp||]+ -- The 'checkedHorizon' at the 'raise's are not known here.+ -- Nor whether 'failInp' is after 'checkedHorizon' or not.+ -- Hence fallback to a safe value.+ , checkedHorizon = 0+ -- Set the farthestInput to the farthest computed in 'fail'.+ , farthestInput = [||farInp||]+ , farthestExpecting = [||farExp||]+ })+ in+ $$({-trace ("unGen.catch.ok: "<>show es) $-} unGen ok ctx+ { catchStackByLabel =+ Map.insertWith (<>) exn+ (NE.singleton [||catchHandler||])+ (catchStackByLabel ctx) }+ ) ||] }-instance Inputable Gen where+instance InstrInputable Gen where+ pushInput k = k+ { unGen = \ctx ->+ {-trace "unGen.pushInput" $-}+ unGen k ctx+ { valueStack = splice (input ctx) `ValueStackCons` valueStack ctx+ , horizonStack = checkedHorizon ctx : horizonStack ctx+ }+ } loadInput k = k { unGen = \ctx ->- let ValueStackCons input vs = valueStack ctx in- unGen k ctx- { valueStack = vs- , input = genCode input- , checkedHorizon = 0+ {-trace "unGen.loadInput" $-}+ let ValueStackCons input vs = valueStack ctx in+ let (h, hs) = case horizonStack ctx of+ [] -> (0, [])+ x:xs -> (x, xs) in+ unGen k ctx+ { valueStack = vs+ , horizonStack = hs+ , input = genCode input+ , checkedHorizon = h+ }+ , genAnalysis = \final ct -> GenAnalysis+ { minReads = 0 <$ minReads (genAnalysis k final ct)+ , mayRaise = mayRaise (genAnalysis k final ct) } }- pushInput k = k- { unGen = \ctx ->- unGen k ctx{valueStack = ValueStackCons (H.Term (input ctx)) (valueStack ctx)}+instance InstrCallable Gen where+ defLet defs k = k+ { unGen = \ctx@GenCtx{} ->+ {-trace ("unGen.defLet: defs="<>show (HM.keys defs)) $-}+ TH.unsafeCodeCoerce $ do+ decls <- traverse (makeDecl ctx) (HM.toList defs)+ body <- TH.unTypeQ $ TH.examineCode $+ {-trace "unGen.defLet.body" $-}+ unGen k ctx+ return $ TH.LetE (+ -- | Try to output more deterministic code to be able to golden test it,+ -- at the cost of more computations (at compile-time only though).+ List.sortBy (compare `on` TH.hideName) $+ toList decls+ ) body+ , genAnalysisByLet =+ foldMap' (\(SomeLet sub) -> genAnalysisByLet sub) defs <>+ ((\(SomeLet sub) -> genAnalysis sub) <$> defs) <>+ genAnalysisByLet k }-instance Routinable Gen where- subroutine (LetName n) sub k = Gen- { minHorizon = minHorizon k- , unGen = \ctx -> Code $ TH.unsafeTExpCoerce $ do- -- 'sub' is recursively 'call'able within 'sub',- -- but its maximal 'minHorizon' is not known yet.- let minHorizonByNameButSub = Map.insert n 0 (minHorizonByName ctx)+ where+ makeDecl ctx (n, SomeLet sub) = do body <- TH.unTypeQ $ TH.examineCode $ [|| -- buildRec in Parsley- -- subroutine called by 'call' or 'jump'+ -- Called by 'call' or 'jump'. \ !ok{-from generateSuspend or retCode-} !inp- !ko{-from failStackHead-} ->- $$(unGen sub ctx+ !koByLabel{- 'catchStackByLabel' from the 'call'-site -} ->+ $$({-trace ("unGen.defLet.sub: "<>show n) $-} unGen sub ctx { valueStack = ValueStackEmpty- , failStack = FailStackCons [||ko||] FailStackEmpty+ -- Build a 'catchStackByLabel' from the one available at the 'call'-site.+ -- Note that all the 'mayRaise' of the 'sub'routine may not be available,+ -- hence 'Map.findWithDefault' is used instead of 'Map.!'.+ , catchStackByLabel = Map.mapWithKey+ (\lbl () -> NE.singleton [||Map.findWithDefault $$(defaultCatch ctx) lbl koByLabel||])+ ({-trace ("mayRaise: "<>show n) $-}+ mayRaise (finalGenAnalysisByLet ctx HM.! n)) , input = [||inp||]- , retCode = [||ok||]+ , retCode = {-trace ("unGen.defLet.sub.retCode: "<>show n) $-} [||ok||] -- These are passed by the caller via 'ok' or 'ko' -- , farthestInput = -- , farthestExpecting = - -- Some callers can call this subroutine- -- with zero checkedHorizon, hence use this minimum.+ -- Some callers can call this 'defLet'+ -- with zero 'checkedHorizon', hence use this minimum. -- TODO: maybe it could be improved a bit -- by taking the minimum of the checked horizons- -- before all the 'call's and 'jump's to this subroutine.+ -- before all the 'call's and 'jump's to this 'defLet'. , checkedHorizon = 0- , minHorizonByName = minHorizonByNameButSub }) ||] let decl = TH.FunD n [TH.Clause [] (TH.NormalB body) []]- expr <- TH.unTypeQ (TH.examineCode (unGen k ctx- { minHorizonByName =- -- 'sub' is 'call'able within 'k'.- Map.insert n- (minHorizon sub minHorizonByNameButSub)- (minHorizonByName ctx)- }))- return (TH.LetE [decl] expr)- }+ return decl jump (LetName n) = Gen- { minHorizon = (Map.! n)- , unGen = \ctx -> [||+ { genAnalysisByLet = HM.empty+ , genAnalysis = \final ct ->+ if n`List.elem`ct+ then GenAnalysis+ { minReads = Right 0+ , mayRaise = Map.empty+ }+ else (final HM.! n) (n:ct)+ , unGen = \ctx -> {-trace ("unGen.jump: "<>show n) $-} [|| let _ = "jump" in- $$(Code (TH.unsafeTExpCoerce (return (TH.VarE n))))+ $$(TH.unsafeCodeCoerce (return (TH.VarE n))) {-ok-}$$(retCode ctx) $$(input ctx)- $$(failStackHead (failStack ctx))+ $$(liftTypedRaiseByLabel $+ catchStackByLabel ctx+ -- Pass only the labels raised by the 'defLet'.+ `Map.intersection`+ (mayRaise $ finalGenAnalysisByLet ctx HM.! n)+ ) ||] } call (LetName n) k = k- { minHorizon = (Map.! n)- , unGen = \ctx -> [||- let _ = "call" in- $$(Code (TH.unsafeTExpCoerce (return (TH.VarE n))))- {-ok-}$$(generateSuspend k ctx)+ { genAnalysis = \final ct ->+ if n`List.elem`ct+ then GenAnalysis+ { minReads = Right 0+ , mayRaise = Map.empty+ }+ else seqGenAnalysis $+ (final HM.! n) (n:ct) :|+ [ genAnalysis k final ct ]+ , unGen = {-trace ("unGen.call: "<>show n) $-} \ctx ->+ -- let ks = (Map.keys (catchStackByLabel ctx)) in+ [||+ -- let _ = $$(liftTypedString $ "call exceptByLet("<>show n<>")="<>show (Map.keys (Map.findWithDefault Map.empty n (exceptByLet ctx))) <> " catchStackByLabel(ctx)="<> show ks) in+ $$(TH.unsafeCodeCoerce (return (TH.VarE n)))+ {-ok-}$$(generateSuspend k ctx{callStack = n : callStack ctx}) $$(input ctx)- $$(failStackHead (failStack ctx))+ $$(liftTypedRaiseByLabel $+ catchStackByLabel ctx+ -- Pass only the labels raised by the 'defLet'.+ `Map.intersection`+ (mayRaise $ finalGenAnalysisByLet ctx HM.! n)+ ) ||] } ret = Gen- { minHorizon = \_hs -> 0- , unGen = \ctx -> unGen (generateResume (retCode ctx)) ctx+ { genAnalysisByLet = HM.empty+ , genAnalysis = \_final _ct -> GenAnalysis+ { minReads = Right 0+ , mayRaise = Map.empty+ }+ , unGen = \ctx -> {-trace "unGen.ret" $-} unGen ({-trace "unGen.ret.generateResume" $-} generateResume ({-trace "unGen.ret.retCode" $-} retCode ctx)) ctx } --- | Generate a continuation to be called with 'generateResume',--- used when 'call' 'ret'urns.--- The return 'v'alue is 'push'ed on the 'valueStack'.+-- | Like 'TH.liftString' but on 'TH.Code'.+-- Useful to get a 'TH.StringL' instead of a 'TH.ListE'.+liftTypedString :: String -> TH.Code TH.Q a+liftTypedString = TH.unsafeCodeCoerce . TH.liftString++-- | Like 'TH.liftTyped' but adjusted to work on 'catchStackByLabel'+-- which already contains 'CodeQ' terms.+-- Moreover, only the 'Catcher' at the top of the stack+-- is needed and thus generated in the resulting 'CodeQ'.+--+-- TODO: Use an 'Array' instead of a 'Map'?+liftTypedRaiseByLabel :: TH.Lift k => Map k (NonEmpty (CodeQ a)) -> CodeQ (Map k a)+liftTypedRaiseByLabel Map_.Tip = [|| Map_.Tip ||]+liftTypedRaiseByLabel (Map_.Bin s k (h:|_hs) l r) =+ [|| Map_.Bin s k $$h $$(liftTypedRaiseByLabel l) $$(liftTypedRaiseByLabel r) ||]++instance TH.Lift a => TH.Lift (Set a) where+ liftTyped Set_.Tip = [|| Set_.Tip ||]+ liftTyped (Set_.Bin s a l r) = [|| Set_.Bin $$(TH.liftTyped s) $$(TH.liftTyped a) $$(TH.liftTyped l) $$(TH.liftTyped r) ||]++-- ** Type 'Cont'+type Cont inp v a =+ {-farthestInput-}Cursor inp ->+ {-farthestExpecting-}(Set SomeFailure) ->+ v ->+ Cursor inp ->+ Either (ParsingError inp) a++-- | Generate a 'retCode' 'Cont'inuation to be called with 'generateResume'.+-- Used when 'call' 'ret'urns.+-- The return 'v'alue is 'pushValue'-ed on the 'valueStack'. generateSuspend ::- {-k-}Gen inp (v ': vs) es a ->- GenCtx inp vs es a ->+ {-k-}Gen inp (v ': vs) a ->+ GenCtx inp vs a -> CodeQ (Cont inp v a) generateSuspend k ctx = [||- let _ = "suspend" in+ let _ = $$(liftTypedString $ "suspend") in \farInp farExp v !inp ->- $$(unGen k ctx- { valueStack = ValueStackCons (H.Term [||v||]) (valueStack ctx)+ $$({-trace "unGen.generateSuspend" $-} unGen k ctx+ { valueStack = ValueStackCons ({-trace "unGen.generateSuspend.value" $-} splice [||v||]) (valueStack ctx) , input = [||inp||] , farthestInput = [||farInp||] , farthestExpecting = [||farExp||]@@ -373,67 +619,115 @@ -- Used when 'call' 'ret'urns. generateResume :: CodeQ (Cont inp v a) ->- Gen inp (v ': vs) es a+ Gen inp (v ': vs) a generateResume k = Gen- { minHorizon = \_hs -> 0- , unGen = \ctx -> [||+ { genAnalysisByLet = HM.empty+ , genAnalysis = \_final _ct -> GenAnalysis+ { minReads = Right 0+ , mayRaise = Map.empty+ }+ , unGen = \ctx -> {-trace "unGen.generateResume" $-} [|| let _ = "resume" in $$k $$(farthestInput ctx) $$(farthestExpecting ctx)- (let _ = "resume.genCode" in $$(genCode (valueStackHead (valueStack ctx))))+ (let _ = "resume.genCode" in $$({-trace "unGen.generateResume.genCode" $-}+ genCode $ valueStackHead $ valueStack ctx)) $$(input ctx) ||] } -instance Joinable Gen where- defJoin (LetName n) joined k = k- { minHorizon = minHorizon k- , unGen = \ctx -> Code $ TH.unsafeTExpCoerce $ do- body <- TH.unTypeQ $ TH.examineCode $ [||- \farInp farExp v !inp ->- $$(unGen joined ctx- { valueStack = ValueStackCons (H.Term [||v||]) (valueStack ctx)- , input = [||inp||]- , farthestInput = [||farInp||]- , farthestExpecting = [||farExp||]- , checkedHorizon = 0- })- ||]- let decl = TH.FunD n [TH.Clause [] (TH.NormalB body) []]- expr <- TH.unTypeQ (TH.examineCode (unGen k ctx- { minHorizonByName =- -- 'joined' is 'refJoin'able within 'k'.- Map.insert n- -- By definition (in 'joinNext')- -- 'joined' is not recursively 'refJoin'able within 'joined',- -- hence no need to prevent against recursivity- -- as has to be done in 'subroutine'.- (minHorizon joined (minHorizonByName ctx))- (minHorizonByName ctx)- }))- return (TH.LetE [decl] expr)+-- ** Type 'Catcher'+type Catcher inp a =+ Exception ->+ {-failInp-}Cursor inp ->+ {-farInp-}Cursor inp ->+ {-farExp-}(Set SomeFailure) ->+ Either (ParsingError inp) a++instance InstrJoinable Gen where+ defJoin (LetName n) sub k = k+ { unGen =+ \ctx ->+ {-trace ("unGen.defJoin: "<>show n) $-}+ TH.unsafeCodeCoerce $ do+ next <- TH.unTypeQ $ TH.examineCode $ [||+ -- Called by 'generateResume'.+ \farInp farExp v !inp ->+ $$({-trace ("unGen.defJoin.next: "<>show n) $-} unGen sub ctx+ { valueStack = ValueStackCons (splice [||v||]) (valueStack ctx)+ , input = [||inp||]+ , farthestInput = [||farInp||]+ , farthestExpecting = [||farExp||]+ , checkedHorizon = 0+ {- FIXME:+ , catchStackByLabel = Map.mapWithKey+ (\lbl () -> NE.singleton [||koByLabel Map.! lbl||])+ (mayRaise sub raiseLabelsByLetButSub)+ -}+ })+ ||]+ let decl = TH.FunD n [TH.Clause [] (TH.NormalB next) []]+ expr <- TH.unTypeQ (TH.examineCode ({-trace ("unGen.defJoin.expr: "<>show n) $-} unGen k ctx))+ return (TH.LetE [decl] expr)+ , genAnalysisByLet =+ (genAnalysisByLet sub <>) $+ HM.insert n (genAnalysis sub) $+ genAnalysisByLet k }- refJoin (LetName n) = (generateResume (Code (TH.unsafeTExpCoerce (return (TH.VarE n)))))- { minHorizon = (Map.! n)+ refJoin (LetName n) = Gen+ { unGen = \ctx ->+ {-trace ("unGen.refJoin: "<>show n) $-}+ unGen (generateResume+ (TH.unsafeCodeCoerce (return (TH.VarE n)))) ctx+ , genAnalysisByLet = HM.empty+ , genAnalysis = \final ct ->+ if n`List.elem`ct -- FIXME: useless+ then GenAnalysis+ { minReads = Right 0+ , mayRaise = Map.empty+ }+ else HM.findWithDefault+ (error (show (n,ct,HM.keys final)))+ n final (n:ct) }-instance Readable Char Gen where- read farExp p = checkHorizon . checkToken farExp p+instance InstrReadable Char Gen where+ read fs p = checkHorizon . checkToken fs p+instance InstrReadable Word8 Gen where+ read fs p = checkHorizon . checkToken fs p checkHorizon ::+ forall inp vs a.+ -- Those constraints are not used anyway+ -- because (TH.Lift SomeFailure) uses 'inputTokenProxy'.+ Ord (InputToken inp) =>+ Show (InputToken inp) => TH.Lift (InputToken inp) =>- {-ok-}Gen inp vs ('Succ es) a ->- Gen inp vs ('Succ es) a+ NFData (InputToken inp) =>+ Typeable (InputToken inp) =>+ {-ok-}Gen inp vs a ->+ Gen inp vs a checkHorizon ok = ok- { minHorizon = \hs -> 1 + minHorizon ok hs- , unGen = \ctx0@GenCtx{failStack = FailStackCons e es} -> [||- -- Factorize failure code- let readFail = $$(e) in+ { genAnalysis = \final ct -> seqGenAnalysis $+ GenAnalysis { minReads = Right 1+ , mayRaise = Map.singleton ExceptionFailure ()+ } :|+ [ genAnalysis ok final ct ]+ , unGen = \ctx0@GenCtx{} ->+ {-trace "unGen.checkHorizon" $-}+ let raiseFail = raiseException ctx0 ExceptionFailure in+ [||+ -- Factorize generated code for raising the "fail".+ let readFail = $$(raiseFail) in $$(- let ctx = ctx0{ failStack = FailStackCons [||readFail||] es } in+ let ctx = ctx0{catchStackByLabel =+ Map.adjust (\(_r:|rs) -> [||readFail||] :| rs)+ ExceptionFailure (catchStackByLabel ctx0)} in if checkedHorizon ctx >= 1 then unGen ok ctx0{checkedHorizon = checkedHorizon ctx - 1}- else let minHoriz = minHorizon ok (minHorizonByName ctx) in+ else let minHoriz =+ either (\_err -> 0) id $+ minReads $ finalGenAnalysis ctx ok in [|| if $$(moreInput ctx) $$(if minHoriz > 0@@ -441,29 +735,68 @@ else input ctx) then $$(unGen ok ctx{checkedHorizon = minHoriz}) else let _ = "checkHorizon.else" in- $$(unGen (fail [ErrorItemHorizon (minHoriz + 1)]) ctx)+ -- TODO: return a resuming continuation (eg. Partial)+ $$(unGen (fail (Set.singleton $ SomeFailure $ FailureHorizon @(InputToken inp) (minHoriz + 1))) ctx) ||] ) ||] } +-- | @('raiseFailure' ctx fs)@ raises 'ExceptionFailure'+-- with farthest parameters set to or updated with @(fs)@+-- according to the relative position of 'input' wrt. 'farthestInput'.+raiseFailure ::+ Cursorable (Cursor inp) =>+ GenCtx inp cs a ->+ TH.CodeQ (Set SomeFailure) ->+ TH.CodeQ (Either (ParsingError inp) a)+raiseFailure ctx fs = [||+ let failExp = $$fs in+ let (# farInp, farExp #) =+ case $$compareOffset $$(farthestInput ctx) $$(input ctx) of+ LT -> (# $$(input ctx), failExp #)+ EQ -> (# $$(farthestInput ctx), failExp <> $$(farthestExpecting ctx) #)+ GT -> (# $$(farthestInput ctx), $$(farthestExpecting ctx) #)+ in $$(raiseException ctx ExceptionFailure)+ ExceptionFailure+ {-failInp-}$$(input ctx) farInp farExp+ ||]+-- | @('raiseException' ctx exn)@ raises exception @(exn)@+-- using any entry in 'catchStackByLabel', or 'defaultCatch' if none.+raiseException ::+ GenCtx inp vs a -> Exception ->+ CodeQ (Exception -> Cursor inp -> Cursor inp -> Set SomeFailure -> Either (ParsingError inp) a)+raiseException ctx exn =+ NE.head $ Map.findWithDefault+ (NE.singleton (defaultCatch ctx))+ exn (catchStackByLabel ctx)++finalGenAnalysis :: GenCtx inp vs a -> Gen inp cs a -> GenAnalysis+finalGenAnalysis ctx k =+ --(\f -> f (error "callTrace")) $+ (\f -> f (callStack ctx)) $+ genAnalysis k $+ ((\f _ct -> f) <$>) $+ finalGenAnalysisByLet ctx+ checkToken ::- forall inp vs es a.- Ord (InputToken inp) =>- TH.Lift (InputToken inp) =>- [ErrorItem (InputToken inp)] ->- {-predicate-}TermInstr (InputToken inp -> Bool) ->- {-ok-}Gen inp (InputToken inp ': vs) ('Succ es) a ->- Gen inp vs ('Succ es) a-checkToken farExp p ok = ok- { unGen = \ctx -> [||+ Set SomeFailure ->+ {-predicate-}Splice (InputToken inp -> Bool) ->+ {-ok-}Gen inp (InputToken inp ': vs) a ->+ Gen inp vs a+checkToken fs p ok = ok+ { unGen = \ctx -> {-trace "unGen.read" $-} [|| let !(# c, cs #) = $$(nextInput ctx) $$(input ctx) in- if $$(genCode p) c- then $$(unGen ok ctx- { valueStack = ValueStackCons (H.Term [||c||]) (valueStack ctx)- , input = [||cs||]- })- else let _ = "checkToken.else" in $$(unGen (fail farExp) ctx)- ||]+ $$(genCode $+ Prod.ifThenElse+ (p Prod..@ splice [||c||])+ (splice $ unGen ok ctx+ { valueStack = ValueStackCons (splice [||c||]) (valueStack ctx)+ , input = [||cs||]+ })+ (splice [||+ let _ = "checkToken.else" in+ $$(unGen (fail fs) ctx)+ ||])+ )||] }-
src/Symantic/Parser/Machine/Input.hs view
@@ -9,6 +9,7 @@ import Data.Bool import Data.ByteString.Internal (ByteString(..)) import Data.Char (Char)+import Data.Word (Word8) import Data.Eq (Eq(..)) import Data.Function (on) import Data.Int (Int)@@ -20,7 +21,8 @@ import Data.Text.Internal (Text(..)) import Data.Text.Unsafe (iter, Iter(..), iter_, reverseIter_) import Text.Show (Show(..))-import GHC.Exts (Int(..), Char(..){-, RuntimeRep(..)-})+import GHC.Exts (Int(..), Char(..), {-, RuntimeRep(..)-})+import GHC.Word (Word8(..)) import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents) import GHC.Prim ({-Int#,-} Addr#, nullAddr#, indexWideCharArray#, {-indexWord16Array#,-} readWord8OffAddr#, word2Int#, chr#, touch#, realWorld#, plusAddr#, (+#)) import Language.Haskell.TH (CodeQ)@@ -84,7 +86,7 @@ BSL.Empty -> emptyUnpackedLazyByteString (i + size) shiftLeftByteString :: Int -> UnpackedLazyByteString -> UnpackedLazyByteString-shiftLeftByteString j (UnpackedLazyByteString i addr# final off size cs) =+shiftLeftByteString j !(UnpackedLazyByteString i addr# final off size cs) = UnpackedLazyByteString (i - d) addr# final (off - d) (size + d) cs where d = min off j @@ -140,8 +142,8 @@ UnpackedLazyByteString i nullAddr# (error "nullForeignPtr") 0 0 BSL.Empty --- * Class 'Input'-class Cursorable (Cursor inp) => Input inp where+-- * Class 'Inputable'+class Cursorable (Cursor inp) => Inputable inp where type Cursor inp :: Type type InputToken inp :: Type cursorOf :: CodeQ inp -> CodeQ@@ -150,23 +152,24 @@ , {-next-} Cursor inp -> (# InputToken inp, Cursor inp #) #) -instance Input String where+instance Inputable String where type Cursor String = Int type InputToken String = Char cursorOf input = cursorOf @(UArray Int Char) [|| listArray (0, List.length $$input-1) $$input ||]-instance Input (UArray Int Char) where+instance Inputable (UArray Int Char) where type Cursor (UArray Int Char) = Int type InputToken (UArray Int Char) = Char cursorOf qinput = [||- let UArray _ _ size input# = $$qinput+ -- Pattern bindings containing unlifted types should use an outermost bang pattern.+ let !(UArray _ _ size input#) = $$qinput next (I# i#) = (# C# (indexWideCharArray# input# i#) , I# (i# +# 1#) #) in (# 0, (< size), next #) ||]-instance Input Text where+instance Inputable Text where type Cursor Text = Text type InputToken Text = Char cursorOf inp = [||@@ -177,18 +180,19 @@ more (Text _ _ unconsumed) = unconsumed > 0 in (# $$inp, more, next #) ||]-instance Input ByteString where+instance Inputable ByteString where type Cursor ByteString = Int- type InputToken ByteString = Char+ type InputToken ByteString = Word8 cursorOf qinput = [||- let PS (ForeignPtr addr# final) off size = $$qinput+ -- Pattern bindings containing unlifted types should use an outermost bang pattern.+ let !(PS (ForeignPtr addr# final) off size) = $$qinput next i@(I# i#) = case readWord8OffAddr# (addr# `plusAddr#` i#) 0# realWorld# of (# s', x #) -> case touch# final s' of- _ -> (# C# (chr# (word2Int# x)), i + 1 #)+ _ -> (# W8# (x), i + 1 #) in (# off, (< size), next #) ||]-instance Input BSL.ByteString where+instance Inputable BSL.ByteString where type Cursor BSL.ByteString = UnpackedLazyByteString type InputToken BSL.ByteString = Char cursorOf qinput = [||@@ -212,7 +216,7 @@ in (# init, more, next #) ||] {--instance Input Text16 where+instance Inputable Text16 where type Cursor Text16 = Int cursorOf qinput = [|| let Text16 (Text arr off size) = $$qinput@@ -222,7 +226,7 @@ , I# (i# +# 1#) #) in (# off, (< size), next #) ||]-instance Input CharList where+instance Inputable CharList where type Cursor CharList = OffWith String cursorOf qinput = [|| let CharList input = $$qinput@@ -233,7 +237,7 @@ --more _ = True in (# $$offWith input, more, next #) ||]-instance Input Stream where+instance Inputable Stream where type Cursor Stream = OffWith Stream cursorOf qinput = [|| let next (OffWith o (c :> cs)) = (# c, OffWith (o + 1) cs #)@@ -244,3 +248,4 @@ -- type instance Cursor CacheText = (Text, Stream) -- type instance Cursor BSL.ByteString = OffWith BSL.ByteString -}+
src/Symantic/Parser/Machine/Instructions.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ConstraintKinds #-} -- For Machine+{-# LANGUAGE DeriveLift #-} -- For TH.Lift (Failure tok) {-# LANGUAGE DerivingStrategies #-} -- For Show (LetName a) -- | Semantic of the parsing instructions used -- to make the parsing control-flow explicit,@@ -10,146 +11,168 @@ import Data.Eq (Eq(..)) import Data.Function ((.)) import Data.Kind (Type)--- import GHC.TypeLits (Symbol)+import Data.Set (Set) import Text.Show (Show(..)) import qualified Language.Haskell.TH as TH-import qualified Symantic.Parser.Haskell as H import Symantic.Parser.Grammar import Symantic.Parser.Machine.Input---- * Type 'TermInstr'-type TermInstr = H.Term TH.CodeQ+import qualified Symantic.Typed.Lang as Prod+import qualified Symantic.Typed.Data as Sym --- * Type 'Peano'--- | Type-level natural numbers,--- using the Peano recursive encoding.-data Peano = Zero | Succ Peano+-- * Type 'Splice'+type Splice = Sym.SomeData TH.CodeQ --- * Class 'Machine'--- | All the 'Instr'uctions.-type Machine tok repr =- ( Branchable repr- , Failable repr- , Inputable repr- , Joinable repr- , Routinable repr- , Stackable repr- , Readable tok repr- )+-- | Lift a 'TH.CodeQ' into a 'Sym.SomeData'.+splice :: TH.CodeQ a -> Splice a+splice x = Sym.SomeData (Sym.Var x) -- ** Type 'ReprInstr'-type ReprInstr = Type -> [Type] -> Peano -> Type -> Type+type ReprInstr = {-input-}Type -> {-valueStack-}[Type] -> {-a-}Type -> Type -- ** Type 'LetName'--- | 'TH.Name' of a 'subroutine' or 'defJoin'+-- | 'TH.Name' of a 'defLet' or 'defJoin' -- indexed by the return type of the factorized 'Instr'uctions. -- This helps type-inferencing. newtype LetName a = LetName { unLetName :: TH.Name } deriving Eq deriving newtype Show --- ** Class 'Stackable'-class Stackable (repr::ReprInstr) where- push ::- TermInstr v ->- repr inp (v ': vs) es a ->- repr inp vs es a- pop ::- repr inp vs es a ->- repr inp (v ': vs) es a- liftI2 ::- TermInstr (x -> y -> z) ->- repr inp (z ': vs) es a ->- repr inp (y ': x ': vs) es a- swap ::- repr inp (x ': y ': vs) es a ->- repr inp (y ': x ': vs) es a- -- | @('mapI' f k)@.- mapI ::- TermInstr (x -> y) ->- repr inp (y ': vs) es a ->- repr inp (x ': vs) es a- mapI f = push f . liftI2 (H.flip H..@ (H.$))- -- | @('appI' k)@ pops @(x)@ and @(x2y)@ from the 'valueStack',+-- ** Class 'InstrValuable'+class InstrValuable (repr::ReprInstr) where+ -- | @('pushValue' x k)@ pushes @(x)@ on the 'valueStack'+ -- and continues with the next 'Instr'uction @(k)@.+ pushValue ::+ Splice v ->+ repr inp (v ': vs) a ->+ repr inp vs a+ -- | @('popValue' k)@ pushes @(x)@ on the 'valueStack'.+ popValue ::+ repr inp vs a ->+ repr inp (v ': vs) a+ -- | @('lift2Value' f k)@ pops two values from the 'valueStack',+ -- and pushes the result of @(f)@ applied to them.+ lift2Value ::+ Splice (x -> y -> z) ->+ repr inp (z ': vs) a ->+ repr inp (y ': x ': vs) a+ -- | @('swapValue' k)@ pops two values on the 'valueStack',+ -- pushes the first popped-out, then the second,+ -- and continues with the next 'Instr'uction @(k)@.+ swapValue ::+ repr inp (x ': y ': vs) a ->+ repr inp (y ': x ': vs) a+ -- | @('mapValue' f k)@.+ mapValue ::+ Splice (x -> y) ->+ repr inp (y ': vs) a ->+ repr inp (x ': vs) a+ mapValue f = pushValue f . lift2Value (Prod.flip Prod..@ (Prod.$))+ -- | @('applyValue' k)@ pops @(x)@ and @(x2y)@ from the 'valueStack', -- pushes @(x2y x)@ and continues with the next 'Instr'uction @(k)@.- appI ::- repr inp (y ': vs) es a ->- repr inp (x ': (x -> y) ': vs) es a- appI = liftI2 (H.$)+ applyValue ::+ repr inp (y ': vs) a ->+ repr inp (x ': (x -> y) ': vs) a+ applyValue = lift2Value (Prod.$) --- ** Class 'Routinable'-class Routinable (repr::ReprInstr) where- subroutine ::- LetName v -> repr inp '[] ('Succ 'Zero) v ->- repr inp vs ('Succ es) a ->- repr inp vs ('Succ es) a- call ::- LetName v -> repr inp (v ': vs) ('Succ es) a ->- repr inp vs ('Succ es) a- ret ::- repr inp '[a] es a- jump ::- LetName a ->- repr inp '[] ('Succ es) a+-- ** Class 'InstrExceptionable'+class InstrExceptionable (repr::ReprInstr) where+ -- | @('raise' exn)@ raises 'ExceptionLabel' @(exn)@.+ raise :: ExceptionLabel -> repr inp vs a+ -- | @('fail' fs)@ raises 'ExceptionFailure' @(exn)@.+ -- As a special case, giving an empty 'Set' of failures+ -- raises 'ExceptionFailure' without using the current position+ -- to update the farthest error.+ fail :: Set SomeFailure -> repr inp vs a+ -- | @('commit' exn k)@ removes the 'Catcher'+ -- from the 'catchStackByLabel' for the given 'Exception' @(exn)@,+ -- and continues with the next 'Instr'uction @(k)@.+ commit :: Exception -> repr inp vs a -> repr inp vs a+ -- | @('catch' exn l r)@ tries the @(l)@ 'Instr'uction+ -- in a new failure scope such that if @(l)@ raises an exception within @(exn)@, it is caught,+ -- then the input (and its 'Horizon') is pushed as it was before trying @(l)@ on the 'valueStack',+ -- and the control flow goes on with the @(r)@ 'Instr'uction.+ catch ::+ Exception ->+ {-scope-}repr inp vs ret ->+ {-catcher-}repr inp (Cursor inp ': vs) ret ->+ repr inp vs ret --- ** Class 'Branchable'-class Branchable (repr::ReprInstr) where- caseI ::- repr inp (x ': vs) es r ->- repr inp (y ': vs) es r ->- repr inp (Either x y ': vs) es r- choices ::- [TermInstr (v -> Bool)] ->- [repr inp vs es a] ->- repr inp vs es a ->- repr inp (v ': vs) es a- -- | @('ifI' ok ko)@ pops a 'Bool' from the 'valueStack'+-- ** Class 'InstrBranchable'+class InstrBranchable (repr::ReprInstr) where+ -- | @('caseBranch' l r)@.+ caseBranch ::+ repr inp (x ': vs) r ->+ repr inp (y ': vs) r ->+ repr inp (Either x y ': vs) r+ -- | @('choicesBranch' ps bs d)@.+ choicesBranch ::+ [Splice (v -> Bool)] ->+ [repr inp vs a] ->+ repr inp vs a ->+ repr inp (v ': vs) a+ -- | @('ifBranch' ok ko)@ pops a 'Bool' from the 'valueStack' -- and continues either with the 'Instr'uction @(ok)@ if it is 'True' -- or @(ko)@ otherwise.- ifI ::- repr inp vs es a ->- repr inp vs es a ->- repr inp (Bool ': vs) es a- ifI ok ko = choices [H.id] [ok] ko---- ** Class 'Failable'-class Failable (repr::ReprInstr) where- fail ::- [ErrorItem (InputToken inp)] ->- repr inp vs ('Succ es) a- popFail ::- repr inp vs es a ->- repr inp vs ('Succ es) a- catchFail ::- repr inp vs ('Succ es) a ->- repr inp (Cursor inp ': vs) es a ->- repr inp vs es a+ ifBranch ::+ repr inp vs a ->+ repr inp vs a ->+ repr inp (Bool ': vs) a+ ifBranch ok ko = choicesBranch [Prod.id] [ok] ko --- ** Class 'Inputable'-class Inputable (repr::ReprInstr) where- loadInput ::- repr inp vs es a ->- repr inp (Cursor inp ': vs) es a- pushInput ::- repr inp (Cursor inp ': vs) es a ->- repr inp vs es a+-- ** Class 'InstrCallable'+class InstrCallable (repr::ReprInstr) where+ -- | @('defLet' n v k)@ binds the 'LetName' @(n)@ to the 'Instr'uction's @(v)@,+ -- 'Call's @(n)@ and+ -- continues with the next 'Instr'uction @(k)@.+ defLet ::+ LetBindings TH.Name (repr inp '[]) ->+ repr inp vs a ->+ repr inp vs a+ -- | @('call' n k)@ pass the control-flow to the 'DefLet' named @(n)@,+ -- and when it 'Ret'urns, continues with the next 'Instr'uction @(k)@.+ call ::+ LetName v -> repr inp (v ': vs) a ->+ repr inp vs a+ -- | @('ret')@ returns the value stored in a singleton 'valueStack'.+ ret ::+ repr inp '[a] a+ -- | @('jump' n k)@ pass the control-flow to the 'DefLet' named @(n)@.+ jump ::+ LetName a ->+ repr inp '[] a --- ** Class 'Joinable'-class Joinable (repr::ReprInstr) where+-- ** Class 'InstrJoinable'+class InstrJoinable (repr::ReprInstr) where defJoin ::- LetName v -> repr inp (v ': vs) es a ->- repr inp vs es a ->- repr inp vs es a+ LetName v -> repr inp (v ': vs) a ->+ repr inp vs a ->+ repr inp vs a refJoin :: LetName v ->- repr inp (v ': vs) es a+ repr inp (v ': vs) a --- ** Class 'Readable'-class Readable (tok::Type) (repr::ReprInstr) where+-- ** Class 'InstrInputable'+class InstrInputable (repr::ReprInstr) where+ -- | @('pushInput' k)@ pushes the input @(inp)@ on the 'valueStack'+ -- and continues with the next 'Instr'uction @(k)@.+ pushInput ::+ repr inp (Cursor inp ': vs) a ->+ repr inp vs a+ -- | @('loadInput' k)@ removes the input from the 'valueStack'+ -- and continues with the next 'Instr'uction @(k)@ using that input.+ loadInput ::+ repr inp vs a ->+ repr inp (Cursor inp ': vs) a++-- ** Class 'InstrReadable'+class InstrReadable (tok::Type) (repr::ReprInstr) where+ -- | @('read' fs p k)@ reads a 'Char' @(c)@ from the input,+ -- if @(p c)@ is 'True' then continues with the next 'Instr'uction @(k)@,+ -- otherwise 'fail'. read :: tok ~ InputToken inp =>- [ErrorItem tok] ->- TermInstr (tok -> Bool) ->- repr inp (tok ': vs) ('Succ es) a ->- repr inp vs ('Succ es) a+ Set SomeFailure ->+ Splice (tok -> Bool) ->+ repr inp (tok ': vs) a ->+ repr inp vs a
src/Symantic/Parser/Machine/Optimize.hs view
@@ -1,42 +1,43 @@ {-# LANGUAGE PatternSynonyms #-} -- For Instr {-# LANGUAGE ViewPatterns #-} -- For unSomeInstr-{-# LANGUAGE UndecidableInstances #-} -- | Initial encoding with bottom-up optimizations of 'Instr'uctions, -- re-optimizing downward as needed after each optimization.--- There is only one optimization (for 'push') so far,+-- There is only one optimization (for 'pushValue') so far, -- but the introspection enabled by the 'Instr' data-type -- is also useful to optimize with more context in the 'Machine'. module Symantic.Parser.Machine.Optimize where import Data.Bool (Bool(..)) import Data.Either (Either)-import Data.Maybe (Maybe(..)) import Data.Function ((.)) import Data.Kind (Constraint)+import Data.Maybe (Maybe(..))+import Data.Set (Set) import Type.Reflection (Typeable, typeRep, eqTypeRep, (:~~:)(..)) import qualified Data.Functor as Functor+import qualified Language.Haskell.TH as TH +import Symantic.Typed.Derive import Symantic.Parser.Grammar import Symantic.Parser.Machine.Input import Symantic.Parser.Machine.Instructions-import Symantic.Univariant.Trans -- * Data family 'Instr' -- | 'Instr'uctions of the 'Machine'. -- This is an extensible data-type. data family Instr (instr :: ReprInstr -> Constraint)- (repr :: ReprInstr)- :: ReprInstr+ :: ReprInstr -> ReprInstr+type instance Derived (Instr instr repr inp vs) = repr inp vs -- | Convenient utility to pattern-match a 'SomeInstr'. pattern Instr :: Typeable comb =>- Instr comb repr inp vs es a ->- SomeInstr repr inp vs es a+ Instr comb repr inp vs a ->+ SomeInstr repr inp vs a pattern Instr x <- (unSomeInstr -> Just x) -- ** Type 'SomeInstr'--- | Some 'Instr'uction existantialized over the actual instruction symantic class.+-- | Some 'Instr'uction existentialized over the actual instruction symantic class. -- Useful to handle a list of 'Instr'uctions -- without requiring impredicative quantification. -- Must be used by pattern-matching@@ -46,204 +47,183 @@ -- As in 'SomeComb', a first pass of optimizations -- is directly applied in it -- to avoid introducing an extra newtype,--- this also give a more comprehensible code.-data SomeInstr repr inp vs es a =+-- this also give a more undestandable code.+data SomeInstr repr inp vs a = forall instr.- (Trans (Instr instr repr inp vs es) (repr inp vs es), Typeable instr) =>- SomeInstr (Instr instr repr inp vs es a)+ ( Derivable (Instr instr repr inp vs)+ , Typeable instr+ ) =>+ SomeInstr (Instr instr repr inp vs a) -instance Trans (SomeInstr repr inp vs es) (repr inp vs es) where- trans (SomeInstr x) = trans x+type instance Derived (SomeInstr repr inp vs) = repr inp vs+instance Derivable (SomeInstr repr inp vs) where+ derive (SomeInstr x) = derive x --- | @(unSomeInstr i :: 'Maybe' ('Instr' comb repr inp vs es a))@+-- | @(unSomeInstr i :: 'Maybe' ('Instr' comb repr inp vs a))@ -- extract the data-constructor from the given 'SomeInstr' -- iif. it belongs to the @('Instr' comb repr a)@ data-instance. unSomeInstr ::- forall instr repr inp vs es a.+ forall instr repr inp vs a. Typeable instr =>- SomeInstr repr inp vs es a ->- Maybe (Instr instr repr inp vs es a)-unSomeInstr (SomeInstr (i::Instr i repr inp vs es a)) =+ SomeInstr repr inp vs a ->+ Maybe (Instr instr repr inp vs a)+unSomeInstr (SomeInstr (i::Instr i repr inp vs a)) = case typeRep @instr `eqTypeRep` typeRep @i of Just HRefl -> Just i Nothing -> Nothing --- Stackable-data instance Instr Stackable repr inp vs fs a where- -- | @('Push' x k)@ pushes @(x)@ on the 'valueStack'- -- and continues with the next 'Instr'uction @(k)@.- Push ::- TermInstr v ->- SomeInstr repr inp (v ': vs) es a ->- Instr Stackable repr inp vs es a- -- | @('Pop' k)@ pushes @(x)@ on the 'valueStack'.- Pop ::- SomeInstr repr inp vs es a ->- Instr Stackable repr inp (v ': vs) es a- -- | @('LiftI2' f k)@ pops two values from the 'valueStack',- -- and pushes the result of @(f)@ applied to them.- LiftI2 ::- TermInstr (x -> y -> z) ->- SomeInstr repr inp (z : vs) es a ->- Instr Stackable repr inp (y : x : vs) es a- -- | @('Swap' k)@ pops two values on the 'valueStack',- -- pushes the first popped-out, then the second,- -- and continues with the next 'Instr'uction @(k)@.- Swap ::- SomeInstr repr inp (x ': y ': vs) es a ->- Instr Stackable repr inp (y ': x ': vs) es a-instance Stackable repr => Trans (Instr Stackable repr inp vs es) (repr inp vs es) where- trans = \case- Push x k -> push x (trans k)- Pop k -> pop (trans k)- LiftI2 f k -> liftI2 f (trans k)- Swap k -> swap (trans k)-instance Stackable repr => Stackable (SomeInstr repr) where- push _v (Instr (Pop i)) = i- push v i = SomeInstr (Push v i)- pop = SomeInstr . Pop- liftI2 f = SomeInstr . LiftI2 f- swap = SomeInstr . Swap+-- InstrValuable+data instance Instr InstrValuable repr inp vs a where+ PushValue ::+ Splice v ->+ SomeInstr repr inp (v ': vs) a ->+ Instr InstrValuable repr inp vs a+ PopValue ::+ SomeInstr repr inp vs a ->+ Instr InstrValuable repr inp (v ': vs) a+ Lift2Value ::+ Splice (x -> y -> z) ->+ SomeInstr repr inp (z : vs) a ->+ Instr InstrValuable repr inp (y : x : vs) a+ SwapValue ::+ SomeInstr repr inp (x ': y ': vs) a ->+ Instr InstrValuable repr inp (y ': x ': vs) a+instance InstrValuable repr => Derivable (Instr InstrValuable repr inp vs) where+ derive = \case+ PushValue x k -> pushValue x (derive k)+ PopValue k -> popValue (derive k)+ Lift2Value f k -> lift2Value f (derive k)+ SwapValue k -> swapValue (derive k)+instance InstrValuable repr => InstrValuable (SomeInstr repr) where+ -- 'PopValue' after a 'PushValue' is a no-op.+ pushValue _v (Instr (PopValue i)) = i+ pushValue v i = SomeInstr (PushValue v i)+ popValue = SomeInstr . PopValue+ lift2Value f = SomeInstr . Lift2Value f+ swapValue = SomeInstr . SwapValue --- Routinable-data instance Instr Routinable repr inp vs fs a where- -- | @('Subroutine' n v k)@ binds the 'LetName' @(n)@ to the 'Instr'uction's @(v)@,- -- 'Call's @(n)@ and- -- continues with the next 'Instr'uction @(k)@.- Subroutine ::- LetName v ->- SomeInstr repr inp '[] ('Succ 'Zero) v ->- SomeInstr repr inp vs ('Succ es) a ->- Instr Routinable repr inp vs ('Succ es) a- -- | @('Jump' n k)@ pass the control-flow to the 'Subroutine' named @(n)@.- Jump ::- LetName a ->- Instr Routinable repr inp '[] ('Succ es) a- -- | @('Call' n k)@ pass the control-flow to the 'Subroutine' named @(n)@,- -- and when it 'Ret'urns, continues with the next 'Instr'uction @(k)@.+-- InstrExceptionable+data instance Instr InstrExceptionable repr inp vs a where+ Raise ::+ ExceptionLabel ->+ Instr InstrExceptionable repr inp vs a+ Fail ::+ Set SomeFailure ->+ Instr InstrExceptionable repr inp vs a+ Commit ::+ Exception ->+ SomeInstr repr inp vs ret ->+ Instr InstrExceptionable repr inp vs ret+ Catch ::+ Exception ->+ SomeInstr repr inp vs ret ->+ SomeInstr repr inp (Cursor inp ': vs) ret ->+ Instr InstrExceptionable repr inp vs ret+instance InstrExceptionable repr => Derivable (Instr InstrExceptionable repr inp vs) where+ derive = \case+ Raise exn -> raise exn+ Fail fs -> fail fs+ Commit exn k -> commit exn (derive k)+ Catch exn l r -> catch exn (derive l) (derive r)+instance InstrExceptionable repr => InstrExceptionable (SomeInstr repr) where+ raise = SomeInstr . Raise+ fail = SomeInstr . Fail+ commit exn = SomeInstr . Commit exn+ catch exn x = SomeInstr . Catch exn x++-- InstrBranchable+data instance Instr InstrBranchable repr inp vs a where+ CaseBranch ::+ SomeInstr repr inp (x ': vs) a ->+ SomeInstr repr inp (y ': vs) a ->+ Instr InstrBranchable repr inp (Either x y ': vs) a+ ChoicesBranch ::+ [Splice (v -> Bool)] ->+ [SomeInstr repr inp vs a] ->+ SomeInstr repr inp vs a ->+ Instr InstrBranchable repr inp (v ': vs) a+instance InstrBranchable repr => Derivable (Instr InstrBranchable repr inp vs) where+ derive = \case+ CaseBranch l r -> caseBranch (derive l) (derive r)+ ChoicesBranch ps bs d -> choicesBranch ps (derive Functor.<$> bs) (derive d)+instance InstrBranchable repr => InstrBranchable (SomeInstr repr) where+ caseBranch l = SomeInstr . CaseBranch l+ choicesBranch ps bs = SomeInstr . ChoicesBranch ps bs++-- InstrCallable+data instance Instr InstrCallable repr inp vs a where+ DefLet ::+ LetBindings TH.Name (SomeInstr repr inp '[]) ->+ SomeInstr repr inp vs a ->+ Instr InstrCallable repr inp vs a Call :: LetName v ->- SomeInstr repr inp (v ': vs) ('Succ es) a ->- Instr Routinable repr inp vs ('Succ es) a- -- | @('Ret')@ returns the value stored in a singleton 'valueStack'.+ SomeInstr repr inp (v ': vs) a ->+ Instr InstrCallable repr inp vs a Ret ::- Instr Routinable repr inp '[a] es a-instance Routinable repr => Trans (Instr Routinable repr inp vs es) (repr inp vs es) where- trans = \case- Subroutine n sub k -> subroutine n (trans sub) (trans k)+ Instr InstrCallable repr inp '[a] a+ Jump ::+ LetName a ->+ Instr InstrCallable repr inp '[] a+instance InstrCallable repr => Derivable (Instr InstrCallable repr inp vs) where+ derive = \case+ DefLet subs k -> defLet ((\(SomeLet sub) -> SomeLet (derive sub)) Functor.<$> subs) (derive k) Jump n -> jump n- Call n k -> call n (trans k)+ Call n k -> call n (derive k) Ret -> ret-instance Routinable repr => Routinable (SomeInstr repr) where- subroutine n sub = SomeInstr . Subroutine n sub+instance InstrCallable repr => InstrCallable (SomeInstr repr) where+ defLet subs = SomeInstr . DefLet subs jump = SomeInstr . Jump call n = SomeInstr . Call n ret = SomeInstr Ret --- Branchable-data instance Instr Branchable repr inp vs fs a where- -- | @('Case' l r)@.- Case ::- SomeInstr repr inp (x ': vs) es a ->- SomeInstr repr inp (y ': vs) es a ->- Instr Branchable repr inp (Either x y ': vs) es a- -- | @('Choices' ps bs d)@.- Choices ::- [TermInstr (v -> Bool)] ->- [SomeInstr repr inp vs es a] ->- SomeInstr repr inp vs es a ->- Instr Branchable repr inp (v ': vs) es a-instance Branchable repr => Trans (Instr Branchable repr inp vs es) (repr inp vs es) where- trans = \case- Case l r -> caseI (trans l) (trans r)- Choices ps bs d -> choices ps (trans Functor.<$> bs) (trans d)-instance Branchable repr => Branchable (SomeInstr repr) where- caseI l = SomeInstr . Case l- choices ps bs = SomeInstr . Choices ps bs---- Failable-data instance Instr Failable repr inp vs fs a where- -- | @('Fail')@ raises an error from the 'failStack'.- Fail ::- [ErrorItem (InputToken inp)] ->- Instr Failable repr inp vs ('Succ es) a- -- | @('PopFail' k)@ removes a 'FailHandler' from the 'failStack'- -- and continues with the next 'Instr'uction @(k)@.- PopFail ::- SomeInstr repr inp vs es ret ->- Instr Failable repr inp vs ('Succ es) ret- -- | @('CatchFail' l r)@ tries the @(l)@ 'Instr'uction- -- in a new failure scope such that if @(l)@ raises a failure, it is caught,- -- then the input is pushed as it was before trying @(l)@ on the 'valueStack',- -- and the control flow goes on with the @(r)@ 'Instr'uction.- CatchFail ::- SomeInstr repr inp vs ('Succ es) ret ->- SomeInstr repr inp (Cursor inp ': vs) es ret ->- Instr Failable repr inp vs es ret-instance Failable repr => Trans (Instr Failable repr inp vs es) (repr inp vs es) where- trans = \case- Fail err -> fail err- PopFail k -> popFail (trans k)- CatchFail l r -> catchFail (trans l) (trans r)-instance Failable repr => Failable (SomeInstr repr) where- fail = SomeInstr . Fail- popFail = SomeInstr . PopFail- catchFail x = SomeInstr . CatchFail x---- Inputable-data instance Instr Inputable repr inp vs fs a where- -- | @('LoadInput' k)@ removes the input from the 'valueStack'- -- and continues with the next 'Instr'uction @(k)@ using that input.- LoadInput ::- SomeInstr repr inp vs es a ->- Instr Inputable repr inp (Cursor inp : vs) es a- -- | @('PushInput' k)@ pushes the input @(inp)@ on the 'valueStack'- -- and continues with the next 'Instr'uction @(k)@.- PushInput ::- SomeInstr repr inp (Cursor inp ': vs) es a ->- Instr Inputable repr inp vs es a-instance Inputable repr => Trans (Instr Inputable repr inp vs es) (repr inp vs es) where- trans = \case- LoadInput k -> loadInput (trans k)- PushInput k -> pushInput (trans k)-instance Inputable repr => Inputable (SomeInstr repr) where- loadInput = SomeInstr . LoadInput- pushInput = SomeInstr . PushInput---- Joinable-data instance Instr Joinable repr inp vs fs a where+-- InstrJoinable+data instance Instr InstrJoinable repr inp vs a where DefJoin :: LetName v ->- SomeInstr repr inp (v ': vs) es a ->- SomeInstr repr inp vs es a ->- Instr Joinable repr inp vs es a+ SomeInstr repr inp (v ': vs) a ->+ SomeInstr repr inp vs a ->+ Instr InstrJoinable repr inp vs a RefJoin :: LetName v ->- Instr Joinable repr inp (v ': vs) es a-instance Joinable repr => Trans (Instr Joinable repr inp vs es) (repr inp vs es) where- trans = \case- DefJoin n sub k -> defJoin n (trans sub) (trans k)+ Instr InstrJoinable repr inp (v ': vs) a+instance InstrJoinable repr => Derivable (Instr InstrJoinable repr inp vs) where+ derive = \case+ DefJoin n sub k -> defJoin n (derive sub) (derive k) RefJoin n -> refJoin n-instance Joinable repr => Joinable (SomeInstr repr) where+instance InstrJoinable repr => InstrJoinable (SomeInstr repr) where defJoin n sub = SomeInstr . DefJoin n sub refJoin = SomeInstr . RefJoin --- Readable-data instance Instr (Readable tok) repr inp vs fs a where- -- | @('Read' expected p k)@ reads a 'Char' @(c)@ from the 'inp'ut,- -- if @(p c)@ is 'True' then continues with the next 'Instr'uction @(k)@ on,- -- otherwise 'Fail'.+-- InstrInputable+data instance Instr InstrInputable repr inp vs a where+ PushInput ::+ SomeInstr repr inp (Cursor inp ': vs) a ->+ Instr InstrInputable repr inp vs a+ LoadInput ::+ SomeInstr repr inp vs a ->+ Instr InstrInputable repr inp (Cursor inp ': vs) a+instance InstrInputable repr => Derivable (Instr InstrInputable repr inp vs) where+ derive = \case+ PushInput k -> pushInput (derive k)+ LoadInput k -> loadInput (derive k)+instance InstrInputable repr => InstrInputable (SomeInstr repr) where+ pushInput = SomeInstr . PushInput+ loadInput = SomeInstr . LoadInput++-- InstrReadable+data instance Instr (InstrReadable tok) repr inp vs a where Read ::- [ErrorItem (InputToken inp)] ->- TermInstr (InputToken inp -> Bool) ->- SomeInstr repr inp (InputToken inp ': vs) ('Succ es) a ->- Instr (Readable tok) repr inp vs ('Succ es) a+ Set SomeFailure ->+ Splice (InputToken inp -> Bool) ->+ SomeInstr repr inp (InputToken inp ': vs) a ->+ Instr (InstrReadable tok) repr inp vs a instance- ( Readable tok repr, tok ~ InputToken inp ) =>- Trans (Instr (Readable tok) repr inp vs es) (repr inp vs es) where- trans = \case- Read es p k -> read es p (trans k)+ ( InstrReadable tok repr, tok ~ InputToken inp ) =>+ Derivable (Instr (InstrReadable tok) repr inp vs) where+ derive = \case+ Read fs p k -> read fs p (derive k) instance- ( Readable tok repr, Typeable tok ) =>- Readable tok (SomeInstr repr) where- read es p = SomeInstr . Read es p+ ( InstrReadable tok repr, Typeable tok ) =>+ InstrReadable tok (SomeInstr repr) where+ read fs p = SomeInstr . Read fs p
src/Symantic/Parser/Machine/Program.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE UndecidableInstances #-} -- For Cursorable (Cursor inp) -- | Build the 'Instr'uction 'Program' of a 'Machine' -- from the 'Comb'inators of a 'Grammar'.@@ -7,21 +8,29 @@ -- those generated (eg. by using 'joinNext'). module Symantic.Parser.Machine.Program where +import Control.Monad (Monad(..), (<=<), (=<<), liftM, liftM2, sequence)+import Data.Function (($))+import System.IO (IO)+import Type.Reflection (Typeable)+import Control.DeepSeq (NFData) import Data.Bool (Bool(..))+import Data.Eq (Eq)+import Data.Function ((.)) import Data.Ord (Ord)-import Data.Function (($), (.))-import Type.Reflection (Typeable)-import System.IO.Unsafe (unsafePerformIO)+import Text.Show (Show(..)) import qualified Data.Functor as Functor+import qualified Data.HashMap.Strict as HM+import qualified Data.Set as Set+import qualified Data.Traversable as Traversable import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH-import qualified Symantic.Parser.Haskell as H+import qualified Symantic.Typed.Lang as Prod +import Symantic.Typed.Derive import Symantic.Parser.Grammar import Symantic.Parser.Machine.Input import Symantic.Parser.Machine.Instructions import Symantic.Parser.Machine.Optimize-import Symantic.Univariant.Trans -- * Type 'Program' -- | A 'Program' is a tree of 'Instr'uctions,@@ -29,61 +38,102 @@ -- to be able to introspect, duplicate and/or change -- the next 'Instr'uction. data Program repr inp a = Program { unProgram ::- forall vs es ret.+ forall vs ret. -- This is the next instruction- SomeInstr repr inp (a ': vs) ('Succ es) ret ->+ SomeInstr repr inp (a ': vs) ret -> -- This is the current instruction- SomeInstr repr inp vs ('Succ es) ret }+ -- IO is needed for 'TH.newName' in 'joinNext'.+ IO (SomeInstr repr inp vs ret)+ } --- | Build an interpreter of the 'Program' of the given 'Machine'.+-- | Build an interpreter of the 'Program' of the given 'Machinable'. optimizeMachine ::- forall inp es repr a.- Machine (InputToken inp) repr =>+ forall inp repr a.+ Machinable (InputToken inp) repr => Program repr inp a ->- repr inp '[] ('Succ es) a-optimizeMachine (Program f) = trans (f @'[] @es ret)+ IO (repr inp '[] a)+optimizeMachine (Program f) = derive Functor.<$> f @'[] ret +-- * Class 'Machinable'+-- | All the 'Instr'uctions.+type Machinable tok repr =+ ( InstrBranchable repr+ , InstrExceptionable repr+ , InstrInputable repr+ , InstrJoinable repr+ , InstrCallable repr+ , InstrValuable repr+ , InstrReadable tok repr+ , Eq tok+ , Ord tok+ , TH.Lift tok+ , NFData tok+ , Show tok+ , Typeable tok+ )+ instance- Stackable repr =>- Applicable (Program repr inp) where- pure x = Program (push (trans x))- Program f <*> Program x = Program (f . x . appI)- liftA2 f (Program x) (Program y) =- Program (x . y . liftI2 (trans f))- Program x *> Program y = Program (x . pop . y)- Program x <* Program y = Program (x . y . pop)+ ( Cursorable (Cursor inp)+ , InstrBranchable repr+ , InstrExceptionable repr+ , InstrInputable repr+ , InstrJoinable repr+ , InstrValuable repr+ , InstrReadable (InputToken inp) repr+ , Typeable (InputToken inp)+ ) =>+ Derivable (Comb CombAlternable (Program repr inp)) where+ derive = \case+ Alt ExceptionFailure+ (Comb (SatisfyOrFail _fs p :: Comb (CombSatisfiable (InputToken inp)) (Program repr inp) a))+ (Comb (Failure sf)) ->+ satisfyOrFail (Set.singleton sf) p+ Alt exn x y -> alt exn (derive x) (derive y)+ Empty -> empty+ Failure sf -> failure sf+ Throw exn -> throw exn+ Try x -> try (derive x)+ instance ( Cursorable (Cursor inp)- , Branchable repr- , Failable repr- , Inputable repr- , Joinable repr- , Stackable repr- ) => Alternable (Program repr inp) where- empty = Program $ \_next -> fail []- Program l <|> Program r = joinNext $ Program $ \next ->- catchFail- (l (popFail next))- (failIfConsumed (r next))+ , InstrBranchable repr+ , InstrExceptionable repr+ , InstrInputable repr+ , InstrJoinable repr+ , InstrValuable repr+ ) => CombAlternable (Program repr inp) where+ alt exn (Program l) (Program r) = joinNext $ Program $ \next ->+ liftM2 (catch exn)+ (l (commit exn next))+ (failIfConsumed exn Functor.<$> r next)+ throw exn = Program $ \_next -> return $ raise exn+ failure flr = Program $ \_next -> return $ fail (Set.singleton flr)+ empty = Program $ \_next -> return $ fail (Set.singleton (SomeFailure FailureEmpty)) try (Program x) = Program $ \next ->- catchFail- (x (popFail next))- -- On exception, reset the input,- -- and propagate the failure.- (loadInput (fail []))+ liftM2 (catch ExceptionFailure)+ (x (commit ExceptionFailure next))+ -- On exception, reset the input, and propagate the failure.+ (return $ loadInput $ fail Set.empty) -- | If no input has been consumed by the failing alternative -- then continue with the given continuation.--- Otherwise, propagate the 'Fail'ure.+-- Otherwise, propagate the failure. failIfConsumed :: Cursorable (Cursor inp) =>- Branchable repr =>- Failable repr =>- Inputable repr =>- Stackable repr =>- SomeInstr repr inp vs ('Succ es) ret ->- SomeInstr repr inp (Cursor inp : vs) ('Succ es) ret-failIfConsumed k = pushInput (liftI2 (H.Term sameOffset) (ifI k (fail [])))+ InstrBranchable repr =>+ InstrExceptionable repr =>+ InstrInputable repr =>+ InstrValuable repr =>+ Exception ->+ SomeInstr repr inp vs ret ->+ SomeInstr repr inp (Cursor inp ': vs) ret+failIfConsumed exn k =+ pushInput $+ lift2Value (splice sameOffset) $+ ifBranch k $+ case exn of+ ExceptionLabel lbl -> raise lbl+ ExceptionFailure -> fail Set.empty -- | @('joinNext' m)@ factorize the next 'Instr'uction -- to be able to reuse it multiple times without duplication.@@ -95,7 +145,7 @@ -- It should be used each time the next 'Instr'uction -- is used multiple times. joinNext ::- Joinable repr =>+ InstrJoinable repr => Program repr inp v -> Program repr inp v joinNext (Program m) = Program $ \case@@ -103,59 +153,83 @@ -- If a join-node points directly to another join-node, -- then reuse it next@(Instr RefJoin{}) -> m next+ -- If a join-node points directly to a 'jump',+ -- then reuse it.+ -- Because 'Jump' expects an empty 'valueStack',+ -- a 'PopValue' has to be here to drop+ -- the value normaly expected by the 'next' 'Instr'uction.+ next@(Instr (PopValue (Instr Jump{}))) -> m next -- Terminal refJoin Optimization: -- If a join-node points directly to a terminal operation, -- then it's useless to introduce a join-node. next@(Instr Ret{}) -> m next -- Introduce a join-node.- next -> defJoin joinName next (m (refJoin joinName))- where joinName = LetName $ unsafePerformIO $ TH.qNewName "join"+ next -> do+ !joinName <- TH.newName "join"+ defJoin (LetName joinName) next+ Functor.<$> m (refJoin (LetName joinName)) instance- ( tok ~ InputToken inp- , Readable tok repr- , Typeable tok- ) => Satisfiable tok (Program repr inp) where- satisfy es p = Program $ read es (trans p)+ InstrValuable repr =>+ CombApplicable (Program repr inp) where+ pure x = Program $ return . pushValue (prodCode x)+ Program f <*> Program x = Program $ (f <=< x) . applyValue+ liftA2 f (Program x) (Program y) = Program $ (x <=< y) . lift2Value (prodCode f)+ Program x *> Program y = Program (x <=< return . popValue <=< y)+ Program x <* Program y = Program (x <=< y <=< return . popValue) instance- ( Branchable repr- , Joinable repr- , Stackable repr- ) => Selectable (Program repr inp) where- branch (Program lr) (Program l) (Program r) = joinNext $ Program $ \next ->- lr (caseI- (l (swap (appI next)))- (r (swap (appI next))))+ ( Cursorable (Cursor inp)+ , InstrBranchable repr+ , InstrExceptionable repr+ , InstrInputable repr+ , InstrJoinable repr+ , InstrValuable repr+ ) => CombFoldable (Program repr inp) where+ {-+ chainPre op p = go <*> p+ where go = (Prod..) <$> op <*> go <|> pure Prod.id+ chainPost p op = p <**> go+ where go = (Prod..) <$> op <*> go <|> pure Prod.id+ -} instance- ( Branchable repr- , Joinable repr- ) => Matchable (Program repr inp) where- conditional (Program a) ps bs (Program d) = joinNext $ Program $ \next ->- a (choices- (trans Functor.<$> ps)- ((\(Program b) -> b next) Functor.<$> bs)- (d next))+ InstrCallable repr =>+ Letable TH.Name (Program repr inp) where+ shareable n (Program sub) = Program $ \next -> do+ sub' <- sub ret+ return $ defLet (HM.singleton n (SomeLet sub')) (call (LetName n) next)+ ref _isRec n = Program $ \case+ -- Tail Call Optimization:+ -- returning just after a 'call' is useless:+ -- using 'jump' lets the 'ret' of the 'defLet'+ -- directly return where it would in two 'ret's.+ Instr Ret{} -> return $ jump (LetName n)+ next -> return $ call (LetName n) next instance- ( Ord (InputToken inp)+ InstrCallable repr =>+ Letsable TH.Name (Program repr inp) where+ lets defs (Program x) = Program $ \next -> do+ defs' <- Traversable.traverse (\(SomeLet (Program val)) -> liftM SomeLet (val ret)) defs+ liftM (defLet defs') (x next)+instance+ ( Eq (InputToken inp) , Cursorable (Cursor inp)- , Branchable repr- , Failable repr- , Inputable repr- , Joinable repr- , Readable (InputToken inp) repr+ , InstrBranchable repr+ , InstrExceptionable repr+ , InstrInputable repr+ , InstrJoinable repr+ , InstrReadable (InputToken inp) repr , Typeable (InputToken inp)- , Stackable repr- ) => Lookable (Program repr inp) where+ , InstrValuable repr+ ) => CombLookable (Program repr inp) where look (Program x) = Program $ \next ->- pushInput (x (swap (loadInput next)))- eof = negLook (satisfy [{-discarded by negLook-}] (H.lam1 (\_x -> H.bool True)))+ liftM pushInput (x (swapValue (loadInput next)))+ eof = negLook (satisfy (Prod.const Prod..@ Prod.bool True)) -- This sets a better failure message- <|> (Program $ \_k -> fail [ErrorItemEnd])+ <|> (Program $ \_next -> return $ fail (Set.singleton (SomeFailure FailureEnd))) negLook (Program x) = Program $ \next ->- catchFail+ liftM2 (catch ExceptionFailure) -- On x success, discard the result,- -- and replace this 'CatchFail''s failure handler- -- by a 'Fail'ure whose 'farthestExpecting' is negated,+ -- and replace this 'Catcher' by a failure whose 'farthestExpecting' is negated, -- then a failure is raised from the input -- when entering 'negLook', to avoid odd cases: -- - where the failure that made (negLook x)@@ -163,34 +237,35 @@ -- failure of the grammar. -- - where the overall failure of -- the grammar might be blamed on something in x- -- that, if corrected, still makes x succeed and- -- (negLook x) fail.- (pushInput (x (pop (popFail (loadInput (fail []))))))+ -- that, if corrected, still makes x succeed+ -- and (negLook x) fail.+ (liftM pushInput $ x $+ popValue $ commit ExceptionFailure $+ loadInput $ fail Set.empty) -- On x failure, reset the input, -- and go on with the next 'Instr'uctions.- (loadInput (push H.unit next))+ (return $ loadInput $ pushValue Prod.unit next) instance- Routinable repr =>- Letable TH.Name (Program repr inp) where- def n (Program v) = Program $ \next ->- subroutine (LetName n) (v ret) (call (LetName n) next)- ref _isRec n = Program $ \case- -- Returning just after a 'call' is useless:- -- using 'jump' lets the 'ret' of the 'subroutine'- -- directly return where it would in two 'ret's.- Instr Ret{} -> jump (LetName n)- next -> call (LetName n) next+ ( InstrBranchable repr+ , InstrJoinable repr+ ) => CombMatchable (Program repr inp) where+ conditional (Program a) ps bs (Program d) = joinNext $ Program $ \next -> do+ bs' <- Control.Monad.sequence $ (\(Program b) -> b next) Functor.<$> bs+ a =<< liftM (choicesBranch (prodCode Functor.<$> ps) bs') (d next) instance- ( Cursorable (Cursor inp)- , Branchable repr- , Failable repr- , Inputable repr- , Joinable repr- , Stackable repr- ) => Foldable (Program repr inp) where- {-- chainPre op p = go <*> p- where go = (H..) <$> op <*> go <|> pure H.id- chainPost p op = p <**> go- where go = (H..) <$> op <*> go <|> pure H.id- -}+ ( tok ~ InputToken inp+ , InstrReadable tok repr+ , Typeable tok+ ) => CombSatisfiable tok (Program repr inp) where+ -- Note: 'read' is left with the responsability+ -- to apply 'normalOrderReduction' if need be.+ satisfyOrFail fs p = Program $ return . read fs (prodCode p)+instance+ ( InstrBranchable repr+ , InstrJoinable repr+ , InstrValuable repr+ ) => CombSelectable (Program repr inp) where+ branch (Program lr) (Program l) (Program r) = joinNext $ Program $ \next ->+ lr =<< liftM2 caseBranch+ (l (swapValue (applyValue next)))+ (r (swapValue (applyValue next)))
src/Symantic/Parser/Machine/View.hs view
@@ -1,92 +1,210 @@+{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE UndecidableInstances #-} -- For ShowLetName module Symantic.Parser.Machine.View where import Data.Bool (Bool(..))-import Data.Function (($), (.), id)+import Data.Either (Either(..))+import Data.Function (($), (.), id, on) import Data.Functor ((<$>)) import Data.Kind (Type)+import Data.Ord (Ord(..)) import Data.Semigroup (Semigroup(..))-import Data.String (String, IsString(..))+import Data.String (String)+import Data.Tuple (fst) import Text.Show (Show(..))-import qualified Data.Tree as Tree+import qualified Data.HashMap.Strict as HM import qualified Data.List as List+import qualified Data.Map.Strict as Map+import qualified Data.Set as Set+import qualified Data.Tree as Tree import qualified Language.Haskell.TH.Syntax as TH+import Prelude (error) import Symantic.Parser.Grammar.ObserveSharing (ShowLetName(..)) import Symantic.Parser.Machine.Instructions+import Symantic.Typed.ObserveSharing (SomeLet(..))+import Symantic.Parser.Machine.Generate -- * Type 'ViewMachine'-newtype ViewMachine (showName::Bool) inp (vs:: [Type]) (es::Peano) a- = ViewMachine { unViewMachine ::- Tree.Forest String -> Tree.Forest String }+data ViewMachine (showName::Bool) inp (vs:: [Type]) a+ = ViewMachine+ { viewGen :: Gen inp vs a+ -- ^ Provide 'GenAnalysis', which next important for debugging+ -- and improving golden tests, see 'viewInstrCmd'.+ , unViewMachine ::+ CallTrace ->+ LetMap GenAnalysis -> -- Output of 'runGenAnalysis'.+ Tree.Forest (String, String) ->+ Tree.Forest (String, String)+ } viewMachine ::- ViewMachine sN inp vs es a ->- ViewMachine sN inp vs es a+ ViewMachine sN inp vs a ->+ ViewMachine sN inp vs a viewMachine = id -- | Helper to view a command.-viewInstrCmd :: String -> Tree.Forest String -> Tree.Tree String-viewInstrCmd n = Tree.Node n+viewInstrCmd ::+ Either TH.Name (Gen inp vs a) ->+ CallTrace ->+ LetMap GenAnalysis ->+ (String, String) -> Tree.Forest (String, String) -> Tree.Tree (String, String)+viewInstrCmd gen ct lm (n, no) = Tree.Node $ (n+ <> "\nminReads="<>showsPrec 11 (minReads ga) ""+ <> "\nmayRaise="<>showsPrec 11 (Map.keys (mayRaise ga)) ""+ , no)+ where+ ga = case gen of+ Right r -> (\f -> f ct) $ genAnalysis r $ (\f _ct -> f) <$> lm+ Left l -> HM.findWithDefault (error (show (l, HM.keys lm))) l lm+ -- | Helper to view an argument.-viewInstrArg :: String -> Tree.Forest String -> Tree.Tree String-viewInstrArg n = Tree.Node ("<"<>n<>">")+viewInstrArg :: String -> Tree.Forest (String, String) -> Tree.Tree (String, String)+viewInstrArg n = Tree.Node $ ("<"<>n<>">", "") -instance Show (ViewMachine sN inp vs es a) where- show = drawTree . Tree.Node "" . ($ []) . unViewMachine+instance Show (ViewMachine sN inp vs a) where+ show vm = List.unlines $ drawTrees $+ unViewMachine vm [] (runGenAnalysis (genAnalysisByLet (viewGen vm))) [] where- drawTree :: Tree.Tree String -> String- drawTree = List.unlines . draw- draw :: Tree.Tree String -> [String]- draw (Tree.Node x ts0) = List.lines x <> drawSubTrees ts0- where- drawSubTrees [] = []- drawSubTrees [t] = shift "" " " (draw t)- drawSubTrees (t:ts) = shift "" "| " (draw t) <> drawSubTrees ts- shift first other = List.zipWith (<>) (first : List.repeat other)-instance IsString (ViewMachine sN inp vs es a) where- fromString s = ViewMachine $ \is -> Tree.Node (fromString s) [] : is+ draw :: Tree.Tree (String, String) -> [String]+ draw (Tree.Node (x, n) ts0) =+ shift "" " " (List.zipWith (<>) (List.lines x) (n : List.repeat "")) <>+ shift "| " "| " (drawTrees ts0)+ drawTrees [] = []+ drawTrees [t] = draw t+ drawTrees (t:ts) = draw t <> drawTrees ts+ shift ind0 ind = List.zipWith (<>) (ind0 : List.repeat ind) -instance Stackable (ViewMachine sN) where- push a k = ViewMachine $ \is -> viewInstrCmd ("push "<>showsPrec 10 a "") [] : unViewMachine k is- pop k = ViewMachine $ \is -> viewInstrCmd "pop" [] : unViewMachine k is- liftI2 f k = ViewMachine $ \is -> viewInstrCmd ("lift "<>showsPrec 10 f "") [] : unViewMachine k is- swap k = ViewMachine $ \is -> viewInstrCmd "swap" [] : unViewMachine k is-instance Branchable (ViewMachine sN) where- caseI l r = ViewMachine $ \is -> viewInstrCmd "case"- [ viewInstrArg "left" (unViewMachine l [])- , viewInstrArg "right" (unViewMachine r [])- ] : is- choices ps bs d = ViewMachine $ \is ->- viewInstrCmd ("choices "<>show ps) (- (viewInstrArg "branch" . ($ []) . unViewMachine <$> bs) <>- [ viewInstrArg "default" (unViewMachine d []) ]- ) : is-instance Failable (ViewMachine sN) where- fail _err = ViewMachine $ \is -> viewInstrCmd "fail" [] : is- popFail k = ViewMachine $ \is -> viewInstrCmd "popFail" [] : unViewMachine k is- catchFail t h = ViewMachine $ \is -> viewInstrCmd "catchFail"- [ viewInstrArg "try" (unViewMachine t [])- , viewInstrArg "handler" (unViewMachine h [])- ] : is-instance Inputable (ViewMachine sN) where- loadInput k = ViewMachine $ \is -> viewInstrCmd "loadInput" [] : unViewMachine k is- pushInput k = ViewMachine $ \is -> viewInstrCmd "pushInput" [] : unViewMachine k is+instance InstrValuable (ViewMachine sN) where+ pushValue a k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("pushValue "<>showsPrec 10 a "", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = pushValue a (viewGen k)+ popValue k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("popValue", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = popValue (viewGen k)+ lift2Value f k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("lift2Value "<>showsPrec 10 f "", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = lift2Value f (viewGen k)+ swapValue k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("swapValue", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = swapValue (viewGen k)+instance InstrExceptionable (ViewMachine sN) where+ raise exn = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("raise "<>show exn, "") [] : next+ , viewGen = gen+ } where gen = raise exn+ fail flr = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("fail "<>show (Set.toList flr), "") [] : next+ , viewGen = gen+ } where gen = fail flr+ commit exn k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("commit "<>show exn, "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = commit exn (viewGen k)+ catch exn ok ko = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("catch "<>show exn, "")+ [ viewInstrArg "ok" (unViewMachine ok ct lm [])+ , viewInstrArg "ko" (unViewMachine ko ct lm [])+ ] : next+ , viewGen = gen+ } where gen = catch exn (viewGen ok) (viewGen ko)+instance InstrBranchable (ViewMachine sN) where+ caseBranch l r = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("case", "")+ [ viewInstrArg "left" (unViewMachine l ct lm [])+ , viewInstrArg "right" (unViewMachine r ct lm [])+ ] : next+ , viewGen = gen+ } where gen = caseBranch (viewGen l) (viewGen r)+ choicesBranch ps bs d = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("choicesBranch "<>show ps, "") (+ ((\b -> viewInstrArg "branch" $ unViewMachine b ct lm []) <$> bs) <>+ [ viewInstrArg "default" (unViewMachine d ct lm []) ]+ ) : next+ , viewGen = gen+ } where gen = choicesBranch ps (viewGen <$> bs) (viewGen d) instance ShowLetName sN TH.Name =>- Routinable (ViewMachine sN) where- subroutine (LetName n) sub k = ViewMachine $ \is ->- Tree.Node (showLetName @sN n<>":") (unViewMachine sub [])- : unViewMachine k is- jump (LetName n) = ViewMachine $ \is -> viewInstrCmd ("jump "<>showLetName @sN n) [] : is- call (LetName n) k = ViewMachine $ \is -> viewInstrCmd ("call "<>showLetName @sN n) [] : unViewMachine k is- ret = ViewMachine $ \is -> viewInstrCmd "ret" [] : is+ InstrCallable (ViewMachine sN) where+ defLet defs k = ViewMachine+ { unViewMachine = \ct lm next ->+ (<> unViewMachine k ct lm next) $+ List.sortBy (compare `on` (((fst <$>) <$>) . Tree.levels)) $+ ((\(n, SomeLet sub) ->+ viewInstrCmd (Left n) ct lm+ ("let", " "<>showLetName @sN n)+ (unViewMachine sub ct lm []))+ <$> HM.toList defs)+ , viewGen = gen+ } where gen = defLet ((\(SomeLet x) -> SomeLet (viewGen x)) <$> defs) (viewGen k)+ jump ln@(LetName n) = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("jump", " "<>showLetName @sN n) [] : next+ , viewGen = gen+ } where gen = jump ln+ call ln@(LetName n) k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("call", " "<>showLetName @sN n) [] :+ unViewMachine k (n:ct) lm next+ , viewGen = gen+ } where gen = call ln (viewGen k)+ ret = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("ret", "") [] : next+ , viewGen = gen+ } where gen = ret instance ShowLetName sN TH.Name =>- Joinable (ViewMachine sN) where- defJoin (LetName n) j k = ViewMachine $ \is ->- Tree.Node (showLetName @sN n<>":") (unViewMachine j [])- : unViewMachine k is- refJoin (LetName n) = ViewMachine $ \is -> viewInstrCmd ("refJoin "<>showLetName @sN n) [] : is-instance Readable tok (ViewMachine sN) where- read _es p k = ViewMachine $ \is -> viewInstrCmd ("read "<>showsPrec 10 p "") [] : unViewMachine k is+ InstrJoinable (ViewMachine sN) where+ defJoin ln@(LetName n) j k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Left n) ct lm+ ("join", " "<>showLetName @sN n)+ (unViewMachine j ct lm []) :+ unViewMachine k (n:ct) lm next+ , viewGen = gen+ } where gen = defJoin ln (viewGen j) (viewGen k)+ refJoin ln@(LetName n) = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("refJoin", " "<>showLetName @sN n) [] : next+ , viewGen = gen+ } where gen = refJoin ln+instance InstrInputable (ViewMachine sN) where+ pushInput k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("pushInput", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = pushInput (viewGen k)+ loadInput k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("loadInput", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = loadInput (viewGen k)+instance InstrReadable tok Gen => InstrReadable tok (ViewMachine sN) where+ read es p k = ViewMachine+ { unViewMachine = \ct lm next ->+ viewInstrCmd (Right gen) ct lm ("read "<>showsPrec 10 p "", "") [] :+ unViewMachine k ct lm next+ , viewGen = gen+ } where gen = read es p (viewGen k)
− src/Symantic/Univariant/Letable.hs
@@ -1,242 +0,0 @@-{-# LANGUAGE AllowAmbiguousTypes #-} -- For ShowLetName-{-# LANGUAGE DefaultSignatures #-}-{-# LANGUAGE ExistentialQuantification #-} -- For SharingName--- {-# LANGUAGE MagicHash #-} -- For unsafeCoerce#-module Symantic.Univariant.Letable where--import Control.Applicative (Applicative(..))-import Control.Monad (Monad(..))-import Data.Bool (Bool(..))-import Data.Eq (Eq(..))-import Data.Foldable (foldMap)-import Data.Function (($), (.))-import Data.Functor ((<$>))-import Data.Functor.Compose (Compose(..))-import Data.HashMap.Strict (HashMap)-import Data.HashSet (HashSet)-import Data.Hashable (Hashable, hashWithSalt, hash)-import Data.Int (Int)-import Data.Maybe (Maybe(..), isNothing)-import Data.Monoid (Monoid(..))-import Data.Ord (Ord(..))-import Data.String (String)--- import GHC.Exts (Int(..))--- import GHC.Prim (unsafeCoerce#)-import GHC.StableName (StableName(..), makeStableName, hashStableName, eqStableName)--- import Numeric (showHex)-import Prelude ((+))-import System.IO (IO)-import System.IO.Unsafe (unsafePerformIO)-import Text.Show (Show(..))-import qualified Control.Monad.Trans.Class as MT-import qualified Control.Monad.Trans.Reader as MT-import qualified Control.Monad.Trans.State as MT-import qualified Data.HashMap.Strict as HM-import qualified Data.HashSet as HS--import Symantic.Univariant.Trans---- import Debug.Trace (trace)---- * Class 'Letable'--- | This class is not for end-users like usual symantic operators,--- here 'def' and 'ref' are introduced by 'observeSharing'.-class Letable letName repr where- -- | @('def' letName x)@ let-binds @(letName)@ to be equal to @(x)@.- def :: letName -> repr a -> repr a- -- | @('ref' isRec letName)@ is a reference to @(letName)@.- -- @(isRec)@ is 'True' iif. this 'ref'erence is recursive,- -- ie. is reachable within its 'def'inition.- ref :: Bool -> letName -> repr a- default def ::- Liftable1 repr => Letable letName (Output repr) =>- letName -> repr a -> repr a- default ref ::- Liftable repr => Letable letName (Output repr) =>- Bool -> letName -> repr a- def n = lift1 (def n)- ref r n = lift (ref r n)---- * Class 'MakeLetName'-class MakeLetName letName where- makeLetName :: SharingName -> IO letName---- ** Type 'ShowLetName'--- | Useful on golden unit tests because 'StableName'--- change often when changing unrelated source code--- or even changing basic GHC or executable flags.-class ShowLetName (showName::Bool) letName where- showLetName :: letName -> String--- | Like 'Show'.-instance Show letName => ShowLetName 'True letName where- showLetName = show--- | Always return @"<hidden>"@,-instance ShowLetName 'False letName where- showLetName _p = "<hidden>"---- * Type 'SharingName'--- | Note that the observable sharing enabled by 'StableName'--- is not perfect as it will not observe all the sharing explicitely done.------ Note also that the observed sharing could be different between ghc and ghci.-data SharingName = forall a. SharingName (StableName a)--- | @('makeSharingName' x)@ is like @('makeStableName' x)@ but it also forces--- evaluation of @(x)@ to ensure that the 'StableName' is correct first time,--- which avoids to produce a tree bigger than needed.------ Note that this function uses 'unsafePerformIO' instead of returning in 'IO',--- this is apparently required to avoid infinite loops due to unstable 'StableName'--- in compiled code, and sometimes also in ghci.------ Note that maybe [pseq should be used here](https://gitlab.haskell.org/ghc/ghc/-/issues/2916).-makeSharingName :: a -> SharingName-makeSharingName !x = SharingName $ unsafePerformIO $ makeStableName x--instance Eq SharingName where- SharingName x == SharingName y = eqStableName x y-instance Hashable SharingName where- hash (SharingName n) = hashStableName n- hashWithSalt salt (SharingName n) = hashWithSalt salt n-{--instance Show SharingName where- showsPrec _ (SharingName n) = showHex (I# (unsafeCoerce# n))--}---- * Type 'ObserveSharing'--- | Interpreter detecting some (Haskell embedded) @let@ definitions used at--- least once and/or recursively, in order to replace them--- with the 'def' and 'ref' combinators.--- See [Type-safe observable sharing in Haskell](https://doi.org/10.1145/1596638.1596653)-newtype ObserveSharing letName repr a = ObserveSharing { unObserveSharing ::- MT.ReaderT (HashSet SharingName)- (MT.State (ObserveSharingState letName))- (CleanDefs letName repr a) }--observeSharing ::- Eq letName =>- Hashable letName =>- ObserveSharing letName repr a ->- repr a-observeSharing (ObserveSharing m) = do- let (a, st) = MT.runReaderT m mempty `MT.runState`- ObserveSharingState- { oss_refs = HM.empty- , oss_recs = HS.empty- }- let refs = HS.fromList $- (`foldMap` oss_refs st) $ (\(letName, refCount) ->- if refCount > 0 then [letName] else [])- -- trace (show refs) $- unCleanDefs a refs---- ** Type 'ObserveSharingState'-data ObserveSharingState letName = ObserveSharingState- { oss_refs :: HashMap SharingName (letName, Int)- , oss_recs :: HashSet SharingName- -- ^ TODO: unused so far, will it be useful somewhere at a later stage?- }--observeSharingNode ::- Eq letName =>- Hashable letName =>- Letable letName repr =>- MakeLetName letName =>- ObserveSharing letName repr a ->- ObserveSharing letName repr a-observeSharingNode (ObserveSharing m) = ObserveSharing $ do- let nodeName = makeSharingName m- st <- MT.lift MT.get- ((letName, before), preds) <- getCompose $ HM.alterF (\before ->- Compose $ case before of- Nothing -> do- let letName = unsafePerformIO $ makeLetName nodeName- return ((letName, before), Just (letName, 0))- Just (letName, refCount) -> do- return ((letName, before), Just (letName, refCount + 1))- ) nodeName (oss_refs st)- parentNames <- MT.ask- if nodeName `HS.member` parentNames- then do- MT.lift $ MT.put st- { oss_refs = preds- , oss_recs = HS.insert nodeName (oss_recs st)- }- return $ ref True letName- else do- MT.lift $ MT.put st{ oss_refs = preds }- if isNothing before- then MT.local (HS.insert nodeName) (def letName <$> m)- else return $ ref False letName--type instance Output (ObserveSharing letName repr) = CleanDefs letName repr-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- ) => Trans (CleanDefs letName repr) (ObserveSharing letName repr) where- trans = observeSharingNode . ObserveSharing . return-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- ) => Trans1 (CleanDefs letName repr) (ObserveSharing letName repr) where- trans1 f x = observeSharingNode $ ObserveSharing $- f <$> unObserveSharing x-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- ) => Trans2 (CleanDefs letName repr) (ObserveSharing letName repr) where- trans2 f x y = observeSharingNode $ ObserveSharing $- f <$> unObserveSharing x- <*> unObserveSharing y-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- ) => Trans3 (CleanDefs letName repr) (ObserveSharing letName repr) where- trans3 f x y z = observeSharingNode $ ObserveSharing $- f <$> unObserveSharing x- <*> unObserveSharing y- <*> unObserveSharing z-instance- ( Letable letName repr- , MakeLetName letName- , Eq letName- , Hashable letName- ) => Letable letName (ObserveSharing letName repr)---- * Type 'CleanDefs'--- | Remove 'def' when non-recursive or unused.-newtype CleanDefs letName repr a = CleanDefs { unCleanDefs ::- HS.HashSet letName -> repr a }--type instance Output (CleanDefs _letName repr) = repr-instance Trans repr (CleanDefs letName repr) where- trans = CleanDefs . pure-instance Trans1 repr (CleanDefs letName repr) where- trans1 f x = CleanDefs $ f <$> unCleanDefs x-instance Trans2 repr (CleanDefs letName repr) where- trans2 f x y = CleanDefs $- f <$> unCleanDefs x- <*> unCleanDefs y-instance Trans3 repr (CleanDefs letName repr) where- trans3 f x y z = CleanDefs $- f <$> unCleanDefs x- <*> unCleanDefs y- <*> unCleanDefs z-instance- ( Letable letName repr- , Eq letName- , Hashable letName- ) => Letable letName (CleanDefs letName repr) where- def name x = CleanDefs $ \refs ->- if name `HS.member` refs- then -- Perserve 'def'- def name $ unCleanDefs x refs- else -- Remove 'def'- unCleanDefs x refs
− src/Symantic/Univariant/Trans.hs
@@ -1,122 +0,0 @@-{-# LANGUAGE ConstraintKinds #-} -- For type class synonyms-{-# LANGUAGE DefaultSignatures #-} -- For adding Trans* constraints-module Symantic.Univariant.Trans where---- TODO: move to symantic-univariant--import Data.Function ((.))-import Data.Kind (Type)---- * Type family 'Output'-type family Output (repr :: Type -> Type) :: Type -> Type---- * Class 'Trans'--- | A 'trans'lation from an interpreter @(from)@ to an interpreter @(to)@.-class Trans from to where- trans :: from a -> to a---- * Class 'BiTrans'--- | Convenient type class synonym.--- Note that this is not necessarily a bijective 'trans'lation,--- a 'trans' being not necessarily injective nor surjective.-type BiTrans from to = (Trans from to, Trans to from)---- ** Class 'Liftable'--- | Convenient type class synonym for using 'Output'-type Liftable repr = Trans (Output repr) repr-lift :: forall repr a.- Liftable repr =>- Output repr a -> repr a-lift = trans @(Output repr)-{-# INLINE lift #-}--unlift :: forall repr a.- Trans repr (Output repr) =>- repr a -> Output repr a-unlift = trans @repr-{-# INLINE unlift #-}---- ** Class 'Unliftable'--- | Convenient type class synonym for using 'Output'-type Unliftable repr = Trans repr (Output repr)---- * Class 'Trans1'-class Trans1 from to where- trans1 ::- (from a -> from b) ->- to a -> to b- default trans1 ::- BiTrans from to =>- (from a -> from b) ->- to a -> to b- trans1 f = trans . f . trans- {-# INLINE trans1 #-}---- ** Class 'Liftable1'--- | Convenient type class synonym for using 'Output'-type Liftable1 repr = Trans1 (Output repr) repr-lift1 :: forall repr a b.- Liftable1 repr =>- (Output repr a -> Output repr b) ->- repr a -> repr b-lift1 = trans1 @(Output repr)-{-# INLINE lift1 #-}---- * Class 'Trans2'-class Trans2 from to where- trans2 ::- (from a -> from b -> from c) ->- to a -> to b -> to c- default trans2 ::- BiTrans from to =>- (from a -> from b -> from c) ->- to a -> to b -> to c- trans2 f a b = trans (f (trans a) (trans b))- {-# INLINE trans2 #-}---- ** Class 'Liftable2'--- | Convenient type class synonym for using 'Output'-type Liftable2 repr = Trans2 (Output repr) repr-lift2 :: forall repr a b c.- Liftable2 repr =>- (Output repr a -> Output repr b -> Output repr c) ->- repr a -> repr b -> repr c-lift2 = trans2 @(Output repr)-{-# INLINE lift2 #-}---- * Class 'Trans3'-class Trans3 from to where- trans3 ::- (from a -> from b -> from c -> from d) ->- to a -> to b -> to c -> to d- default trans3 ::- BiTrans from to =>- (from a -> from b -> from c -> from d) ->- to a -> to b -> to c -> to d- trans3 f a b c = trans (f (trans a) (trans b) (trans c))- {-# INLINE trans3 #-}---- ** Class 'Liftable3'--- | Convenient type class synonym for using 'Output'-type Liftable3 repr = Trans3 (Output repr) repr-lift3 :: forall repr a b c d.- Liftable3 repr =>- (Output repr a -> Output repr b -> Output repr c -> Output repr d) ->- repr a -> repr b -> repr c -> repr d-lift3 = trans3 @(Output repr)-{-# INLINE lift3 #-}---- * Type 'Any'--- | A newtype to disambiguate the 'Trans' instance to any other interpreter when there is also one or more 'Trans's to other interpreters with a different interpretation than the generic one.-newtype Any repr a = Any { unAny :: repr a }-type instance Output (Any repr) = repr-instance Trans (Any repr) repr where- trans = unAny-instance Trans1 (Any repr) repr-instance Trans2 (Any repr) repr-instance Trans3 (Any repr) repr-instance Trans repr (Any repr) where- trans = Any-instance Trans1 repr (Any repr)-instance Trans2 repr (Any repr)-instance Trans3 repr (Any repr)
symantic-parser.cabal view
@@ -1,6 +1,6 @@-cabal-version: 2.4+cabal-version: 3.0 name: symantic-parser-version: 0.1.0.20210201+version: 0.2.0.20210703 synopsis: Parser combinators statically optimized and staged via typed meta-programming description: This is a work-in-progress experimental library to generate parsers,@@ -8,34 +8,32 @@ . This is an alternative but less powerful/reviewed implementation of [ParsleyHaskell](https://github.com/J-mie6/ParsleyHaskell).- See the paper by Jamie Willis, Nicolas Wu, and Matthew- Pickering, admirably well presented at ICFP-2020: [Staged- Selective Parser- Combinators](https://icfp20.sigplan.org/details/icfp-2020-papers/20/Staged-Selective-Parser-Combinators).-license: GPL-3.0-or-later-author: Julien Moutinho <julm+symantic-parser@sourcephile.fr>-maintainer: Julien Moutinho <julm+symantic-parser@sourcephile.fr>-bug-reports: Julien Moutinho <julm+symantic-parser@sourcephile.fr>-copyright: Julien Moutinho <julm+symantic-parser@sourcephile.fr>+ See the paper by Jamie Willis, Nicolas Wu, and Matthew Pickering,+ admirably well presented at ICFP-2020: [Staged Selective Parser Combinators](https://icfp20.sigplan.org/details/icfp-2020-papers/20/Staged-Selective-Parser-Combinators).+license: AGPL-3.0-or-later+author: Julien Moutinho <julm+symantic-parser@sourcephile.fr>+maintainer: Julien Moutinho <julm+symantic-parser@sourcephile.fr>+bug-reports: https://mails.sourcephile.fr/inbox/symantic-parser+copyright: Julien Moutinho <julm+symantic-parser@sourcephile.fr> stability: experimental category: Parsing extra-doc-files: ChangeLog.md+ Hacking.md ReadMe.md ToDo.md extra-source-files:- .envrc- Makefile cabal.project default.nix+ .envrc+ flake.lock flake.nix+ Makefile+ parsers/Parsers/Brainfuck/inputs/*.bf shell.nix- test/Golden/**/*.dump test/Golden/**/*.txt- test/Golden/Splice/**/*.hs extra-tmp-files: build-type: Simple--- build-type: Custom tested-with: GHC==9.0.1 source-repository head@@ -47,60 +45,37 @@ manual: True default: False -flag dump-splices- description: Dump code generated by Template Haskell+flag disable-ormolu-check+ description: Remove ormolu from build-tool-depends.+ Temporary hack while Nixpkgs' haskellPackages.ormolu remains broken. manual: True default: False common boilerplate default-language: Haskell2010 default-extensions:- BangPatterns,- DataKinds,- FlexibleContexts,- FlexibleInstances,- GADTs,- GeneralizedNewtypeDeriving,- LambdaCase,- MultiParamTypeClasses,- NamedFieldPuns,- NoImplicitPrelude,- RankNTypes,- RecordWildCards,- ScopedTypeVariables,- TypeApplications,- TypeFamilies,- TypeOperators+ NoImplicitPrelude ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates- -fhide-source-paths- -freverse-errors---- custom-setup--- setup-depends:--- base >= 4.14,--- Cabal >= 3.0,--- directory >= 1,--- filepath >= 1.3+ -Wpartial-fields+ -fprint-potential-instances library import: boilerplate hs-source-dirs: src exposed-modules:+ Language.Haskell.TH.HideName+ Language.Haskell.TH.Show Symantic.Parser Symantic.Parser.Grammar Symantic.Parser.Grammar.Combinators- Symantic.Parser.Grammar.Fixity Symantic.Parser.Grammar.ObserveSharing Symantic.Parser.Grammar.Optimize+ Symantic.Parser.Grammar.Production Symantic.Parser.Grammar.View Symantic.Parser.Grammar.Write- Symantic.Parser.Haskell- Symantic.Parser.Haskell.Optimize- Symantic.Parser.Haskell.Term- Symantic.Parser.Haskell.View Symantic.Parser.Machine Symantic.Parser.Machine.Generate Symantic.Parser.Machine.Input@@ -108,20 +83,89 @@ Symantic.Parser.Machine.Optimize Symantic.Parser.Machine.Program Symantic.Parser.Machine.View- Symantic.Univariant.Letable- Symantic.Univariant.Trans+ default-extensions:+ BangPatterns,+ DataKinds,+ FlexibleContexts,+ FlexibleInstances,+ GADTs,+ GeneralizedNewtypeDeriving,+ LambdaCase,+ MultiParamTypeClasses,+ NamedFieldPuns,+ RankNTypes,+ RecordWildCards,+ ScopedTypeVariables,+ TypeApplications,+ TypeFamilies,+ TypeOperators build-depends: base >=4.10 && <5, array, bytestring, containers,+ deepseq >= 1.4, ghc-prim, hashable,+ -- For Language.Haskell.Ppr.Lib.pprExp+ pretty >= 1.1,+ symantic-base >= 0.1, template-haskell >= 2.16, text, transformers, unordered-containers +library parsers+ -- visibility: public+ import: boilerplate+ hs-source-dirs: parsers+ exposed-modules:+ Parsers.Brainfuck.Attoparsec+ Parsers.Brainfuck.Handrolled+ Parsers.Brainfuck.SymanticParser+ Parsers.Brainfuck.SymanticParser.Grammar+ Parsers.Brainfuck.Types+ Parsers.Nandlang+ Parsers.Playground+ Parsers.Utils+ Parsers.Utils.Handrolled+ Parsers.Utils.Attoparsec+ Parsers.Utils.Attoparsec.Text+ default-extensions:+ BangPatterns,+ DefaultSignatures,+ FlexibleContexts,+ FlexibleInstances,+ GeneralizedNewtypeDeriving,+ LambdaCase,+ MultiParamTypeClasses,+ ScopedTypeVariables,+ TypeApplications,+ TypeFamilies,+ TypeOperators+ build-depends:+ symantic-parser,+ attoparsec >= 0.13,+ base >= 4.10 && < 5,+ bytestring >= 0.10,+ containers >= 0.5.10.1,+ deepseq >= 1.4,+ directory >= 1.3,+ filepath >= 1.4,+ ghc-prim,+ hashable >= 1.2.6,+ megaparsec >= 9.0,+ process >= 1.6,+ strict >= 0.4,+ symantic-base >= 0.1,+ tasty >= 0.11,+ tasty-golden >= 2.3,+ template-haskell >= 2.16,+ text >= 1.2,+ transformers >= 0.4,+ unix >= 2.7,+ unordered-containers+ test-suite symantic-parser-test import: boilerplate type: exitcode-stdio-1.0@@ -129,25 +173,25 @@ main-is: Main.hs other-modules: Golden- --Golden.Splice- --Golden.Utils- Parser- Parser.Brainfuck- Parser.Nandlang- Parser.Playground- --Paths_symantic_parser+ Golden.Grammar+ Golden.Machine+ Golden.Parser+ Golden.Splice+ Golden.Utils+ Grammar -- HUnit -- QuickCheck- -- autogen-modules:- -- Paths_symantic_parser- default-extensions:- ViewPatterns- ghc-options:+ Paths_symantic_parser+ autogen-modules:+ Paths_symantic_parser+ ghc-prof-options: -fexternal-interpreter build-depends: symantic-parser,+ symantic-parser:parsers, base >= 4.10 && < 5, bytestring >= 0.10,- containers >= 0.5,+ -- Needed for exported Data.Map.Internal+ containers >= 0.5.10.1, deepseq >= 1.4, directory >= 1.3, filepath >= 1.4,@@ -158,19 +202,47 @@ tasty-golden >= 2.3, -- tasty-hunit, template-haskell >= 2.16,+ -- th-lift-instances >= 0.1.17, -- temporary >= 1.3, text >= 1.2, -- time >= 1.9, transformers >= 0.4,- -- turtle >= 1.5, -- QuickCheck >= 2.0, -- tasty-quickcheck, unix >= 2.7, unordered-containers+ if !flag(disable-ormolu-check)+ build-tool-depends:+ ormolu:ormolu >= 1.5 if flag(dump-core) build-depends: dump-core ghc-options: -fplugin=DumpCore- if flag(dump-splices)- ghc-options:- -ddump-splices- -ddump-to-file++benchmark symantic-parser-benchmark+ import: boilerplate+ type: exitcode-stdio-1.0+ hs-source-dirs: benchmarks+ main-is: Main.hs+ default-language: Haskell2010+ other-modules:+ Brainfuck+ Paths_symantic_parser+ autogen-modules:+ Paths_symantic_parser+ default-extensions:+ ghc-options: -fno-enable-th-splice-warnings+ ghc-prof-options: -fexternal-interpreter+ build-depends:+ base >= 4.6 && < 5,+ symantic-parser,+ symantic-parser:parsers,+ attoparsec >= 0.13,+ bytestring >= 0.10,+ containers >= 0.5,+ criterion >= 1.5,+ deepseq >= 1.4,+ megaparsec >= 9.0,+ random >= 1.1,+ text >= 1.2,+ template-haskell >= 2.16,+ transformers >= 0.5
test/Golden.hs view
@@ -1,152 +1,16 @@-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE Rank2Types #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE UnboxedTuples #-}-{-# OPTIONS_GHC -Wno-unused-local-binds #-} -- For TH splices-{-# OPTIONS_GHC -Wno-unused-matches #-} -- For TH splices module Golden where -import Data.Bool (Bool(..))-import Control.Monad (Monad(..))-import Data.Char (Char)-import Data.Either (Either(..))-import Data.Function (($))-import Data.Semigroup (Semigroup(..))-import Data.String (String, IsString(..))-import Data.Text (Text)-import Data.Text.IO (readFile)-import System.IO (IO, FilePath) import Test.Tasty-import Test.Tasty.Golden-import Text.Show (Show(..))-import qualified Data.ByteString.Lazy as BSL-import qualified Data.IORef as IORef-import qualified Data.Text.Lazy as TL-import qualified Data.Text.Lazy.Encoding as TL-import qualified Language.Haskell.TH.Syntax as TH -import qualified Symantic.Parser as P-import qualified Symantic.Parser.Haskell as H-import qualified Parser---import qualified Golden.Splice--goldensIO :: IO TestTree-goldensIO = return $ testGroup "Golden"- [ goldensGrammar- , goldensMachine- , goldensParser- -- TODO: this will need cabal-install-3.4 to compile under GHC9.- --, Golden.Splice.goldens- ]--goldensGrammar :: TestTree-goldensGrammar = testGroup "Grammar"- [ testGroup "ViewGrammar" $ tests $ \name repr ->- let file = "test/Golden/Grammar/"<>name<>".dump" in- goldenVsStringDiff file diffGolden file $ do- resetTHNameCounter- return $ fromString $ show $- P.viewGrammar @'False $- P.observeSharing repr- , testGroup "OptimizeGrammar" $ tests $ \name repr ->- let file = "test/Golden/Grammar/"<>name<>".opt.dump" in- goldenVsStringDiff file diffGolden file $ do- resetTHNameCounter- return $ fromString $ P.showGrammar @'False repr- ]- where- tests :: P.Grammar Char repr =>- (forall a. String -> repr a -> TestTree) -> [TestTree]- tests test =- [ test "unit" $ P.unit- , test "unit-unit" $ P.unit P.*> P.unit- , test "app" $ P.pure H.id P.<*> P.unit- , test "string" $ P.string "abcd"- , test "tokens" $ P.tokens "abcd"- , test "many-a" $ P.many (P.char 'a')- , test "boom" $ Parser.boom- , test "brainfuck" $ Parser.brainfuck- , test "many-char-eof" $ P.many (P.char 'r') P.<* P.eof- , test "eof" $ P.eof- , test "nandlang" $ Parser.nandlang- ]--goldensMachine :: TestTree-goldensMachine = testGroup "Machine"- [ testGroup "DumpInstr" $ tests $ \name repr ->- let file = "test/Golden/Machine/"<>name<>".dump" in- goldenVsStringDiff file diffGolden file $ do- resetTHNameCounter- return $ fromString $ show $- P.viewMachine @'False repr- ]- where- tests ::- P.Machine Char repr =>- (forall vs es ret. String -> repr Text vs es ret -> TestTree) -> [TestTree]- tests test =- [ test "unit" $ P.machine $ P.unit- , test "unit-unit" $ P.machine $ P.unit P.*> P.unit- , test "string" $ P.machine $ P.string "abcd"- , test "a-or-b" $ P.machine $ P.char 'a' P.<|> P.char 'b'- , test "app" $ P.machine $ P.pure H.id P.<*> P.unit- , test "many-a" $ P.machine $ P.many (P.char 'a')- , test "some-string" $ P.machine $ P.some (P.string "abcd")- , test "boom" $ P.machine $ Parser.boom- , test "brainfuck" $ P.machine $ Parser.brainfuck- , test "many-char-eof" $ P.machine $ P.many (P.char 'r') P.<* P.eof- , test "eof" $ P.machine $ P.eof- , test "many-char-fail" $ P.machine $ P.many (P.char 'a') P.<* P.char 'b'- , test "nandlang" $ P.machine $ Parser.nandlang- ]+import qualified Golden.Grammar+import qualified Golden.Machine+import qualified Golden.Parser+import qualified Golden.Splice -goldensParser :: TestTree-goldensParser = testGroup "Parser"- [ testGroup "runParser" $ tests $ \name p ->- let file = "test/Golden/Parser/"<>name in- goldenVsStringDiff (file<>".txt") diffGolden (file<>".dump") $ do- input :: Text <- readFile (file<>".txt")- return $ fromString $- case p input of- Left err -> show err- Right a -> show a+goldens :: TestTree+goldens = testGroup "Golden"+ [ Golden.Grammar.goldens+ , Golden.Machine.goldens+ , Golden.Parser.goldens+ , Golden.Splice.goldens ]- where- tests :: (forall a. Show a => String -> (Text -> Either (P.ParsingError Text) a) -> TestTree) -> [TestTree]- tests test =- [ test "char" $$(P.runParser $ P.char 'a')- , test "string" $$(P.runParser $ P.string "abc")- , test "string-fail-horizon" $$(P.runParser $ P.string "abc")- , test "many-char" $$(P.runParser $ P.many (P.char 'a'))- , test "some-string" $$(P.runParser $ P.some (P.string "abcd"))- , test "some-string-fail" $$(P.runParser $ P.some (P.string "abcd"))- , test "some-string-eof-fail" $$(P.runParser $ P.some (P.string "abcd") P.<* P.eof)- , test "alt-right-notry" $$(P.runParser $ P.traverse P.char "aa" P.<|> P.traverse P.char "ab")- , test "alt-right-try" $$(P.runParser $ P.string "aa" P.<|> P.string "ab")- , test "alt-left" $$(P.runParser $ P.string "aa" P.<|> P.string "ab")- , test "many-char-eof" $$(P.runParser $ P.many (P.char 'r') P.<* P.eof)- , test "eof" $$(P.runParser $ P.eof)- , test "eof-fail" $$(P.runParser $ P.eof)- , test "alt-char-fail" $$(P.runParser $ P.char 'a' P.<|> P.char 'b')- , test "many-char-fail" $$(P.runParser $ P.many (P.char 'a') P.<* P.char 'b')- , test "many-oneOf" $$(P.runParser $ P.many (P.oneOf ['a', 'b', 'c', 'd']) P.<* P.eof)- ]---- | Resetting 'TH.counter' makes 'makeLetName' deterministic,--- except when GHC or executable flags change, like profiling--- or even --accept unfortunately,--- in those case the 'goldensMachine' tests may fail--- due to a different numbering of the 'def' and 'ref' combinators.--- Hence 'ShowLetName' is used with 'False'.-resetTHNameCounter :: IO ()-resetTHNameCounter = IORef.writeIORef TH.counter 0---- * Golden testing utilities--diffGolden :: FilePath -> FilePath -> [String]-diffGolden ref new = ["diff", "-u", ref, new]--unLeft :: Either String BSL.ByteString -> IO BSL.ByteString-unLeft = \case- Left err -> return $ TL.encodeUtf8 $ TL.pack err- Right a -> return a
+ test/Golden/Grammar.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE DataKinds #-} -- For using P.viewGrammar+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE TypeApplications #-}+module Golden.Grammar where++import Data.Bool (Bool(..))+import Control.Monad (Monad(..))+import Data.Function (($))+import Data.Semigroup (Semigroup(..))+import Data.String (IsString(..))+import Test.Tasty+import Test.Tasty.Golden+import Text.Show (Show(..))+import Data.Int (Int)+import qualified Data.List as List++import Golden.Utils+import qualified Symantic.Parser as P+import qualified Grammar++goldens :: TestTree+goldens = testGroup "Grammar" $+ [ testGroup "ViewGrammar" $+ (\f -> List.zipWith f Grammar.grammars [1::Int ..]) $ \gram g ->+ let grammarFile = getGoldenDir $ "Grammar/ViewGrammar/G"<>show g<>".expected.txt" in+ goldenVsStringDiff ("G"<>show g) goldenDiff grammarFile $ do+ resetTHNameCounter+ return $ fromString $ show $+ P.viewGrammar @'False gram+ , testGroup "OptimizeGrammar" $+ (\f -> List.zipWith f Grammar.grammars [1::Int ..]) $ \gram g ->+ let grammarFile = getGoldenDir $ "Grammar/OptimizeGrammar/G"<>show g<>".expected.txt" in+ goldenVsStringDiff ("G"<>show g) goldenDiff grammarFile $ do+ resetTHNameCounter+ return $ fromString $ show $+ P.viewGrammar @'False $+ P.optimizeGrammar gram+ ]
+ test/Golden/Grammar/OptimizeGrammar/G1.expected.txt view
@@ -0,0 +1,4 @@+lets+` <*>+ + pure (\x_0 -> GHC.Show.show 'a')+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G10.expected.txt view
@@ -0,0 +1,10 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + <*>+ | + pure (\x_0 -> 'a')+ | ` satisfy+ ` <*>+ + pure (\x_0 -> 'b')+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G11.expected.txt view
@@ -0,0 +1,14 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) 'a' (x_1 x_2))+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show (x_0 GHC.Types.[]))+ | ` ref <hidden>+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G12.expected.txt view
@@ -0,0 +1,14 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) x_0 (x_1 x_2))+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show (x_0 GHC.Types.[]))+ | ` ref <hidden>+ ` eof
+ test/Golden/Grammar/OptimizeGrammar/G13.expected.txt view
@@ -0,0 +1,63 @@+lets++ let <hidden>+| ` <*>+| + pure (\x_0 -> GHC.Tuple.())+| ` ref <hidden>++ let <hidden>+| ` <*>+| + pure (\x_0 -> x_0 GHC.Types.[])+| ` ref <hidden>++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> (GHC.Types.:) x_0 (x_2 x_3))+| | | | ` conditional+| | | | + look+| | | | | ` satisfy+| | | | + branches+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Backward)+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Forward)+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Increment)+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Decrement)+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Input)+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + pure (\x_0 -> Parsers.Brainfuck.Types.Output)+| | | | | | ` satisfy+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> Parsers.Brainfuck.Types.Loop x_2)+| | | | | | | | ` satisfy+| | | | | | | ` ref <hidden>+| | | | | | ` rec <hidden>+| | | | | ` satisfy+| | | | ` failure+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1 x_2)+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show x_1)+ | ` ref <hidden>+ ` ref <hidden>
+ test/Golden/Grammar/OptimizeGrammar/G14.expected.txt view
@@ -0,0 +1,410 @@+lets++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_1)+| | ` ref <hidden>+| ` <|>+| + <*>+| | + pure (\x_0 -> GHC.Tuple.())+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> x_3)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> x_4)+| | | | | | | ` satisfy+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> GHC.Tuple.())+| | | | | | ` satisfy+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> '(')+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> ')')+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> ',')+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> ';')+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> GHC.Tuple.())+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_1)+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_1)+| | ` try+| | ` <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> x_3)+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_1)+| | | ` <|>+| | | + <*>+| | | | + pure (\x_0 -> '0')+| | | | ` satisfy+| | | ` <*>+| | | + pure (\x_0 -> '1')+| | | ` satisfy+| | ` ref <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> x_1)+| | | | | ` satisfy+| | | | ` <|>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_1)+| | | | | | ` satisfy+| | | | | ` ref <hidden>+| | | | ` <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_2)+| | | | | | ` satisfy+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` satisfy+| | ` ref <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_1)+| | ` ref <hidden>+| ` <|>+| + <*>+| | + pure (\x_0 -> GHC.Tuple.())+| | ` <|>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1)+| | | | | ` ref <hidden>+| | | | ` <|>+| | | | + <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> GHC.Tuple.())+| | | | | | | | ` rec <hidden>+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> x_0 x_2 (x_3 x_4))+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` rec <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> \x_7 -> \x_8 -> \x_9 -> x_8 x_9)+| | | | | | | | | | ` try+| | | | | | | | | | ` <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + <*>+| | | | | | | | | | | | + <*>+| | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> \x_7 -> (GHC.Types.:) 'f' ((GHC.Types.:) 'u' ((GHC.Types.:) 'n' ((GHC.Types.:) 'c' ((GHC.Types.:) 't' ((GHC.Types.:) 'i' ((GHC.Types.:) 'o' ((GHC.Types.:) 'n' GHC.Types.[]))))))))+| | | | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | ` satisfy+| | | | | | | | | | | ` satisfy+| | | | | | | | | | ` satisfy+| | | | | | | | | ` ref <hidden>+| | | | | | | | ` ref <hidden>+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` <|>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> GHC.Tuple.())+| | | | | | | | ` satisfy+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> x_0 x_2 (x_3 x_4))+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> x_0 x_2 (x_3 x_4))+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> x_0 x_2 (x_3 x_4))+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> x_3 x_4)+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1 x_2)+| | | ` <|>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_1)+| | | | | ` try+| | | | | ` <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> (GHC.Types.:) 'i' ((GHC.Types.:) 'f' GHC.Types.[]))+| | | | | | ` satisfy+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` <|>+| | | + <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> x_3)+| | | | | | | ` try+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> (GHC.Types.:) 'w' ((GHC.Types.:) 'h' ((GHC.Types.:) 'i' ((GHC.Types.:) 'l' ((GHC.Types.:) 'e' GHC.Types.[])))))+| | | | | | | | | | | ` satisfy+| | | | | | | | | | ` satisfy+| | | | | | | | | ` satisfy+| | | | | | | | ` satisfy+| | | | | | | ` satisfy+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` rec <hidden>+| | | ` <|>+| | | + try+| | | | ` <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + <*>+| | | | | | | | | | | | + <*>+| | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> \x_7 -> \x_8 -> \x_9 -> \x_10 -> \x_11 -> x_10)+| | | | | | | | | | | | | | | ` <|>+| | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | | + pure (\x_0 -> \x_1 -> GHC.Tuple.())+| | | | | | | | | | | | | | | | | ` try+| | | | | | | | | | | | | | | | | ` <*>+| | | | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | | | + <*>+| | | | | | | | | | | | | | | | | | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) 'v' ((GHC.Types.:) 'a' ((GHC.Types.:) 'r' GHC.Types.[])))+| | | | | | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | | | | ` satisfy+| | | | | | | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | | ` ref <hidden>+| | | | | | | | | | ` satisfy+| | | | | | | | | ` ref <hidden>+| | | | | | | | ` ref <hidden>+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1 x_2)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1 x_2)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_1 x_2)+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> GHC.Tuple.())+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` pure (\x_0 -> \x_1 -> x_1)++ let <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` satisfy+` <*>+ + <*>+ | + <*>+ | | + <*>+ | | | + <*>+ | | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> GHC.Show.show x_3)+ | | | | ` ref <hidden>+ | | | ` ref <hidden>+ | | ` ref <hidden>+ | ` ref <hidden>+ ` eof
+ test/Golden/Grammar/OptimizeGrammar/G15.expected.txt view
@@ -0,0 +1,12 @@+lets+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show x_0)+ | ` <|>+ | + <*>+ | | + pure (\x_0 -> 'a')+ | | ` satisfy+ | ` <*>+ | + pure (\x_0 -> 'b')+ | ` satisfy+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G16.expected.txt view
@@ -0,0 +1,16 @@+lets+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show x_0)+ | ` <|>+ | + <*>+ | | + pure (\x_0 -> 'a')+ | | ` satisfy+ | ` <|>+ | + <*>+ | | + pure (\x_0 -> 'b')+ | | ` satisfy+ | ` <*>+ | + pure (\x_0 -> 'c')+ | ` satisfy+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G2.expected.txt view
@@ -0,0 +1,11 @@+lets+` <*>+ + pure GHC.Show.show+ ` try+ ` <*>+ + <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' GHC.Types.[])))+ | | ` satisfy+ | ` satisfy+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G3.expected.txt view
@@ -0,0 +1,12 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) 'a' (x_1 x_2))+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure (\x_0 -> GHC.Show.show (x_0 GHC.Types.[]))+ ` ref <hidden>
+ test/Golden/Grammar/OptimizeGrammar/G4.expected.txt view
@@ -0,0 +1,25 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) x_0 (x_1 x_2))+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` try+| ` <*>+| + <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types.[]))))+| | | | ` satisfy+| | | ` satisfy+| | ` satisfy+| ` satisfy+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show ((GHC.Types.:) x_0 (x_1 GHC.Types.[])))+ | ` ref <hidden>+ ` ref <hidden>
+ test/Golden/Grammar/OptimizeGrammar/G5.expected.txt view
@@ -0,0 +1,27 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) x_0 (x_1 x_2))+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` try+| ` <*>+| + <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> \x_3 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types.[]))))+| | | | ` satisfy+| | | ` satisfy+| | ` satisfy+| ` satisfy+` <*>+ + <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> \x_2 -> GHC.Show.show ((GHC.Types.:) x_0 (x_1 GHC.Types.[])))+ | | ` ref <hidden>+ | ` ref <hidden>+ ` eof
+ test/Golden/Grammar/OptimizeGrammar/G6.expected.txt view
@@ -0,0 +1,14 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types.[]))+ | | ` satisfy+ | ` satisfy+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types.[]))+ | ` satisfy+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G7.expected.txt view
@@ -0,0 +1,16 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + try+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types.[]))+ | | ` satisfy+ | ` satisfy+ ` try+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types.[]))+ | ` satisfy+ ` satisfy
+ test/Golden/Grammar/OptimizeGrammar/G8.expected.txt view
@@ -0,0 +1,14 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> (GHC.Types.:) 'r' (x_1 x_2))+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> GHC.Show.show (x_0 GHC.Types.[]))+ | ` ref <hidden>+ ` eof
+ test/Golden/Grammar/OptimizeGrammar/G9.expected.txt view
@@ -0,0 +1,4 @@+lets+` <*>+ + pure GHC.Show.show+ ` eof
+ test/Golden/Grammar/ViewGrammar/G1.expected.txt view
@@ -0,0 +1,8 @@+lets+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` pure 'a'+ ` satisfy
+ test/Golden/Grammar/ViewGrammar/G10.expected.txt view
@@ -0,0 +1,14 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'a'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` pure 'b'+ ` satisfy
+ test/Golden/Grammar/ViewGrammar/G11.expected.txt view
@@ -0,0 +1,28 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure 'a'+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <*>+ | + ref <hidden>+ | ` pure GHC.Types.[]+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` pure 'b'+ ` satisfy
+ test/Golden/Grammar/ViewGrammar/G12.expected.txt view
@@ -0,0 +1,20 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <*>+ | + ref <hidden>+ | ` pure GHC.Types.[]+ ` eof
+ test/Golden/Grammar/ViewGrammar/G13.expected.txt view
@@ -0,0 +1,107 @@+lets++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` <*>+| | + <*>+| | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | ` pure GHC.Tuple.()+| | ` ref <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` <*>+| + ref <hidden>+| ` pure GHC.Types.[]++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` conditional+| | | | + look+| | | | | ` satisfy+| | | | + branches+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Backward+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Forward+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Increment+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Decrement+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Input+| | | | | | ` satisfy+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure Parsers.Brainfuck.Types.Output+| | | | | | ` satisfy+| | | | | ` <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` satisfy+| | | | | | | ` ref <hidden>+| | | | | | ` <*>+| | | | | | + pure Parsers.Brainfuck.Types.Loop+| | | | | | ` rec <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure ']'+| | | | | ` satisfy+| | | | ` failure+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure (\x_0 -> x_0)+ | ` ref <hidden>+ ` ref <hidden>
+ test/Golden/Grammar/ViewGrammar/G14.expected.txt view
@@ -0,0 +1,844 @@+lets++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` ref <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` <*>+| | + <*>+| | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | ` pure GHC.Tuple.()+| | ` ref <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` ref <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` <*>+| | + <*>+| | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure '['+| | | | ` satisfy+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | ` pure GHC.Tuple.()+| | | ` ref <hidden>+| | ` pure GHC.Tuple.()+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure ']'+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure '{'+| | | | ` satisfy+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure '}'+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` ref <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure GHC.Tuple.()+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` try+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` satisfy+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure '('+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure ')'+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure ','+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + <*>+| | + pure (\x_0 -> \x_1 -> x_0)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure ';'+| | ` satisfy+| ` ref <hidden>++ let <hidden>+| ` <*>+| + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| ` pure (\x_0 -> \x_1 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure (\x_0 -> x_0)+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` try+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'f'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'u'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'n'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'c'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 't'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'i'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'o'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'n'+| | | | | | | | ` satisfy+| | | | | | | ` pure GHC.Types.[]+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` ref <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` ref <hidden>+| | | | | ` <|>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure GHC.Tuple.()+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure ':'+| | | | | | | | ` satisfy+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure '!'+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` <|>+| | | + <|>+| | | | + <|>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` try+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'i'+| | | | | | | | ` satisfy+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (GHC.Types.:)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure 'f'+| | | | | | | | ` satisfy+| | | | | | | ` pure GHC.Types.[]+| | | | | | ` ref <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | | ` try+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure 'w'+| | | | | | | | | ` satisfy+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure 'h'+| | | | | | | | | ` satisfy+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure 'i'+| | | | | | | | | ` satisfy+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure 'l'+| | | | | | | | | ` satisfy+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure 'e'+| | | | | | | | | ` satisfy+| | | | | | | | ` pure GHC.Types.[]+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` rec <hidden>+| | | | ` try+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | | ` <|>+| | | | | | | | + <*>+| | | | | | | | | + <*>+| | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | ` pure GHC.Tuple.()+| | | | | | | | | ` <*>+| | | | | | | | | + <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | | | | ` try+| | | | | | | | | | ` <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | | | ` <*>+| | | | | | | | | | | + <*>+| | | | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | ` pure 'v'+| | | | | | | | | | | ` satisfy+| | | | | | | | | | ` <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | | | ` <*>+| | | | | | | | | | | + <*>+| | | | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | ` pure 'a'+| | | | | | | | | | | ` satisfy+| | | | | | | | | | ` <*>+| | | | | | | | | | + <*>+| | | | | | | | | | | + pure (GHC.Types.:)+| | | | | | | | | | | ` <*>+| | | | | | | | | | | + <*>+| | | | | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | ` pure 'r'+| | | | | | | | | | | ` satisfy+| | | | | | | | | | ` pure GHC.Types.[]+| | | | | | | | | ` ref <hidden>+| | | | | | | | ` ref <hidden>+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | | ` ref <hidden>+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + <*>+| | | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | | ` pure (\x_0 -> x_0)+| | | | | | | | ` <*>+| | | | | | | | + <*>+| | | | | | | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | | | ` ref <hidden>+| | | | | | | | ` ref <hidden>+| | | | | | | ` ref <hidden>+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` <*>+| | | | | | | + <*>+| | | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | | ` pure '='+| | | | | | | ` satisfy+| | | | | | ` ref <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` ref <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | | ` pure (\x_0 -> \x_1 -> x_0)+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` ref <hidden>+| | | ` rec <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure GHC.Tuple.()+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure (\x_0 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` <|>+| + <|>+| | + <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` <|>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure '0'+| | | | | ` satisfy+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure '1'+| | | | ` satisfy+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure '\''+| | | | ` satisfy+| | | ` <|>+| | | + <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure (\x_0 -> x_0)+| | | | | ` satisfy+| | | | ` ref <hidden>+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure '\\'+| | | | ` satisfy+| | | ` <*>+| | | + <*>+| | | | + <*>+| | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | ` pure (\x_0 -> x_0)+| | | | ` satisfy+| | | ` ref <hidden>+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure '\''+| | | ` satisfy+| | ` ref <hidden>+| ` <*>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure (\x_0 -> x_0)+| | ` ref <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure GHC.Tuple.()+| | ` <|>+| | + <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` <*>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure (\x_0 -> x_0)+| | | | | ` ref <hidden>+| | | | ` <|>+| | | | + <*>+| | | | | + <*>+| | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | ` pure GHC.Tuple.()+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` rec <hidden>+| | | | | ` <*>+| | | | | + <*>+| | | | | | + <*>+| | | | | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | | | | ` pure (\x_0 -> x_0)+| | | | | | ` <*>+| | | | | | + <*>+| | | | | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | ` ref <hidden>+| | | | | | ` ref <hidden>+| | | | | ` ref <hidden>+| | | | ` ref <hidden>+| | | ` ref <hidden>+| | ` ref <hidden>+| ` ref <hidden>++ let <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` pure GHC.Tuple.()++ let <hidden>+| ` satisfy+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <*>+ | + <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure (\x_0 -> x_0)+ | | ` ref <hidden>+ | ` <*>+ | + <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure (\x_0 -> x_0)+ | | ` <*>+ | | + <*>+ | | | + pure ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+ | | | ` ref <hidden>+ | | ` ref <hidden>+ | ` ref <hidden>+ ` eof
+ test/Golden/Grammar/ViewGrammar/G15.expected.txt view
@@ -0,0 +1,22 @@+lets+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <|>+ | + <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'a'+ | | ` satisfy+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'b'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` pure 'c'+ ` satisfy
+ test/Golden/Grammar/ViewGrammar/G16.expected.txt view
@@ -0,0 +1,28 @@+lets+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <|>+ | + <|>+ | | + <*>+ | | | + <*>+ | | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | | ` pure 'a'+ | | | ` satisfy+ | | ` <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'b'+ | | ` satisfy+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'c'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` pure 'd'+ ` satisfy
+ test/Golden/Grammar/ViewGrammar/G2.expected.txt view
@@ -0,0 +1,29 @@+lets+` <*>+ + pure GHC.Show.show+ ` try+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'a'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'b'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'c'+ | ` satisfy+ ` pure GHC.Types.[]
+ test/Golden/Grammar/ViewGrammar/G3.expected.txt view
@@ -0,0 +1,20 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure 'a'+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure GHC.Show.show+ ` <*>+ + ref <hidden>+ ` pure GHC.Types.[]
+ test/Golden/Grammar/ViewGrammar/G4.expected.txt view
@@ -0,0 +1,55 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` try+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'a'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'b'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'c'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'd'+| | ` satisfy+| ` pure GHC.Types.[]+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` ref <hidden>+ ` <*>+ + ref <hidden>+ ` pure GHC.Types.[]
+ test/Golden/Grammar/ViewGrammar/G5.expected.txt view
@@ -0,0 +1,59 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` ref <hidden>+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)++ let <hidden>+| ` try+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'a'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'b'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'c'+| | ` satisfy+| ` <*>+| + <*>+| | + pure (GHC.Types.:)+| | ` <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> x_0)+| | | ` pure 'd'+| | ` satisfy+| ` pure GHC.Types.[]+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <*>+ | + <*>+ | | + pure (GHC.Types.:)+ | | ` ref <hidden>+ | ` <*>+ | + ref <hidden>+ | ` pure GHC.Types.[]+ ` eof
+ test/Golden/Grammar/ViewGrammar/G6.expected.txt view
@@ -0,0 +1,38 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + <*>+ | + <*>+ | | + pure (GHC.Types.:)+ | | ` <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'a'+ | | ` satisfy+ | ` <*>+ | + <*>+ | | + pure (GHC.Types.:)+ | | ` <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'a'+ | | ` satisfy+ | ` pure GHC.Types.[]+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'a'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'b'+ | ` satisfy+ ` pure GHC.Types.[]
+ test/Golden/Grammar/ViewGrammar/G7.expected.txt view
@@ -0,0 +1,40 @@+lets+` <*>+ + pure GHC.Show.show+ ` <|>+ + try+ | ` <*>+ | + <*>+ | | + pure (GHC.Types.:)+ | | ` <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'a'+ | | ` satisfy+ | ` <*>+ | + <*>+ | | + pure (GHC.Types.:)+ | | ` <*>+ | | + <*>+ | | | + pure (\x_0 -> \x_1 -> x_0)+ | | | ` pure 'a'+ | | ` satisfy+ | ` pure GHC.Types.[]+ ` try+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'a'+ | ` satisfy+ ` <*>+ + <*>+ | + pure (GHC.Types.:)+ | ` <*>+ | + <*>+ | | + pure (\x_0 -> \x_1 -> x_0)+ | | ` pure 'b'+ | ` satisfy+ ` pure GHC.Types.[]
+ test/Golden/Grammar/ViewGrammar/G8.expected.txt view
@@ -0,0 +1,24 @@+lets++ let <hidden>+| ` <|>+| + <*>+| | + <*>+| | | + pure (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | ` <*>+| | | + pure (GHC.Types.:)+| | | ` <*>+| | | + <*>+| | | | + pure (\x_0 -> \x_1 -> x_0)+| | | | ` pure 'r'+| | | ` satisfy+| | ` rec <hidden>+| ` pure (\x_0 -> x_0)+` <*>+ + pure GHC.Show.show+ ` <*>+ + <*>+ | + pure (\x_0 -> \x_1 -> x_0)+ | ` <*>+ | + ref <hidden>+ | ` pure GHC.Types.[]+ ` eof
+ test/Golden/Grammar/ViewGrammar/G9.expected.txt view
@@ -0,0 +1,4 @@+lets+` <*>+ + pure GHC.Show.show+ ` eof
− test/Golden/Grammar/app.dump
@@ -1,3 +0,0 @@-<*>-+ pure (\u1 -> u1)-` pure Term
− test/Golden/Grammar/app.opt.dump
@@ -1,1 +0,0 @@-pure Term
− test/Golden/Grammar/boom.dump
@@ -1,46 +0,0 @@-<*>-+ <*>-| + <*>-| | + pure (\u1 -> (\u2 -> u1))-| | ` pure (\u1 -> u1)-| ` <*>-| + <*>-| | + def <hidden>-| | | ` <*>-| | | + pure (\u1 -> (\u2 -> u1))-| | | ` pure (\u1 -> u1)-| | ` def <hidden>-| | ` <*>-| | + <*>-| | | + def <hidden>-| | | | ` <*>-| | | | + pure (\u1 -> (\u2 -> u1))-| | | | ` pure (\u1 -> u1)-| | | ` def <hidden>-| | | ` <*>-| | | + <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | ` pure (\u1 -> u1)-| | | | ` rec <hidden>-| | | ` rec <hidden>-| | ` rec <hidden>-| ` def <hidden>-| ` pure Term-` <*>- + <*>- | + ref <hidden>- | ` def <hidden>- | ` <*>- | + <*>- | | + ref <hidden>- | | ` def <hidden>- | | ` <*>- | | + <*>- | | | + <*>- | | | | + pure (\u1 -> (\u2 -> u1))- | | | | ` pure (\u1 -> u1)- | | | ` rec <hidden>- | | ` rec <hidden>- | ` rec <hidden>- ` ref <hidden>
− test/Golden/Grammar/boom.opt.dump
@@ -1,36 +0,0 @@-<*>-+ <*>-| + <*>-| | + <*>-| | | + <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (u4 u5) u6))))))-| | | | | ` def <hidden>-| | | | | ` pure (\u1 -> (\u2 -> u2))-| | | | ` def <hidden>-| | | | ` <*>-| | | | + <*>-| | | | | + def <hidden>-| | | | | | ` pure (\u1 -> (\u2 -> u2))-| | | | | ` def <hidden>-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | ` rec <hidden>-| | | | | ` rec <hidden>-| | | | ` rec <hidden>-| | | ` def <hidden>-| | | ` pure Term-| | ` ref <hidden>-| ` def <hidden>-| ` <*>-| + <*>-| | + ref <hidden>-| | ` def <hidden>-| | ` <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> u2))-| | | ` rec <hidden>-| | ` rec <hidden>-| ` rec <hidden>-` ref <hidden>
− test/Golden/Grammar/brainfuck.dump
@@ -1,101 +0,0 @@-<*>-+ <*>-| + <*>-| | + pure (\u1 -> (\u2 -> u1))-| | ` pure (\u1 -> u1)-| ` def <hidden>-| ` <*>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> u1))-| | | ` pure (\u1 -> u1)-| | ` <*>-| | + <*>-| | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | ` pure Term-| | ` def <hidden>-| | ` <|>-| | + <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | ` <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | ` def <hidden>-| | | | ` satisfy-| | | ` rec <hidden>-| | ` pure (\u1 -> u1)-| ` pure Term-` def <hidden>- ` <*>- + def <hidden>- | ` <|>- | + <*>- | | + <*>- | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))- | | | ` <*>- | | | + pure cons- | | | ` <*>- | | | + <*>- | | | | + pure (\u1 -> (\u2 -> u1))- | | | | ` conditional- | | | | + look- | | | | | ` ref <hidden>- | | | | + bs- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | ` pure Term- | | | | | | ` ref <hidden>- | | | | | ` <*>- | | | | | + <*>- | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | ` <*>- | | | | | | + <*>- | | | | | | | + <*>- | | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | | ` pure (\u1 -> u1)- | | | | | | | ` <*>- | | | | | | | + <*>- | | | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | | | ` ref <hidden>- | | | | | | | ` ref <hidden>- | | | | | | ` <*>- | | | | | | + pure Term- | | | | | | ` rec <hidden>- | | | | | ` <*>- | | | | | + <*>- | | | | | | + pure (\u1 -> (\u2 -> u1))- | | | | | | ` pure ']'- | | | | | ` ref <hidden>- | | | | ` empty- | | | ` ref <hidden>- | | ` rec <hidden>- | ` pure (\u1 -> u1)- ` pure Term
− test/Golden/Grammar/brainfuck.opt.dump
@@ -1,58 +0,0 @@-<*>-+ <*>-| + pure (\u1 -> (\u2 -> u2))-| ` def <hidden>-| ` <*>-| + pure (\u1 -> Term)-| ` def <hidden>-| ` <|>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | ` satisfy-| | ` rec <hidden>-| ` pure (\u1 -> u1)-` def <hidden>- ` <*>- + pure (\u1 -> u1 Term)- ` def <hidden>- ` <|>- + <*>- | + <*>- | | + <*>- | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))- | | | ` conditional- | | | + look- | | | | ` satisfy- | | | + bs- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | + <*>- | | | | | + pure (\u1 -> (\u2 -> cons Term))- | | | | | ` satisfy- | | | | ` <*>- | | | | + <*>- | | | | | + <*>- | | | | | | + <*>- | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> cons (Term u3))))))- | | | | | | | ` satisfy- | | | | | | ` ref <hidden>- | | | | | ` rec <hidden>- | | | | ` satisfy- | | | ` empty- | | ` ref <hidden>- | ` rec <hidden>- ` pure (\u1 -> u1)
− test/Golden/Grammar/eof.dump
@@ -1,1 +0,0 @@-eof
− test/Golden/Grammar/eof.opt.dump
@@ -1,1 +0,0 @@-eof
− test/Golden/Grammar/many-a.dump
@@ -1,16 +0,0 @@-<*>-+ def <hidden>-| ` <|>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | ` <*>-| | | + pure cons-| | | ` <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> u1))-| | | | ` pure 'a'-| | | ` satisfy-| | ` rec <hidden>-| ` pure (\u1 -> u1)-` pure Term
− test/Golden/Grammar/many-a.opt.dump
@@ -1,10 +0,0 @@-<*>-+ pure (\u1 -> u1 Term)-` def <hidden>- ` <|>- + <*>- | + <*>- | | + pure (\u1 -> (\u2 -> (\u3 -> 'a' : u2 u3)))- | | ` satisfy- | ` rec <hidden>- ` pure (\u1 -> u1)
− test/Golden/Grammar/many-char-eof.dump
@@ -1,20 +0,0 @@-<*>-+ <*>-| + pure (\u1 -> (\u2 -> u1))-| ` <*>-| + def <hidden>-| | ` <|>-| | + <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | ` <*>-| | | | + pure cons-| | | | ` <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | ` pure 'r'-| | | | ` satisfy-| | | ` rec <hidden>-| | ` pure (\u1 -> u1)-| ` pure Term-` eof
− test/Golden/Grammar/many-char-eof.opt.dump
@@ -1,12 +0,0 @@-<*>-+ <*>-| + pure (\u1 -> (\u2 -> u1 Term))-| ` def <hidden>-| ` <|>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> (\u3 -> 'r' : u2 u3)))-| | | ` satisfy-| | ` rec <hidden>-| ` pure (\u1 -> u1)-` eof
− test/Golden/Grammar/nandlang.dump
@@ -1,993 +0,0 @@-<*>-+ <*>-| + pure (\u1 -> (\u2 -> u1))-| ` <*>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> u1))-| | | ` pure (\u1 -> u1)-| | ` def <hidden>-| | ` <*>-| | + <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> u1))-| | | | ` pure (\u1 -> u1)-| | | ` <*>-| | | + <*>-| | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | ` def <hidden>-| | | | ` pure Term-| | | ` def <hidden>-| | | ` <|>-| | | + <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | ` <|>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` def <hidden>-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` def <hidden>-| | | | | | | | ` satisfy-| | | | | | | ` ref <hidden>-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | ` pure Term-| | | | | | | ` def <hidden>-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` rec <hidden>-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` pure Term-| | | | | ` <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` try-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure cons-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure '/'-| | | | | | | | ` ref <hidden>-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure cons-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure '/'-| | | | | | | | ` ref <hidden>-| | | | | | | ` pure Term-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | ` ref <hidden>-| | | | | | | ` def <hidden>-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` rec <hidden>-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` ref <hidden>-| | | | | ` ref <hidden>-| | | | ` rec <hidden>-| | | ` pure (\u1 -> u1)-| | ` ref <hidden>-| ` <*>-| + <*>-| | + <*>-| | | + pure (\u1 -> (\u2 -> u1))-| | | ` pure (\u1 -> u1)-| | ` <*>-| | + <*>-| | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | ` ref <hidden>-| | ` def <hidden>-| | ` <|>-| | + <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | ` <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | ` <*>-| | | | + <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | ` pure (\u1 -> u1)-| | | | | ` <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` try-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | ` try-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'f'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'u'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'n'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'c'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 't'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'i'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'o'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure cons-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure 'n'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` pure Term-| | | | | | | | ` def <hidden>-| | | | | | | | ` negLook-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` def <hidden>-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` try-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` ref <hidden>-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` def <hidden>-| | | | | | | | ` <|>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` rec <hidden>-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` ref <hidden>-| | | | | | ` ref <hidden>-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` def <hidden>-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure '('-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` def <hidden>-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure Term-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure Term-| | | | | | | | | | ` def <hidden>-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure '['-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | | | | ` pure Term-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <|>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` pure Term-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` pure ']'-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + def <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure ','-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` rec <hidden>-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` <|>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure Term-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` pure ':'-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` ref <hidden>-| | | | | ` def <hidden>-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` pure ')'-| | | | | | ` ref <hidden>-| | | | | ` ref <hidden>-| | | | ` def <hidden>-| | | | ` <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | ` <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` pure '{'-| | | | | | | ` ref <hidden>-| | | | | | ` ref <hidden>-| | | | | ` <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` <*>-| | | | | | + <*>-| | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | ` ref <hidden>-| | | | | | ` def <hidden>-| | | | | | ` <|>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | ` <|>-| | | | | | | | + <|>-| | | | | | | | | + <|>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure 'i'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure 'f'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | + <|>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | ` pure '0'-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure '1'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure '\''-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure '\\'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure '\''-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure Term-| | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | ` pure Term-| | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | | | | + ref <hidden>-| | | | | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))-| | | | | | | | | | | | | | | | | ` pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | | ` pure '!'-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | ` <|>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure Term-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure 'e'-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure 'l'-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure 's'-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure 'e'-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` try-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure 'w'-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure 'h'-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure 'i'-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure 'l'-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure 'e'-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` rec <hidden>-| | | | | | | | | ` try-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure Term-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure 'v'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure 'a'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure cons-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | | ` pure 'r'-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | ` pure '='-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | ` <|>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + ref <hidden>-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | | ` pure ';'-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` ref <hidden>-| | | | | | | ` rec <hidden>-| | | | | | ` pure (\u1 -> u1)-| | | | | ` ref <hidden>-| | | | ` <*>-| | | | + <*>-| | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | ` pure '}'-| | | | | ` ref <hidden>-| | | | ` ref <hidden>-| | | ` rec <hidden>-| | ` pure (\u1 -> u1)-| ` ref <hidden>-` eof
− test/Golden/Grammar/nandlang.opt.dump
@@ -1,479 +0,0 @@-<*>-+ <*>-| + <*>-| | + <*>-| | | + <*>-| | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4)))))-| | | | ` def <hidden>-| | | | ` <*>-| | | | + <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u3)))-| | | | | | ` def <hidden>-| | | | | | ` pure Term-| | | | | ` def <hidden>-| | | | | ` <|>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> Term))-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | ` satisfy-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` def <hidden>-| | | | | | | | ` <|>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` rec <hidden>-| | | | | | | | ` pure (\u1 -> u1)-| | | | | | | ` <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u5)))))-| | | | | | | | | | | ` try-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> '/' : ('/' : Term)))-| | | | | | | | | | | | ` satisfy-| | | | | | | | | | | ` satisfy-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | | | ` satisfy-| | | | | | | | | | ` rec <hidden>-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` rec <hidden>-| | | | | ` pure (\u1 -> u1)-| | | | ` ref <hidden>-| | | ` ref <hidden>-| | ` def <hidden>-| | ` <|>-| | + <*>-| | | + <*>-| | | | + <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> u9 u10))))))))))-| | | | | | | | | | | ` try-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | ` try-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> 'f' : ('u' : ('n' : ('c' : ('t' : ('i' : ('o' : ('n' : u9))))))))))))))))-| | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` pure Term-| | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | ` negLook-| | | | | | | | | | | ` satisfy-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | ` try-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | ` <|>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` def <hidden>-| | | | | | | | ` <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> '('))-| | | | | | | | | ` satisfy-| | | | | | | | ` ref <hidden>-| | | | | | | ` def <hidden>-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))-| | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | ` <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` <|>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + pure (\u1 -> Term)-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term))))))-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` def <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | ` pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> ','))-| | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` rec <hidden>-| | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` <|>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> Term)))-| | | | | | | | | ` satisfy-| | | | | | | | ` ref <hidden>-| | | | | | | ` ref <hidden>-| | | | | | ` ref <hidden>-| | | | | ` def <hidden>-| | | | | ` <*>-| | | | | + <*>-| | | | | | + pure (\u1 -> (\u2 -> ')'))-| | | | | | ` satisfy-| | | | | ` ref <hidden>-| | | | ` def <hidden>-| | | | ` <*>-| | | | + <*>-| | | | | + <*>-| | | | | | + <*>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> u5)))))))-| | | | | | | | | | ` satisfy-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` ref <hidden>-| | | | | | | ` def <hidden>-| | | | | | | ` <|>-| | | | | | | + <*>-| | | | | | | | + <*>-| | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u5)))))-| | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> 'i' : ('f' : u3))))-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> '0')-| | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> '1')-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u2))))-| | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u3)))-| | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> Term)-| | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> u2)))-| | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))-| | | | | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4 u5)))))-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | ` <|>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> Term)))-| | | | | | | | | | | | | ` try-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> 'e' : ('l' : ('s' : ('e' : u5))))))))-| | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | | | | | | | | ` try-| | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> 'w' : ('h' : ('i' : ('l' : ('e' : u6))))))))))-| | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` rec <hidden>-| | | | | | | | | ` <|>-| | | | | | | | | + try-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + <*>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> (\u11 -> (\u12 -> u11))))))))))))-| | | | | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> Term))-| | | | | | | | | | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | | | | | | | | | | ` try-| | | | | | | | | | | | | | | | | | | | | | | | ` <*>-| | | | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'v' : ('a' : ('r' : u4))))))-| | | | | | | | | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | | | | | | | ` <|>-| | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | | ` satisfy-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | ` def <hidden>-| | | | | | | | | | | | ` <|>-| | | | | | | | | | | | + <*>-| | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | + <*>-| | | | | | | | | | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | | | | ` rec <hidden>-| | | | | | | | | | | | ` pure (\u1 -> u1)-| | | | | | | | | | | ` ref <hidden>-| | | | | | | | | | ` def <hidden>-| | | | | | | | | | ` <*>-| | | | | | | | | | + <*>-| | | | | | | | | | | + pure (\u1 -> (\u2 -> ';'))-| | | | | | | | | | | ` satisfy-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` <*>-| | | | | | | | | + <*>-| | | | | | | | | | + pure (\u1 -> (\u2 -> u1))-| | | | | | | | | | ` ref <hidden>-| | | | | | | | | ` ref <hidden>-| | | | | | | | ` rec <hidden>-| | | | | | | ` pure (\u1 -> u1)-| | | | | | ` ref <hidden>-| | | | | ` satisfy-| | | | ` ref <hidden>-| | | ` rec <hidden>-| | ` pure (\u1 -> u1)-| ` ref <hidden>-` eof
− test/Golden/Grammar/string.dump
@@ -1,35 +0,0 @@-try-` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'a'- | ` def <hidden>- | ` satisfy- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'b'- | ` ref <hidden>- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'c'- | ` ref <hidden>- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'd'- | ` ref <hidden>- ` pure Term
− test/Golden/Grammar/string.opt.dump
@@ -1,10 +0,0 @@-try-` <*>- + <*>- | + <*>- | | + <*>- | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'a' : ('b' : ('c' : ('d' : Term)))))))- | | | ` satisfy- | | ` satisfy- | ` satisfy- ` satisfy
− test/Golden/Grammar/tokens.dump
@@ -1,35 +0,0 @@-try-` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'a'- | ` def <hidden>- | ` satisfy- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'b'- | ` ref <hidden>- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'c'- | ` ref <hidden>- ` <*>- + <*>- | + pure cons- | ` <*>- | + <*>- | | + pure (\u1 -> (\u2 -> u1))- | | ` pure 'd'- | ` ref <hidden>- ` pure Term
− test/Golden/Grammar/tokens.opt.dump
@@ -1,10 +0,0 @@-try-` <*>- + <*>- | + <*>- | | + <*>- | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'a' : ('b' : ('c' : ('d' : Term)))))))- | | | ` satisfy- | | ` satisfy- | ` satisfy- ` satisfy
− test/Golden/Grammar/unit-unit.dump
@@ -1,8 +0,0 @@-<*>-+ <*>-| + <*>-| | + pure (\u1 -> (\u2 -> u1))-| | ` pure (\u1 -> u1)-| ` def <hidden>-| ` pure Term-` ref <hidden>
− test/Golden/Grammar/unit-unit.opt.dump
@@ -1,6 +0,0 @@-<*>-+ <*>-| + pure (\u1 -> (\u2 -> u2))-| ` def <hidden>-| ` pure Term-` ref <hidden>
− test/Golden/Grammar/unit.dump
@@ -1,1 +0,0 @@-pure Term
− test/Golden/Grammar/unit.opt.dump
@@ -1,1 +0,0 @@-pure Term
+ test/Golden/Machine.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE DataKinds #-} -- For using P.viewMachine+{-# LANGUAGE FlexibleContexts #-} -- For machines+{-# LANGUAGE GADTs #-} -- For machines+{-# LANGUAGE TypeApplications #-} -- For P.viewMachine+module Golden.Machine where++import Data.Bool (Bool(..))+import Data.Char (Char)+import Control.Monad (Monad(..))+import Data.Int (Int)+import Data.Function (($))+import Data.Functor ((<$>))+import Data.Semigroup (Semigroup(..))+import Data.String (String, IsString(..))+import Data.Text (Text)+import System.IO (IO)+import Test.Tasty+import Test.Tasty.Golden+import Text.Show (Show(..))+import qualified Data.List as List++import Golden.Utils+import Grammar+import qualified Symantic.Parser as P++goldens :: TestTree+goldens = testGroup "Machine" $+ (\f -> List.zipWith f (machines @Text) [1::Int ..]) $ \mach g ->+ let machineFile = getGoldenDir $ "Machine/G"<>show g<>".expected.txt" in+ goldenVsStringDiff ("G"<>show g) goldenDiff machineFile $ do+ resetTHNameCounter+ m <- mach+ return $ fromString $ show $+ P.viewMachine @'False m++machines ::+ P.InputToken inp ~ Char =>+ P.Cursorable (P.Cursor inp) =>+ P.Machinable (P.InputToken inp) repr =>+ [IO (repr inp '[] String)]+machines = P.optimizeMachine <$> grammars
+ test/Golden/Machine/G1.expected.txt view
@@ -0,0 +1,24 @@+pushValue GHC.Show.show+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue 'a'+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+read ((GHC.Classes.==) 'a')+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+ret+ minReads=(Right 0)+ mayRaise=[]
+ test/Golden/Machine/G10.expected.txt view
@@ -0,0 +1,72 @@+pushValue GHC.Show.show+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| <ok>+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue 'a'+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'a')+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | commit ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | refJoin <hidden>+| | minReads=(Right 0)+| | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'b'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'b')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G11.expected.txt view
@@ -0,0 +1,111 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'a'+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'a')+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue 'b'+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+read ((GHC.Classes.==) 'b')+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+ret+ minReads=(Right 0)+ mayRaise=[]
+ test/Golden/Machine/G12.expected.txt view
@@ -0,0 +1,146 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read (\t_0 -> ('a' GHC.Classes.== t_0) GHC.Classes.|| (('b' GHC.Classes.== t_0) GHC.Classes.|| (('c' GHC.Classes.== t_0) GHC.Classes.|| (('d' GHC.Classes.== t_0) GHC.Classes.|| GHC.Types.False))))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | | <ok>+| | | | pushInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | popValue+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | commit ExceptionFailure+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <ko>+| | | | loadInput+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Tuple.()+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | fail [FailureEnd]+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G13.expected.txt view
@@ -0,0 +1,416 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue GHC.Types.[]+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | join <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | call <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | call <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | ret+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | pushInput+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | swapValue+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | loadInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [(GHC.Classes.==) '<',(GHC.Classes.==) '>',(GHC.Classes.==) '+',(GHC.Classes.==) '-',(GHC.Classes.==) ',',(GHC.Classes.==) '.',(GHC.Classes.==) '[']+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Backward+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Forward+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Increment+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Decrement+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Input+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Output+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue Parsers.Brainfuck.Types.Loop+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue ']'+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) ']')+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail [FailureEmpty]+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read (\c_0 -> GHC.Classes.not (('<' GHC.Classes.== c_0) GHC.Classes.|| (('>' GHC.Classes.== c_0) GHC.Classes.|| (('+' GHC.Classes.== c_0) GHC.Classes.|| (('-' GHC.Classes.== c_0) GHC.Classes.|| ((',' GHC.Classes.== c_0) GHC.Classes.|| (('.' GHC.Classes.== c_0) GHC.Classes.|| (('[' GHC.Classes.== c_0) GHC.Classes.|| ((']' GHC.Classes.== c_0) GHC.Classes.|| GHC.Types.False)))))))))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+pushValue GHC.Show.show+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+ret+ minReads=(Right 0)+ mayRaise=[]
+ test/Golden/Machine/G14.expected.txt view
@@ -0,0 +1,3383 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read Parsers.Nandlang.nandIdentLetter+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | catch ExceptionFailure+| | | minReads=(Right 18)+| | | mayRaise=[ExceptionFailure]+| | | | <ok>+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 18)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 18)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'f'+| | | | | minReads=(Right 18)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 18)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'f')+| | | | | minReads=(Right 18)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'u'+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'u')+| | | | | minReads=(Right 17)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'n'+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'n')+| | | | | minReads=(Right 16)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'c'+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'c')+| | | | | minReads=(Right 15)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 't'+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 't')+| | | | | minReads=(Right 14)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'i'+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'i')+| | | | | minReads=(Right 13)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'o'+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'o')+| | | | | minReads=(Right 12)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (GHC.Types.:)+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue 'n'+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | read ((GHC.Classes.==) 'n')+| | | | | minReads=(Right 11)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue GHC.Types.[]+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | commit ExceptionFailure+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 10)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 8)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | join <hidden>+| | | | | minReads=(Right 6)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 6)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 6)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 6)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | call <hidden>+| | | | | | minReads=(Right 6)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 4)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 4)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 4)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | call <hidden>+| | | | | | minReads=(Right 4)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | call <hidden>+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | commit ExceptionFailure+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | ret+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | catch ExceptionFailure+| | | | | minReads=(Right 0)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <ok>+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue GHC.Tuple.()+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue ':'+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | read ((GHC.Classes.==) ':')+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | call <hidden>+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | call <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | commit ExceptionFailure+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | refJoin <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | <ko>+| | | | | | | pushInput+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | j_1+| | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <branch>+| | | | | | | | | call <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | refJoin <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | <default>+| | | | | | | | | fail []+| | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | <ko>+| | | | | loadInput+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | join <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | call <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | ret+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | catch ExceptionFailure+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | | <ok>+| | | | | join <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | commit ExceptionFailure+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | refJoin <hidden>+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | catch ExceptionFailure+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <ok>+| | | | | | | join <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | commit ExceptionFailure+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | | refJoin <hidden>+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | catch ExceptionFailure+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <ok>+| | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | catch ExceptionFailure+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <ok>+| | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue 'i'+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | read ((GHC.Classes.==) 'i')+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue 'f'+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | read ((GHC.Classes.==) 'f')+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | pushValue GHC.Types.[]+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | <ko>+| | | | | | | | | | | loadInput+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | fail []+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <ko>+| | | | | | | | | pushInput+| | | | | | | | | minReads=(Right 11)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | | | j_1+| | | | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | | | minReads=(Right 11)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | | | minReads=(Right 11)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <branch>+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | catch ExceptionFailure+| | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | <ok>+| | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue 'w'+| | | | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | read ((GHC.Classes.==) 'w')+| | | | | | | | | | | | | minReads=(Right 11)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue 'h'+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | read ((GHC.Classes.==) 'h')+| | | | | | | | | | | | | minReads=(Right 10)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue 'i'+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | read ((GHC.Classes.==) 'i')+| | | | | | | | | | | | | minReads=(Right 9)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue 'l'+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | read ((GHC.Classes.==) 'l')+| | | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue 'e'+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | read ((GHC.Classes.==) 'e')+| | | | | | | | | | | | | minReads=(Right 7)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue GHC.Types.[]+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | <ko>+| | | | | | | | | | | | | loadInput+| | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | fail []+| | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <default>+| | | | | | | | | | | fail []+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | <ko>+| | | | | | | pushInput+| | | | | | | minReads=(Right 8)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | j_1+| | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | minReads=(Right 8)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | minReads=(Right 8)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <branch>+| | | | | | | | | catch ExceptionFailure+| | | | | | | | | minReads=(Right 8)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <ok>+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | join <hidden>+| | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 8)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 6)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue '='+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | read ((GHC.Classes.==) '=')+| | | | | | | | | | | | minReads=(Right 4)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | catch ExceptionFailure+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | <ok>+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue GHC.Tuple.()+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | catch ExceptionFailure+| | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | <ok>+| | | | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue 'v'+| | | | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | read ((GHC.Classes.==) 'v')+| | | | | | | | | | | | | | | minReads=(Right 3)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue 'a'+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | read ((GHC.Classes.==) 'a')+| | | | | | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue (GHC.Types.:)+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | pushValue 'r'+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | read ((GHC.Classes.==) 'r')+| | | | | | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | pushValue GHC.Types.[]+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | <ko>+| | | | | | | | | | | | | | | loadInput+| | | | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | | fail []+| | | | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | <ko>+| | | | | | | | | | | | | pushInput+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | | | | | | | j_1+| | | | | | | | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | | | <branch>+| | | | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | | <default>+| | | | | | | | | | | | | | | fail []+| | | | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <ko>+| | | | | | | | | | | loadInput+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | fail []+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <default>+| | | | | | | | | fail []+| | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | <ko>+| | | | | pushInput+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | j_1+| | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | choicesBranch [\x_0 -> x_0]+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <branch>+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | call <hidden>+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | call <hidden>+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | refJoin <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | <default>+| | | | | | | fail []+| | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | mayRaise=[ExceptionFailure]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue '!'+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) '!')+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue GHC.Tuple.()+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | jump <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 0)+ mayRaise=[]+| pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1)+| minReads=(Right 0)+| mayRaise=[]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 0)+ mayRaise=[]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 0)+ mayRaise=[]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| pushValue GHC.Tuple.()+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| read GHC.Unicode.isSpace+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| read (\t_0 -> ('0' GHC.Classes.== t_0) GHC.Classes.|| (('1' GHC.Classes.== t_0) GHC.Classes.|| (('2' GHC.Classes.== t_0) GHC.Classes.|| (('3' GHC.Classes.== t_0) GHC.Classes.|| (('4' GHC.Classes.== t_0) GHC.Classes.|| (('5' GHC.Classes.== t_0) GHC.Classes.|| (('6' GHC.Classes.== t_0) GHC.Classes.|| (('7' GHC.Classes.== t_0) GHC.Classes.|| (('8' GHC.Classes.== t_0) GHC.Classes.|| (('9' GHC.Classes.== t_0) GHC.Classes.|| GHC.Types.False))))))))))+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | join <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | ret+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | catch ExceptionFailure+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | | <ok>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | join <hidden>+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | call <hidden>+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | commit ExceptionFailure+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | refJoin <hidden>+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | catch ExceptionFailure+| | | | | minReads=(Right 1)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <ok>+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue '0'+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | read ((GHC.Classes.==) '0')+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | commit ExceptionFailure+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | refJoin <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | <ko>+| | | | | | | pushInput+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | j_1+| | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <branch>+| | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | pushValue '1'+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | read ((GHC.Classes.==) '1')+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | refJoin <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | <default>+| | | | | | | | | fail []+| | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | <ko>+| | | | | pushInput+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | j_1+| | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | choicesBranch [\x_0 -> x_0]+| | | | | minReads=(Right 4)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <branch>+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue '\''+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | read ((GHC.Classes.==) '\'')+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 3)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 3)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | join <hidden>+| | | | | | | minReads=(Right 2)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | pushValue '\''+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | read ((GHC.Classes.==) '\'')+| | | | | | | | minReads=(Right 2)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 1)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 1)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | call <hidden>+| | | | | | | | minReads=(Right 1)+| | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | | refJoin <hidden>+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | catch ExceptionFailure+| | | | | | | minReads=(Right 1)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <ok>+| | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | read Parsers.Nandlang.nandStringLetter+| | | | | | | | | minReads=(Right 1)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | call <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | commit ExceptionFailure+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | refJoin <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | <ko>+| | | | | | | | | pushInput+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | | | j_1+| | | | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <branch>+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue '\\'+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | read ((GHC.Classes.==) '\\')+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | read (\t_0 -> ('0' GHC.Classes.== t_0) GHC.Classes.|| (('t' GHC.Classes.== t_0) GHC.Classes.|| (('n' GHC.Classes.== t_0) GHC.Classes.|| (('v' GHC.Classes.== t_0) GHC.Classes.|| (('f' GHC.Classes.== t_0) GHC.Classes.|| (('r' GHC.Classes.== t_0) GHC.Classes.|| GHC.Types.False))))))+| | | | | | | | | | | minReads=(Right 1)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | <default>+| | | | | | | | | | | fail []+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | <default>+| | | | | | | fail []+| | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | mayRaise=[ExceptionFailure]+| | <ko>+| | | pushInput+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | call <hidden>+| | | | | minReads=(Right 2)+| | | | | mayRaise=[ExceptionFailure]+| | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[ExceptionFailure]+| | | | | join <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | ret+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | catch ExceptionFailure+| | | | | minReads=(Right 0)+| | | | | mayRaise=[ExceptionFailure]+| | | | | | <ok>+| | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | pushValue GHC.Tuple.()+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | join <hidden>+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[]+| | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | | commit ExceptionFailure+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | | refJoin <hidden>+| | | | | | | | minReads=(Right 0)+| | | | | | | | mayRaise=[]+| | | | | | | catch ExceptionFailure+| | | | | | | minReads=(Right 4)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <ok>+| | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | minReads=(Right 4)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | minReads=(Right 4)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | minReads=(Right 4)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 4)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | call <hidden>+| | | | | | | | | minReads=(Right 4)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | join <hidden>+| | | | | | | | | minReads=(Right 2)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | call <hidden>+| | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | mayRaise=[]+| | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | mayRaise=[]+| | | | | | | | | | refJoin <hidden>+| | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | mayRaise=[]+| | | | | | | | | catch ExceptionFailure+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <ok>+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue GHC.Tuple.()+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 2)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue (\x_0 -> x_0)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | commit ExceptionFailure+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | <ko>+| | | | | | | | | | | pushInput+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | | | | | j_1+| | | | | | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | | <branch>+| | | | | | | | | | | | | call <hidden>+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | | | mayRaise=[]+| | | | | | | | | | | | <default>+| | | | | | | | | | | | | fail []+| | | | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <ko>+| | | | | | | | | pushInput+| | | | | | | | | minReads=(Right 5)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | | | j_1+| | | | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | | | minReads=(Right 5)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | | | minReads=(Right 5)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | <branch>+| | | | | | | | | | | call <hidden>+| | | | | | | | | | | minReads=(Right 5)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | | | | refJoin <hidden>+| | | | | | | | | | | minReads=(Right 0)+| | | | | | | | | | | mayRaise=[]+| | | | | | | | | | <default>+| | | | | | | | | | | fail []+| | | | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | | | mayRaise=[ExceptionFailure]+| | | | | | <ko>+| | | | | | | pushInput+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | | | | j_1+| | | | | | | _) -> i_0 GHC.Classes.== j_1)+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | choicesBranch [\x_0 -> x_0]+| | | | | | | minReads=(Right 0)+| | | | | | | mayRaise=[ExceptionFailure]+| | | | | | | | <branch>+| | | | | | | | | call <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | | refJoin <hidden>+| | | | | | | | | minReads=(Right 0)+| | | | | | | | | mayRaise=[]+| | | | | | | | <default>+| | | | | | | | | fail []+| | | | | | | | | minReads=(Left ExceptionFailure)+| | | | | | | | | mayRaise=[ExceptionFailure]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue '('+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) '(')+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue ')'+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) ')')+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue ','+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) ',')+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue ';'+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) ';')+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| join <hidden>+| minReads=(Right 0)+| mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | ret+| | minReads=(Right 0)+| | mayRaise=[]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 5)+| | | mayRaise=[ExceptionFailure]+| | | pushValue GHC.Tuple.()+| | | minReads=(Right 5)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 5)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 5)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | refJoin <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | call <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | refJoin <hidden>+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | read Parsers.Nandlang.nandIdentStart+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | commit ExceptionFailure+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | loadInput+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+| | | fail []+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| pushValue '{'+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) '{')+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 3)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 3)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 3)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue '}'+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) '}')+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+let <hidden>+ minReads=(Right 5)+ mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| pushValue '['+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) '[')+| minReads=(Right 5)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 2)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue GHC.Tuple.()+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| call <hidden>+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue GHC.Tuple.()+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue ']'+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) ']')+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| call <hidden>+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+pushValue GHC.Show.show+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> x_0)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue ((\x_0 -> \x_1 -> \x_2 -> x_0 x_2 x_1) (\x_3 -> \x_4 -> x_3 x_4))+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+call <hidden>+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | | <ok>+| | | | pushInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | popValue+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | commit ExceptionFailure+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <ko>+| | | | loadInput+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Tuple.()+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | fail [FailureEnd]+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G15.expected.txt view
@@ -0,0 +1,96 @@+pushValue GHC.Show.show+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue 'c'+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) 'c')+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| <ok>+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue 'a'+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'a')+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | commit ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | refJoin <hidden>+| | minReads=(Right 0)+| | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'b'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'b')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G16.expected.txt view
@@ -0,0 +1,144 @@+pushValue GHC.Show.show+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue (\x_0 -> \x_1 -> x_0)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| pushValue 'd'+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| read ((GHC.Classes.==) 'd')+| minReads=(Right 1)+| mayRaise=[ExceptionFailure]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 1)+ mayRaise=[ExceptionFailure]+| <ok>+| | join <hidden>+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | refJoin <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[]+| | catch ExceptionFailure+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | | <ok>+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'a'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'a')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <ko>+| | | | pushInput+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | | j_1+| | | | _) -> i_0 GHC.Classes.== j_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | choicesBranch [\x_0 -> x_0]+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | | <branch>+| | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue 'b'+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | read ((GHC.Classes.==) 'b')+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | refJoin <hidden>+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | <default>+| | | | | | fail []+| | | | | | minReads=(Left ExceptionFailure)+| | | | | | mayRaise=[ExceptionFailure]+| <ko>+| | pushInput+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'c'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'c')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G2.expected.txt view
@@ -0,0 +1,98 @@+pushValue GHC.Show.show+ minReads=(Right 3)+ mayRaise=[ExceptionFailure]+catch ExceptionFailure+ minReads=(Right 3)+ mayRaise=[ExceptionFailure]+| <ok>+| | pushValue (GHC.Types.:)+| | minReads=(Right 3)+| | mayRaise=[ExceptionFailure]+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 3)+| | mayRaise=[ExceptionFailure]+| | pushValue 'a'+| | minReads=(Right 3)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 3)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'a')+| | minReads=(Right 3)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | pushValue (GHC.Types.:)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | pushValue 'b'+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'b')+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue (GHC.Types.:)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue 'c'+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'c')+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | pushValue GHC.Types.[]+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | commit ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | ret+| | minReads=(Right 0)+| | mayRaise=[]+| <ko>+| | loadInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | fail []+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G3.expected.txt view
@@ -0,0 +1,87 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'a'+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'a')+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+ret+ minReads=(Right 0)+ mayRaise=[]
+ test/Golden/Machine/G4.expected.txt view
@@ -0,0 +1,206 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'a'+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'a')+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'b'+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'b')+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'c'+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'c')+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'd'+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'd')+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | pushValue GHC.Types.[]+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | loadInput+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+| | | fail []+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+pushValue (GHC.Types.:)+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[]+ret+ minReads=(Right 0)+ mayRaise=[]
+ test/Golden/Machine/G5.expected.txt view
@@ -0,0 +1,277 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+let <hidden>+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 4)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'a'+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'a')+| | | minReads=(Right 4)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'b'+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'b')+| | | minReads=(Right 3)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'c'+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'c')+| | | minReads=(Right 2)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'd'+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'd')+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | pushValue GHC.Types.[]+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | loadInput+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+| | | fail []+| | | minReads=(Left ExceptionFailure)+| | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+pushValue (GHC.Types.:)+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 4)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | | <ok>+| | | | pushInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | popValue+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | commit ExceptionFailure+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <ko>+| | | | loadInput+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Tuple.()+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | fail [FailureEnd]+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G6.expected.txt view
@@ -0,0 +1,144 @@+pushValue GHC.Show.show+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| <ok>+| | pushValue (GHC.Types.:)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | pushValue 'a'+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'a')+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue (GHC.Types.:)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue (\x_0 -> \x_1 -> x_0)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | pushValue 'a'+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | read ((GHC.Classes.==) 'a')+| | minReads=(Right 1)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | pushValue GHC.Types.[]+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | minReads=(Right 0)+| | mayRaise=[]+| | commit ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | refJoin <hidden>+| | minReads=(Right 0)+| | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | pushValue (GHC.Types.:)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'a'+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'a')+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (GHC.Types.:)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'b'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'b')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Types.[]+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G7.expected.txt view
@@ -0,0 +1,172 @@+pushValue GHC.Show.show+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 2)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | | <ok>+| | | | pushValue (GHC.Types.:)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'a'+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'a')+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (GHC.Types.:)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | pushValue 'a'+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((GHC.Classes.==) 'a')+| | | | minReads=(Right 1)+| | | | mayRaise=[ExceptionFailure]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Types.[]+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | <ko>+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| <ko>+| | pushInput+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Right 2)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | catch ExceptionFailure+| | | | minReads=(Right 2)+| | | | mayRaise=[ExceptionFailure]+| | | | | <ok>+| | | | | | pushValue (GHC.Types.:)+| | | | | | minReads=(Right 2)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | minReads=(Right 2)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue 'a'+| | | | | | minReads=(Right 2)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 2)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | read ((GHC.Classes.==) 'a')+| | | | | | minReads=(Right 2)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue (GHC.Types.:)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue (\x_0 -> \x_1 -> x_0)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | pushValue 'b'+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | read ((GHC.Classes.==) 'b')+| | | | | | minReads=(Right 1)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | pushValue GHC.Types.[]+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | commit ExceptionFailure+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | | refJoin <hidden>+| | | | | | minReads=(Right 0)+| | | | | | mayRaise=[]+| | | | | <ko>+| | | | | | loadInput+| | | | | | minReads=(Left ExceptionFailure)+| | | | | | mayRaise=[ExceptionFailure]+| | | | | | fail []+| | | | | | minReads=(Left ExceptionFailure)+| | | | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G8.expected.txt view
@@ -0,0 +1,158 @@+let <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| catch ExceptionFailure+| minReads=(Right 0)+| mayRaise=[ExceptionFailure]+| | <ok>+| | | pushValue (\x_0 -> \x_1 -> \x_2 -> x_0 (x_1 x_2))+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (GHC.Types.:)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue (\x_0 -> \x_1 -> x_0)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | pushValue 'r'+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | read ((GHC.Classes.==) 'r')+| | | minReads=(Right 1)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | call <hidden>+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | commit ExceptionFailure+| | | minReads=(Right 0)+| | | mayRaise=[]+| | | ret+| | | minReads=(Right 0)+| | | mayRaise=[]+| | <ko>+| | | pushInput+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | | j_1+| | | _) -> i_0 GHC.Classes.== j_1)+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | choicesBranch [\x_0 -> x_0]+| | | minReads=(Right 0)+| | | mayRaise=[ExceptionFailure]+| | | | <branch>+| | | | | pushValue (\x_0 -> x_0)+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | | ret+| | | | | minReads=(Right 0)+| | | | | mayRaise=[]+| | | | <default>+| | | | | fail []+| | | | | minReads=(Left ExceptionFailure)+| | | | | mayRaise=[ExceptionFailure]+pushValue GHC.Show.show+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue (\x_0 -> \x_1 -> x_0)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+call <hidden>+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+pushValue GHC.Types.[]+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+lift2Value (\x_0 -> \x_1 -> x_0 x_1)+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | | <ok>+| | | | pushInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | popValue+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | commit ExceptionFailure+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <ko>+| | | | loadInput+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Tuple.()+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | fail [FailureEnd]+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
+ test/Golden/Machine/G9.expected.txt view
@@ -0,0 +1,71 @@+pushValue GHC.Show.show+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+join <hidden>+ minReads=(Right 0)+ mayRaise=[]+| lift2Value (\x_0 -> \x_1 -> x_0 x_1)+| minReads=(Right 0)+| mayRaise=[]+| ret+| minReads=(Right 0)+| mayRaise=[]+catch ExceptionFailure+ minReads=(Right 0)+ mayRaise=[ExceptionFailure]+| <ok>+| | catch ExceptionFailure+| | minReads=(Right 0)+| | mayRaise=[]+| | | <ok>+| | | | pushInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | read ((\x_0 -> \x_1 -> x_0) GHC.Types.True)+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | popValue+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | commit ExceptionFailure+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | loadInput+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <ko>+| | | | loadInput+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | pushValue GHC.Tuple.()+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | commit ExceptionFailure+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| | | | refJoin <hidden>+| | | | minReads=(Right 0)+| | | | mayRaise=[]+| <ko>+| | pushInput+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | lift2Value (\(Data.Text.Internal.Text _ i_0 _) (Data.Text.Internal.Text _+| | j_1+| | _) -> i_0 GHC.Classes.== j_1)+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | choicesBranch [\x_0 -> x_0]+| | minReads=(Left ExceptionFailure)+| | mayRaise=[ExceptionFailure]+| | | <branch>+| | | | fail [FailureEnd]+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]+| | | <default>+| | | | fail []+| | | | minReads=(Left ExceptionFailure)+| | | | mayRaise=[ExceptionFailure]
− test/Golden/Machine/a-or-b.dump
@@ -1,18 +0,0 @@-catchFail- <try>- | push (\u1 -> 'a')- | read ('a' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | popFail- | ret- <handler>- pushInput- lift Term- choices [(\u1 -> u1)]- <branch>- | push (\u1 -> 'b')- | read ('b' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | ret- <default>- fail
− test/Golden/Machine/app.dump
@@ -1,2 +0,0 @@-push Term-ret
− test/Golden/Machine/boom.dump
@@ -1,51 +0,0 @@-push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (u4 u5) u6))))))-<hidden>:-| push (\u1 -> (\u2 -> u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| <hidden>:-| | push (\u1 -> (\u2 -> u2))-| | ret-| call <hidden>-| <hidden>:-| | push (\u1 -> (\u2 -> u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | ret-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| push Term-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| call <hidden>-| <hidden>:-| | push (\u1 -> (\u2 -> u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | ret-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/brainfuck.dump
@@ -1,104 +0,0 @@-push (\u1 -> (\u2 -> u2))-<hidden>:-| push (\u1 -> Term)-| <hidden>:-| | catchFail-| | <try>-| | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | read Term-| | | lift (\u1 -> (\u2 -> u1 u2))-| | | call <hidden>-| | | lift (\u1 -> (\u2 -> u1 u2))-| | | popFail-| | | ret-| | <handler>-| | pushInput-| | lift Term-| | choices [(\u1 -> u1)]-| | <branch>-| | | push (\u1 -> u1)-| | | ret-| | <default>-| | fail-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| push (\u1 -> u1 Term)-| <hidden>:-| | catchFail-| | <try>-| | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))-| | | <hidden>:-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | popFail-| | | | ret-| | | pushInput-| | | read ((\u1 -> (\u2 -> u1)) Term)-| | | swap-| | | loadInput-| | | choices [(Term ==),(Term ==),(Term ==),(Term ==),(Term ==),(Term ==),(Term ==)]-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> cons Term))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <branch>-| | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> cons (Term u3))))))-| | | | read ((\u1 -> (\u2 -> u1)) Term)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read (']' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | refJoin <hidden>-| | | <default>-| | | fail-| | <handler>-| | pushInput-| | lift Term-| | choices [(\u1 -> u1)]-| | <branch>-| | | push (\u1 -> u1)-| | | ret-| | <default>-| | fail-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/eof.dump
@@ -1,23 +0,0 @@-catchFail- <try>- | catchFail- | <try>- | | pushInput- | | read (\u1 -> Term)- | | pop- | | popFail- | | loadInput- | | fail- | <handler>- | loadInput- | push Term- | popFail- | ret- <handler>- pushInput- lift Term- choices [(\u1 -> u1)]- <branch>- | fail- <default>- fail
− test/Golden/Machine/many-a.dump
@@ -1,23 +0,0 @@-push (\u1 -> u1 Term)-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> 'a' : u2 u3)))-| | read ('a' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | popFail-| | ret-| <handler>-| pushInput-| lift Term-| choices [(\u1 -> u1)]-| <branch>-| | push (\u1 -> u1)-| | ret-| <default>-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/many-char-eof.dump
@@ -1,48 +0,0 @@-push (\u1 -> (\u2 -> u1 Term))-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> 'r' : u2 u3)))-| | read ('r' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | popFail-| | ret-| <handler>-| pushInput-| lift Term-| choices [(\u1 -> u1)]-| <branch>-| | push (\u1 -> u1)-| | ret-| <default>-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| lift (\u1 -> (\u2 -> u1 u2))-| ret-catchFail- <try>- | catchFail- | <try>- | | pushInput- | | read (\u1 -> Term)- | | pop- | | popFail- | | loadInput- | | fail- | <handler>- | loadInput- | push Term- | popFail- | refJoin <hidden>- <handler>- pushInput- lift Term- choices [(\u1 -> u1)]- <branch>- | fail- <default>- fail
− test/Golden/Machine/many-char-fail.dump
@@ -1,25 +0,0 @@-push (\u1 -> (\u2 -> u1 Term))-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> 'a' : u2 u3)))-| | read ('a' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | popFail-| | ret-| <handler>-| pushInput-| lift Term-| choices [(\u1 -> u1)]-| <branch>-| | push (\u1 -> u1)-| | ret-| <default>-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-read ('b' ==)-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/nandlang.dump
@@ -1,938 +0,0 @@-push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4)))))-<hidden>:-| push (\u1 -> (\u2 -> (\u3 -> u3)))-| <hidden>:-| | push Term-| | ret-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| <hidden>:-| | catchFail-| | <try>-| | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | <hidden>:-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | popFail-| | | | ret-| | | catchFail-| | | <try>-| | | | push (\u1 -> (\u2 -> Term))-| | | | <hidden>:-| | | | | push (\u1 -> (\u2 -> u2))-| | | | | read Term-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | ret-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | catchFail-| | | | | <try>-| | | | | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | popFail-| | | | | | ret-| | | | | <handler>-| | | | | pushInput-| | | | | lift Term-| | | | | choices [(\u1 -> u1)]-| | | | | <branch>-| | | | | | push (\u1 -> u1)-| | | | | | ret-| | | | | <default>-| | | | | fail-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | popFail-| | | | refJoin <hidden>-| | | <handler>-| | | pushInput-| | | lift Term-| | | choices [(\u1 -> u1)]-| | | <branch>-| | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u5)))))-| | | | catchFail-| | | | <try>-| | | | | push (\u1 -> (\u2 -> '/' : ('/' : Term)))-| | | | | read ('/' ==)-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | read ('/' ==)-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | popFail-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | <hidden>:-| | | | | | catchFail-| | | | | | <try>-| | | | | | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | read Term-| | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | call <hidden>-| | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | popFail-| | | | | | | ret-| | | | | | <handler>-| | | | | | pushInput-| | | | | | lift Term-| | | | | | choices [(\u1 -> u1)]-| | | | | | <branch>-| | | | | | | push (\u1 -> u1)-| | | | | | | ret-| | | | | | <default>-| | | | | | fail-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | refJoin <hidden>-| | | | <handler>-| | | | loadInput-| | | | fail-| | | <default>-| | | fail-| | <handler>-| | pushInput-| | lift Term-| | choices [(\u1 -> u1)]-| | <branch>-| | | push (\u1 -> u1)-| | | ret-| | <default>-| | fail-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| call <hidden>-| lift (\u1 -> (\u2 -> u1 u2))-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> u9 u10))))))))))-| | catchFail-| | <try>-| | | push (\u1 -> (\u2 -> u2))-| | | catchFail-| | | <try>-| | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> 'f' : ('u' : ('n' : ('c' : ('t' : ('i' : ('o' : ('n' : u9))))))))))))))))-| | | | read ('f' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('u' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('n' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('c' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('t' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('i' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('o' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | read ('n' ==)-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | push Term-| | | | | ret-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | popFail-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | catchFail-| | | | | <try>-| | | | | | pushInput-| | | | | | read Term-| | | | | | pop-| | | | | | popFail-| | | | | | loadInput-| | | | | | fail-| | | | | <handler>-| | | | | loadInput-| | | | | push Term-| | | | | ret-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | popFail-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | push (\u1 -> (\u2 -> u2))-| | | | | catchFail-| | | | | <try>-| | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | read Term-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | <hidden>:-| | | | | | | catchFail-| | | | | | | <try>-| | | | | | | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | read Term-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | popFail-| | | | | | | | ret-| | | | | | | <handler>-| | | | | | | pushInput-| | | | | | | lift Term-| | | | | | | choices [(\u1 -> u1)]-| | | | | | | <branch>-| | | | | | | | push (\u1 -> u1)-| | | | | | | | ret-| | | | | | | <default>-| | | | | | | fail-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | popFail-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | ret-| | | | | <handler>-| | | | | loadInput-| | | | | fail-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | push (\u1 -> (\u2 -> '('))-| | | | | read ('(' ==)-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | ret-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | catchFail-| | | | | <try>-| | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))-| | | | | | <hidden>:-| | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | call <hidden>-| | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | <hidden>:-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | ret-| | | | | | | catchFail-| | | | | | | <try>-| | | | | | | | push (\u1 -> Term)-| | | | | | | | <hidden>:-| | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term))))))-| | | | | | | | | read ('[' ==)-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | <hidden>:-| | | | | | | | | | read Term-| | | | | | | | | | ret-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | <hidden>:-| | | | | | | | | | catchFail-| | | | | | | | | | <try>-| | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | popFail-| | | | | | | | | | | ret-| | | | | | | | | | <handler>-| | | | | | | | | | pushInput-| | | | | | | | | | lift Term-| | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | <branch>-| | | | | | | | | | | push (\u1 -> u1)-| | | | | | | | | | | ret-| | | | | | | | | | <default>-| | | | | | | | | | fail-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | read (']' ==)-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | ret-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | popFail-| | | | | | | | refJoin <hidden>-| | | | | | | <handler>-| | | | | | | pushInput-| | | | | | | lift Term-| | | | | | | choices [(\u1 -> u1)]-| | | | | | | <branch>-| | | | | | | | call <hidden>-| | | | | | | | refJoin <hidden>-| | | | | | | <default>-| | | | | | | fail-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | <hidden>:-| | | | | | | catchFail-| | | | | | | <try>-| | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | <hidden>:-| | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | ret-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | <hidden>:-| | | | | | | | | push (\u1 -> (\u2 -> ','))-| | | | | | | | | read (',' ==)-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | ret-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | call <hidden>-| | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | popFail-| | | | | | | | ret-| | | | | | | <handler>-| | | | | | | pushInput-| | | | | | | lift Term-| | | | | | | choices [(\u1 -> u1)]-| | | | | | | <branch>-| | | | | | | | push (\u1 -> u1)-| | | | | | | | ret-| | | | | | | <default>-| | | | | | | fail-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | popFail-| | | | | | ret-| | | | | <handler>-| | | | | pushInput-| | | | | lift Term-| | | | | choices [(\u1 -> u1)]-| | | | | <branch>-| | | | | | jump <hidden>-| | | | | <default>-| | | | | fail-| | | | call <hidden>-| | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | <hidden>:-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | <hidden>:-| | | | | | push (\u1 -> (\u2 -> ')'))-| | | | | | read (')' ==)-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | ret-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | <hidden>:-| | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> u5)))))))-| | | | | | read ('{' ==)-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | <hidden>:-| | | | | | | catchFail-| | | | | | | <try>-| | | | | | | | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))-| | | | | | | | <hidden>:-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | call <hidden>-| | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | popFail-| | | | | | | | | ret-| | | | | | | | catchFail-| | | | | | | | <try>-| | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u5)))))-| | | | | | | | | catchFail-| | | | | | | | | <try>-| | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | catchFail-| | | | | | | | | | <try>-| | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> 'i' : ('f' : u3))))-| | | | | | | | | | | read ('i' ==)-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | read ('f' ==)-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | popFail-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | popFail-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | <hidden>:-| | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | push (\u1 -> '0')-| | | | | | | | | | | | | | | read ('0' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | push (\u1 -> '1')-| | | | | | | | | | | | | | | read ('1' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | fail-| | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u2))))-| | | | | | | | | | | | | | | read ('\'' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | read ('\'' ==)-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | | read Term-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> u3)))-| | | | | | | | | | | | | | | | read ('\\' ==)-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | read Term-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | | fail-| | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | | push (\u1 -> Term)-| | | | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> u2)))-| | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | | | | | | push (\u1 -> u1)-| | | | | | | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | | | | | | fail-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | | | | fail-| | | | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | | | fail-| | | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | | fail-| | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | fail-| | | | | | | | | | | | | <default>-| | | | | | | | | | | | | fail-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4 u5)))))-| | | | | | | | | | | | | | read ('!' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | ret-| | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | push (\u1 -> u1)-| | | | | | | | | | | | | | ret-| | | | | | | | | | | | | <default>-| | | | | | | | | | | | | fail-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | ret-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | <hidden>:-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | popFail-| | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | catchFail-| | | | | | | | | | | <try>-| | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> Term)))-| | | | | | | | | | | | catchFail-| | | | | | | | | | | | <try>-| | | | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> 'e' : ('l' : ('s' : ('e' : u5))))))))-| | | | | | | | | | | | | | read ('e' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | read ('l' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | read ('s' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | read ('e' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | loadInput-| | | | | | | | | | | | | fail-| | | | | | | | | | | | <handler>-| | | | | | | | | | | | loadInput-| | | | | | | | | | | | fail-| | | | | | | | | | | <handler>-| | | | | | | | | | | pushInput-| | | | | | | | | | | lift Term-| | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | <branch>-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | <default>-| | | | | | | | | | | fail-| | | | | | | | | | <handler>-| | | | | | | | | | loadInput-| | | | | | | | | | fail-| | | | | | | | | <handler>-| | | | | | | | | loadInput-| | | | | | | | | fail-| | | | | | | | <handler>-| | | | | | | | pushInput-| | | | | | | | lift Term-| | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | <branch>-| | | | | | | | | catchFail-| | | | | | | | | <try>-| | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))-| | | | | | | | | | catchFail-| | | | | | | | | | <try>-| | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | catchFail-| | | | | | | | | | | <try>-| | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> 'w' : ('h' : ('i' : ('l' : ('e' : u6))))))))))-| | | | | | | | | | | | read ('w' ==)-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | read ('h' ==)-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | read ('i' ==)-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | read ('l' ==)-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | read ('e' ==)-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | popFail-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | popFail-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | popFail-| | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | <handler>-| | | | | | | | | | | loadInput-| | | | | | | | | | | fail-| | | | | | | | | | <handler>-| | | | | | | | | | loadInput-| | | | | | | | | | fail-| | | | | | | | | <handler>-| | | | | | | | | pushInput-| | | | | | | | | lift Term-| | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | <branch>-| | | | | | | | | | catchFail-| | | | | | | | | | <try>-| | | | | | | | | | | catchFail-| | | | | | | | | | | <try>-| | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> (\u11 -> (\u12 -> u11))))))))))))-| | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | push (\u1 -> u1)-| | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | fail-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | read ('=' ==)-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | pushInput-| | | | | | | | | | | | | | lift Term-| | | | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | | | <branch>-| | | | | | | | | | | | | | | push (\u1 -> u1)-| | | | | | | | | | | | | | | ret-| | | | | | | | | | | | | | <default>-| | | | | | | | | | | | | | fail-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | <hidden>:-| | | | | | | | | | | | | | push (\u1 -> (\u2 -> ';'))-| | | | | | | | | | | | | | read (';' ==)-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | ret-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | popFail-| | | | | | | | | | | | | popFail-| | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | catchFail-| | | | | | | | | | | | <try>-| | | | | | | | | | | | | push (\u1 -> (\u2 -> Term))-| | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | push (\u1 -> (\u2 -> u2))-| | | | | | | | | | | | | | catchFail-| | | | | | | | | | | | | | <try>-| | | | | | | | | | | | | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'v' : ('a' : ('r' : u4))))))-| | | | | | | | | | | | | | | read ('v' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | read ('a' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | read ('r' ==)-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | | | | | popFail-| | | | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | | loadInput-| | | | | | | | | | | | | | fail-| | | | | | | | | | | | | <handler>-| | | | | | | | | | | | | loadInput-| | | | | | | | | | | | | fail-| | | | | | | | | | | | <handler>-| | | | | | | | | | | | pushInput-| | | | | | | | | | | | lift Term-| | | | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | | | <branch>-| | | | | | | | | | | | | call <hidden>-| | | | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | | | <default>-| | | | | | | | | | | | fail-| | | | | | | | | | | <handler>-| | | | | | | | | | | loadInput-| | | | | | | | | | | fail-| | | | | | | | | | <handler>-| | | | | | | | | | pushInput-| | | | | | | | | | lift Term-| | | | | | | | | | choices [(\u1 -> u1)]-| | | | | | | | | | <branch>-| | | | | | | | | | | push (\u1 -> (\u2 -> u1))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | call <hidden>-| | | | | | | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | | | | | | refJoin <hidden>-| | | | | | | | | | <default>-| | | | | | | | | | fail-| | | | | | | | | <default>-| | | | | | | | | fail-| | | | | | | | <default>-| | | | | | | | fail-| | | | | | | <handler>-| | | | | | | pushInput-| | | | | | | lift Term-| | | | | | | choices [(\u1 -> u1)]-| | | | | | | <branch>-| | | | | | | | push (\u1 -> u1)-| | | | | | | | ret-| | | | | | | <default>-| | | | | | | fail-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | read ('}' ==)-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | call <hidden>-| | | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | | ret-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | popFail-| | | | | ret-| | | | catchFail-| | | | <try>-| | | | | push (\u1 -> (\u2 -> (\u3 -> Term)))-| | | | | read (':' ==)-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | call <hidden>-| | | | | lift (\u1 -> (\u2 -> u1 u2))-| | | | | popFail-| | | | | refJoin <hidden>-| | | | <handler>-| | | | pushInput-| | | | lift Term-| | | | choices [(\u1 -> u1)]-| | | | <branch>-| | | | | call <hidden>-| | | | | refJoin <hidden>-| | | | <default>-| | | | fail-| | | <handler>-| | | loadInput-| | | fail-| | <handler>-| | loadInput-| | fail-| <handler>-| pushInput-| lift Term-| choices [(\u1 -> u1)]-| <branch>-| | push (\u1 -> u1)-| | ret-| <default>-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| lift (\u1 -> (\u2 -> u1 u2))-| ret-catchFail- <try>- | catchFail- | <try>- | | pushInput- | | read (\u1 -> Term)- | | pop- | | popFail- | | loadInput- | | fail- | <handler>- | loadInput- | push Term- | popFail- | refJoin <hidden>- <handler>- pushInput- lift Term- choices [(\u1 -> u1)]- <branch>- | fail- <default>- fail
− test/Golden/Machine/some-string.dump
@@ -1,42 +0,0 @@-push (\u1 -> (\u2 -> u1 : u2 Term))-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'a' : ('b' : ('c' : ('d' : Term)))))))-| | read ('a' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | read ('b' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | read ('c' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | read ('d' ==)-| | lift (\u1 -> (\u2 -> u1 u2))-| | popFail-| | ret-| <handler>-| loadInput-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-<hidden>:-| catchFail-| <try>-| | push (\u1 -> (\u2 -> (\u3 -> u1 : u2 u3)))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | call <hidden>-| | lift (\u1 -> (\u2 -> u1 u2))-| | popFail-| | ret-| <handler>-| pushInput-| lift Term-| choices [(\u1 -> u1)]-| <branch>-| | push (\u1 -> u1)-| | ret-| <default>-| fail-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/string.dump
@@ -1,16 +0,0 @@-catchFail- <try>- | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'a' : ('b' : ('c' : ('d' : Term)))))))- | read ('a' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | read ('b' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | read ('c' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | read ('d' ==)- | lift (\u1 -> (\u2 -> u1 u2))- | popFail- | ret- <handler>- loadInput- fail
− test/Golden/Machine/string.txt
@@ -1,1 +0,0 @@-ab
− test/Golden/Machine/unit-unit.dump
@@ -1,9 +0,0 @@-push (\u1 -> (\u2 -> u2))-<hidden>:-| push Term-| ret-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-call <hidden>-lift (\u1 -> (\u2 -> u1 u2))-ret
− test/Golden/Machine/unit.dump
@@ -1,2 +0,0 @@-push Term-ret
+ test/Golden/Parser.hs view
@@ -0,0 +1,86 @@+{-# LANGUAGE DataKinds #-} -- For using P.viewGrammar+{-# LANGUAGE FlexibleContexts #-} -- For using P.Grammar Char+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE TypeApplications #-}+-- For TH splices+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE UnboxedTuples #-}+{-# OPTIONS_GHC -Wno-missing-signatures #-}+{-# OPTIONS_GHC -Wno-unused-local-binds #-}+{-# OPTIONS_GHC -Wno-unused-matches #-}+module Golden.Parser where++import Control.Monad (Monad(..))+import Data.Either (Either(..))+import Data.Function (($))+import Data.Functor ((<$>))+import Data.Int (Int)+import Data.Semigroup (Semigroup(..))+import Data.String (String, IsString(..))+import Data.Text (Text)+import Data.Text.IO (readFile)+import System.FilePath ((<.>), (</>), dropExtensions, takeBaseName)+import System.IO.Unsafe (unsafePerformIO)+import Test.Tasty+import Test.Tasty.Golden+import Text.Show (Show(..))+import qualified Control.Exception as IO+import qualified Data.List as List+import qualified System.Directory as IO+import qualified System.IO.Error as IO+import qualified Language.Haskell.TH as TH++import qualified Symantic.Parser as P+import Golden.Utils+import Golden.Splice++goldens :: TestTree+goldens = testGroup "Parser" $+ (\f -> List.zipWith f parsers [1::Int ..]) $ \p g ->+ -- Collect the existing files: test/Golden/Parser/G*.input.txt+ let parserDir = getGoldenDir $ "Parser/G"<>show g in+ let inputs =+ ((parserDir </>) <$>) $+ List.sort $+ List.filter (List.isSuffixOf ".input.txt") $+ unsafePerformIO $+ IO.catchIOError+ (IO.listDirectory parserDir)+ (\exn ->+ if IO.isDoesNotExistError exn+ then return []+ else IO.throwIO exn+ ) in+ testGroup ("G"<>show g) $ (<$> inputs) $ \inp ->+ goldenVsStringDiff (takeBaseName (dropExtensions inp)) goldenDiff+ (dropExtensions inp<.>"expected.txt") $ do+ input <- readFile inp+ return $ fromString $+ case p input of+ Left err -> show err+ Right a -> a++parsers :: [Text -> Either (P.ParsingError Text) String]+parsers =+ [ p1, p2, p3, p4, p5, p6, p7, p8, p9+ , p10, p11, p12, p13, p14, p15, p16+ ]++p1 = $$(TH.Code $ TH.runIO s1)+p2 = $$(TH.Code $ TH.runIO s2)+p3 = $$(TH.Code $ TH.runIO s3)+p4 = $$(TH.Code $ TH.runIO s4)+p5 = $$(TH.Code $ TH.runIO s5)+p6 = $$(TH.Code $ TH.runIO s6)+p7 = $$(TH.Code $ TH.runIO s7)+p8 = $$(TH.Code $ TH.runIO s8)+p9 = $$(TH.Code $ TH.runIO s9)+p10 = $$(TH.Code $ TH.runIO s10)+p11 = $$(TH.Code $ TH.runIO s11)+p12 = $$(TH.Code $ TH.runIO s12)+p13 = $$(TH.Code $ TH.runIO s13)+p14 = $$(TH.Code $ TH.runIO s14)+p15 = $$(TH.Code $ TH.runIO s15)+p16 = $$(TH.Code $ TH.runIO s16)
+ test/Golden/Parser/G1/P1.expected.txt view
@@ -0,0 +1,1 @@+'a'
+ test/Golden/Parser/G1/P1.input.txt view
@@ -0,0 +1,1 @@+a
+ test/Golden/Parser/G10/P1.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'c', parsingErrorExpecting = fromList [FailureToken 'a',FailureToken 'b']}
+ test/Golden/Parser/G10/P1.input.txt view
@@ -0,0 +1,1 @@+c
+ test/Golden/Parser/G11/P1.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 4, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'c', parsingErrorExpecting = fromList [FailureToken 'a',FailureToken 'b']}
+ test/Golden/Parser/G11/P1.input.txt view
@@ -0,0 +1,1 @@+aaaac
+ test/Golden/Parser/G12/P1.expected.txt view
@@ -0,0 +1,1 @@+"baacbccbaa"
+ test/Golden/Parser/G12/P1.input.txt view
@@ -0,0 +1,1 @@+baacbccbaa
+ test/Golden/Parser/G13/P1.expected.txt view
@@ -0,0 +1,1 @@+[Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Loop [Forward,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Forward,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Forward,Increment,Increment,Increment,Forward,Increment,Backward,Backward,Backward,Backward,Decrement],Forward,Increment,Increment,Output,Forward,Increment,Output,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Output,Output,Increment,Increment,Increment,Output,Forward,Increment,Increment,Output,Backward,Backward,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Increment,Output,Forward,Output,Increment,Increment,Increment,Output,Decrement,Decrement,Decrement,Decrement,Decrement,Decrement,Output,Decrement,Decrement,Decrement,Decrement,Decrement,Decrement,Decrement,Decrement,Output,Forward,Increment,Output,Forward,Output]
+ test/Golden/Parser/G13/P1.input.txt view
@@ -0,0 +1,1 @@+++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
+ test/Golden/Parser/G13/P2.expected.txt view
@@ -0,0 +1,1 @@+[Loop [Decrement]]
+ test/Golden/Parser/G13/P2.input.txt view
@@ -0,0 +1,3 @@+[ boucle+- enlever 1 à la case courante+] jusqu'à ce que la case soit à zéro
+ test/Golden/Parser/G2/P1.expected.txt view
@@ -0,0 +1,1 @@+"abc"
+ test/Golden/Parser/G2/P1.input.txt view
@@ -0,0 +1,1 @@+abc
+ test/Golden/Parser/G2/P2.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [FailureHorizon 3]}
+ test/Golden/Parser/G2/P2.input.txt view
@@ -0,0 +1,1 @@+ab
+ test/Golden/Parser/G3/P1.expected.txt view
@@ -0,0 +1,1 @@+"aaaaa"
+ test/Golden/Parser/G3/P1.input.txt view
@@ -0,0 +1,1 @@+aaaaa
+ test/Golden/Parser/G4/P1.expected.txt view
@@ -0,0 +1,1 @@+["abcd","abcd","abcd"]
+ test/Golden/Parser/G4/P1.input.txt view
@@ -0,0 +1,1 @@+abcdabcdabcd
+ test/Golden/Parser/G4/P2.expected.txt view
@@ -0,0 +1,1 @@+["abcd","abcd","abcd"]
+ test/Golden/Parser/G4/P2.input.txt view
@@ -0,0 +1,1 @@+abcdabcdabcde
+ test/Golden/Parser/G4/P3.expected.txt view
@@ -0,0 +1,1 @@+["abcd","abcd","abcd"]
+ test/Golden/Parser/G4/P3.input.txt view
@@ -0,0 +1,1 @@+abcdabcdabcdefgh
+ test/Golden/Parser/G5/P1.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [FailureHorizon 4]}
+ test/Golden/Parser/G5/P1.input.txt view
@@ -0,0 +1,1 @@+abc
+ test/Golden/Parser/G5/P2.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 4, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [FailureEnd,FailureHorizon 4]}
+ test/Golden/Parser/G5/P2.input.txt view
@@ -0,0 +1,1 @@+abcdabc
+ test/Golden/Parser/G5/P3.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 4, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'e', parsingErrorExpecting = fromList [FailureEnd,FailureToken 'a']}
+ test/Golden/Parser/G5/P3.input.txt view
@@ -0,0 +1,1 @@+abcdefgh
+ test/Golden/Parser/G6/P1.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 1, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'b', parsingErrorExpecting = fromList [FailureToken 'a']}
+ test/Golden/Parser/G6/P1.input.txt view
@@ -0,0 +1,1 @@+ab
+ test/Golden/Parser/G7/P1.expected.txt view
@@ -0,0 +1,1 @@+"ab"
+ test/Golden/Parser/G7/P1.input.txt view
@@ -0,0 +1,1 @@+ab
+ test/Golden/Parser/G7/P2.expected.txt view
@@ -0,0 +1,1 @@+"aa"
+ test/Golden/Parser/G7/P2.input.txt view
@@ -0,0 +1,1 @@+aa
+ test/Golden/Parser/G8/P1.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 3, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [FailureEnd,FailureToken 'r']}
+ test/Golden/Parser/G8/P1.input.txt view
@@ -0,0 +1,1 @@+rrra
+ test/Golden/Parser/G9/P1.expected.txt view
@@ -0,0 +1,1 @@+()
+ test/Golden/Parser/G9/P1.input.txt view
+ test/Golden/Parser/G9/P2.expected.txt view
@@ -0,0 +1,1 @@+ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorException = ExceptionFailure, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [FailureEnd]}
+ test/Golden/Parser/G9/P2.input.txt view
@@ -0,0 +1,1 @@+a
− test/Golden/Parser/alt-char-fail.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorUnexpected = Just 'c', parsingErrorExpecting = fromList [ErrorItemToken 'a',ErrorItemToken 'b']}
− test/Golden/Parser/alt-char-fail.txt
@@ -1,1 +0,0 @@-c
− test/Golden/Parser/alt-char-try-fail.txt
@@ -1,1 +0,0 @@-c
− test/Golden/Parser/alt-left.dump
@@ -1,1 +0,0 @@-"aa"
− test/Golden/Parser/alt-left.txt
@@ -1,1 +0,0 @@-aa
− test/Golden/Parser/alt-right-notry.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 1, parsingErrorUnexpected = Just 'b', parsingErrorExpecting = fromList [ErrorItemToken 'a']}
− test/Golden/Parser/alt-right-notry.txt
@@ -1,1 +0,0 @@-ab
− test/Golden/Parser/alt-right-try.dump
@@ -1,1 +0,0 @@-"ab"
− test/Golden/Parser/alt-right-try.txt
@@ -1,1 +0,0 @@-ab
− test/Golden/Parser/char.dump
@@ -1,1 +0,0 @@-'a'
− test/Golden/Parser/char.txt
@@ -1,1 +0,0 @@-a
− test/Golden/Parser/eof-fail.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [ErrorItemEnd]}
− test/Golden/Parser/eof-fail.txt
@@ -1,1 +0,0 @@-a
− test/Golden/Parser/eof.dump
@@ -1,1 +0,0 @@-()
− test/Golden/Parser/eof.txt
− test/Golden/Parser/many-char-eof.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 3, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [ErrorItemToken 'r',ErrorItemEnd]}
− test/Golden/Parser/many-char-eof.txt
@@ -1,1 +0,0 @@-rrra
− test/Golden/Parser/many-char-fail.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 4, parsingErrorUnexpected = Just 'c', parsingErrorExpecting = fromList [ErrorItemToken 'a',ErrorItemToken 'b']}
− test/Golden/Parser/many-char-fail.txt
@@ -1,1 +0,0 @@-aaaac
− test/Golden/Parser/many-char.dump
@@ -1,1 +0,0 @@-"aaaaa"
− test/Golden/Parser/many-char.txt
@@ -1,1 +0,0 @@-aaaaa
− test/Golden/Parser/many-oneOf.dump
@@ -1,1 +0,0 @@-"baacbccbaa"
− test/Golden/Parser/many-oneOf.txt
@@ -1,1 +0,0 @@-baacbccbaa
− test/Golden/Parser/some-string-eof-fail.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 4, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [ErrorItemHorizon 4,ErrorItemEnd]}
− test/Golden/Parser/some-string-eof-fail.txt
@@ -1,1 +0,0 @@-abcdabc
− test/Golden/Parser/some-string-fail.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [ErrorItemHorizon 4]}
− test/Golden/Parser/some-string-fail.txt
@@ -1,1 +0,0 @@-abc
− test/Golden/Parser/some-string.dump
@@ -1,1 +0,0 @@-["abcd","abcd","abcd"]
− test/Golden/Parser/some-string.txt
@@ -1,1 +0,0 @@-abcdabcdabcd
− test/Golden/Parser/string-fail-horizon.dump
@@ -1,1 +0,0 @@-ParsingErrorStandard {parsingErrorOffset = 0, parsingErrorUnexpected = Just 'a', parsingErrorExpecting = fromList [ErrorItemHorizon 3]}
− test/Golden/Parser/string-fail-horizon.txt
@@ -1,1 +0,0 @@-ab
− test/Golden/Parser/string.dump
@@ -1,1 +0,0 @@-"abc"
− test/Golden/Parser/string.txt
@@ -1,1 +0,0 @@-abc
+ test/Golden/Splice.hs view
@@ -0,0 +1,49 @@+{-# OPTIONS_GHC -Wno-missing-signatures #-}+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}+module Golden.Splice where++import Data.Either (Either(..))+import Data.Function (($))+import Data.Functor ((<$>))+import Data.Int (Int)+import Data.List ((++))+import Data.String (String, IsString(..))+import Data.Text (Text)+import Symantic.Parser (ParsingError, optimizeMachine, generateCode)+import System.FilePath (dropExtensions, takeBaseName, (</>), (<.>))+import System.IO (IO)+import Test.Tasty+import Test.Tasty.Golden (goldenVsStringDiff)+import Text.Show (Show(..))+import qualified Data.List as List+import qualified Language.Haskell.TH as TH+import qualified Language.Haskell.TH.HideName as TH+import qualified System.Process as Process++import Golden.Utils+import qualified Grammar++goldens :: TestTree+goldens = testGroup "Splice"+ [ let spliceFile = getGoldenDir $ "Splice/"</>"G"++show g<.>"expected"<.>"txt" in+ goldenVsStringDiff (takeBaseName (dropExtensions spliceFile)) goldenDiff spliceFile $ do+ tExp <- splice+ fromString <$> Process.readProcess "ormolu"+ [ "-o", "-XBangPatterns"+ , "-o", "-XMagicHash"+ , "-o", "-XTypeApplications"+ , "-o", "-XUnboxedTuples"+ ]+ (show (TH.ppr (TH.hideName (TH.unType tExp))))+ | (g, splice) <- List.zip [1::Int ..] splices+ ]++splices :: [IO (TH.TExp (Text -> Either (ParsingError Text) String))]+splices = (<$> Grammar.grammars) $ \g -> TH.runQ $ do+ TH.runIO resetTHNameCounter+ mach <- TH.runIO $ optimizeMachine g+ TH.examineCode $ generateCode mach++[ s1,s2,s3,s4,s5,s6,s7,s8,s9+ ,s10,s11,s12,s13,s14,s15,s16+ ] = splices
+ test/Golden/Splice/G1.expected.txt view
@@ -0,0 +1,132 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let readFail = finalRaise+ in if readMore init+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in finalRet+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in GHC.Show.show 'a'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G10.expected.txt view
@@ -0,0 +1,243 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = finalRaise+ in if readMore failInp+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in 'b'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore init+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in 'a'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G11.expected.txt view
@@ -0,0 +1,257 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'a' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) 'a' (v x)+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let readFail = finalRaise+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show (v GHC.Types . [])+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G12.expected.txt view
@@ -0,0 +1,305 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (\t -> ('a' GHC.Classes.== t) GHC.Classes.|| (('b' GHC.Classes.== t) GHC.Classes.|| (('c' GHC.Classes.== t) GHC.Classes.|| (('d' GHC.Classes.== t) GHC.Classes.|| GHC.Types.False)))) c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) c (v x)+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 4+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ ( Data.Set.Internal.Bin+ 2+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show (v GHC.Types . [])+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G13.expected.txt view
@@ -0,0 +1,722 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v GHC.Types . []+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '<' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Backward+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) '>' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Forward+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) '+' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Increment+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) '-' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Decrement+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) ',' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Input+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) '.' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Output+ )+ cs+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in if (GHC.Classes.==) '[' c+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ']' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in Parsers.Brainfuck.Types.Loop v+ )+ cs+ else+ let _ = "checkToken.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "choicesBranch.else"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEmpty) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (\c -> GHC.Classes.not (('<' GHC.Classes.== c) GHC.Classes.|| (('>' GHC.Classes.== c) GHC.Classes.|| (('+' GHC.Classes.== c) GHC.Classes.|| (('-' GHC.Classes.== c) GHC.Classes.|| ((',' GHC.Classes.== c) GHC.Classes.|| (('.' GHC.Classes.== c) GHC.Classes.|| (('[' GHC.Classes.== c) GHC.Classes.|| ((']' GHC.Classes.== c) GHC.Classes.|| GHC.Types.False))))))))) c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ )+ inp+ Data.Map.Internal.Tip+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G14.expected.txt view
@@ -0,0 +1,4218 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if GHC.Unicode.isSpace c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (\t -> ('0' GHC.Classes.== t) GHC.Classes.|| (('1' GHC.Classes.== t) GHC.Classes.|| (('2' GHC.Classes.== t) GHC.Classes.|| (('3' GHC.Classes.== t) GHC.Classes.|| (('4' GHC.Classes.== t) GHC.Classes.|| (('5' GHC.Classes.== t) GHC.Classes.|| (('6' GHC.Classes.== t) GHC.Classes.|| (('7' GHC.Classes.== t) GHC.Classes.|| (('8' GHC.Classes.== t) GHC.Classes.|| (('9' GHC.Classes.== t) GHC.Classes.|| GHC.Types.False)))))))))) c+ then+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in c+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 10+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '3'+ )+ )+ ( Data.Set.Internal.Bin+ 3+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '1'+ )+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '0'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '2'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ ( Data.Set.Internal.Bin+ 6+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '7'+ )+ )+ ( Data.Set.Internal.Bin+ 3+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '5'+ )+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '4'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '6'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ ( Data.Set.Internal.Bin+ 2+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '8'+ )+ )+ Data.Set.Internal.Tip+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '9'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ )+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '(' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in '('+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '('+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ')' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in ')'+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken ')'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ',' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in ','+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken ','+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ';' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in ';'+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken ';'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '{' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '}' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '}'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '{'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let readFail = Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 4 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '[' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let readFail = readFail+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ']' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken ']'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '['+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 5+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if Parsers.Nandlang.nandIdentStart c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ failInp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure (Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel) Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) '\'' c+ then+ let join = \farInp farExp v (!inp) ->+ let readFail = readFail+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '\'' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '\''+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ cs+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = readFail+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) '\\' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (\t -> ('0' GHC.Classes.== t) GHC.Classes.|| (('t' GHC.Classes.== t) GHC.Classes.|| (('n' GHC.Classes.== t) GHC.Classes.|| (('v' GHC.Classes.== t) GHC.Classes.|| (('f' GHC.Classes.== t) GHC.Classes.|| (('r' GHC.Classes.== t) GHC.Classes.|| GHC.Types.False)))))) c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 6+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'n'+ )+ )+ ( Data.Set.Internal.Bin+ 2+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '0'+ )+ )+ Data.Set.Internal.Tip+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'f'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ ( Data.Set.Internal.Bin+ 3+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 't'+ )+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'r'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ ( Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'v'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ )+ )+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '\\'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in let !(#+ c,+ cs+ #) = readNext cs+ in if Parsers.Nandlang.nandStringLetter c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '\''+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) '1' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in '1'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '1'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '0' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in '0'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '0'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "jump"+ in name ok failInp Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ failInp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '=' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '='+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ failInp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 10 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'v' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'r' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'r'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'v'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 11+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 10 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'w' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'h' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'i' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'l' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'e' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'e'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'l'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'i'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'h'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'w'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 11+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'i' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'f' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'f'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'i'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if Parsers.Nandlang.nandIdentLetter c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp init Data.Set.Internal.empty+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) '!' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken '!'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 17 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'f' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'u' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'n' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'c' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 't' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'i' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'o' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'n' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> v x+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ )+ failInp+ Data.Map.Internal.Tip+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) ':' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken ':'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ cs+ Data.Map.Internal.Tip+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'n'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'o'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'i'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 't'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'n'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'u'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'f'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 18+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in \x -> \x -> x+ )+ inp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ Data.Map.Internal.Tip+ )+ inp+ Data.Map.Internal.Tip+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G15.expected.txt view
@@ -0,0 +1,316 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let readFail = finalRaise+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'c' c+ then+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = finalRaise+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in 'b'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in 'a'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G16.expected.txt view
@@ -0,0 +1,427 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let readFail = finalRaise+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'd' c+ then+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = finalRaise+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'c' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in 'c'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in 'b'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in 'a'+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G2.expected.txt view
@@ -0,0 +1,211 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 2 init)+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(# c, cs #) = readNext cs+ in if (GHC.Classes.==) 'b' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'c' c+ then+ let _ = "resume"+ in finalRet+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in GHC.Show.show ((GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' GHC.Types . [])))+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 3+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G3.expected.txt view
@@ -0,0 +1,184 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'a' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) 'a' (v x)+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show (v GHC.Types . [])+ )+ inp+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G4.expected.txt view
@@ -0,0 +1,326 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'b' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'c' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'd' c+ then+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types . [])))+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show ((GHC.Types.:) v (v GHC.Types . []))+ )+ inp+ )+ inp+ Data.Map.Internal.Tip+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G5.expected.txt view
@@ -0,0 +1,420 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 3 inp)+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'b' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'c' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'd' c+ then+ let _ = "resume"+ in ok+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' ((GHC.Types.:) 'c' ((GHC.Types.:) 'd' GHC.Types . [])))+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'd'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'c'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 4+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) v (v x)+ )+ inp+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ )+ inp+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure catchHandler Data.Map.Internal.Tip Data.Map.Internal.Tip)+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show ((GHC.Types.:) v (v GHC.Types . []))+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ inp+ Data.Map.Internal.Tip+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G6.expected.txt view
@@ -0,0 +1,318 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let readFail = finalRaise+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = finalRaise+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types . [])+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(# c, cs #) = readNext cs+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types . [])+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G7.expected.txt view
@@ -0,0 +1,329 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 failInp)+ then+ let !(#+ c,+ cs+ #) = readNext failInp+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'b' c+ then+ let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'b' GHC.Types . [])+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'b'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ in let readFail = catchHandler+ in if readMore (Symantic.Parser.Machine.Input.shiftRightText 1 init)+ then+ let !(# c, cs #) = readNext init+ in if (GHC.Classes.==) 'a' c+ then+ let readFail = readFail+ in let !(#+ c,+ cs+ #) = readNext cs+ in if (GHC.Classes.==) 'a' c+ then+ let _ = "resume"+ in join+ init+ Data.Set.Internal.empty+ ( let _ = "resume.genCode"+ in (GHC.Types.:) 'a' ((GHC.Types.:) 'a' GHC.Types . [])+ )+ cs+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init cs of+ GHC.Types.LT ->+ (#+ cs,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure cs farInp farExp+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'a'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 2+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
+ test/Golden/Splice/G8.expected.txt view
@@ -0,0 +1,278 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let name = \(!ok) (!inp) (!koByLabel) ->+ let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> x+ )+ failInp+ else+ let _ = "choicesBranch.else"+ in Data.Map.Strict.Internal.findWithDefault finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure koByLabel Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in if (GHC.Classes.==) 'r' c+ then+ name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let _ = "resume"+ in ok+ farInp+ farExp+ ( let _ = "resume.genCode"+ in \x -> (GHC.Types.:) 'r' (v x)+ )+ inp+ )+ cs+ (Data.Map.Internal.Bin 1 Symantic.Parser.Grammar.Combinators.ExceptionFailure readFail Data.Map.Internal.Tip Data.Map.Internal.Tip)+ else+ let _ = "checkToken.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureToken 'r'+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ in name+ ( let _ = "suspend"+ in \farInp farExp v (!inp) ->+ let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show (v GHC.Types . [])+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ inp+ failInp+ then+ let _ = "choicesBranch.then"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ inp+ in let readFail = catchHandler+ in if readMore inp+ then+ let !(#+ c,+ cs+ #) = readNext inp+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp inp of+ GHC.Types.LT ->+ (#+ inp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure inp farInp farExp+ )+ init+ Data.Map.Internal.Tip
+ test/Golden/Splice/G9.expected.txt view
@@ -0,0 +1,153 @@+\(input :: inp) ->+ let !(#+ init,+ readMore,+ readNext+ #) =+ let _ = "cursorOf"+ in let next+ ( t@( Data.Text.Internal.Text+ arr+ off+ unconsumed+ )+ ) =+ let !( Data.Text.Unsafe.Iter+ c+ d+ ) = Data.Text.Unsafe.iter t 0+ in (#+ c,+ Data.Text.Internal.Text arr (off GHC.Num.+ d) (unconsumed GHC.Num.- d)+ #)+ more+ ( Data.Text.Internal.Text+ _+ _+ unconsumed+ ) = unconsumed GHC.Classes.> 0+ in (# input, more, next #)+ finalRet = \_farInp _farExp v _inp -> Data.Either.Right v+ finalRaise ::+ forall b.+ Symantic.Parser.Machine.Generate.Catcher+ inp+ b = \(!exn) _failInp (!farInp) (!farExp) ->+ Data.Either.Left+ Symantic.Parser.Machine.Generate.ParsingError+ { Symantic.Parser.Machine.Generate.parsingErrorOffset = Symantic.Parser.Machine.Input.offset farInp,+ Symantic.Parser.Machine.Generate.parsingErrorException = exn,+ Symantic.Parser.Machine.Generate.parsingErrorUnexpected =+ if readMore farInp+ then+ GHC.Maybe.Just+ ( let (#+ c,+ _+ #) = readNext farInp+ in c+ )+ else GHC.Maybe.Nothing,+ Symantic.Parser.Machine.Generate.parsingErrorExpecting = farExp+ }+ in let inputToken = Data.Proxy.Proxy :: Data.Proxy.Proxy (Symantic.Parser.Machine.Input.InputToken inp)+ in let+ in let join = \farInp farExp v (!inp) ->+ let _ = "resume"+ in finalRet+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Show.show v+ )+ inp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in if ( \( Data.Text.Internal.Text+ _+ i+ _+ )+ ( Data.Text.Internal.Text+ _+ j+ _+ ) -> i GHC.Classes.== j+ )+ init+ failInp+ then+ let _ = "choicesBranch.then"+ in let failExp = Data.Set.Internal.Bin 1 (Symantic.Parser.Grammar.Combinators.SomeFailure Symantic.Parser.Grammar.Combinators.FailureEnd) Data.Set.Internal.Tip Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) farInp failInp of+ GHC.Types.LT ->+ (#+ failInp,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ farInp,+ failExp GHC.Base.<> farExp+ #)+ GHC.Types.GT ->+ (#+ farInp,+ farExp+ #)+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ else+ let _ = "choicesBranch.else"+ in finalRaise Symantic.Parser.Grammar.Combinators.ExceptionFailure failInp farInp farExp+ in let _ = "catch ExceptionFailure"+ in let catchHandler (!_exn) (!failInp) (!farInp) (!farExp) =+ let _ = "catch.ko ExceptionFailure"+ in let _ = "resume"+ in join+ farInp+ farExp+ ( let _ = "resume.genCode"+ in GHC.Tuple . ()+ )+ init+ in let readFail = catchHandler+ in if readMore init+ then+ let !(# c, cs #) = readNext init+ in catchHandler Symantic.Parser.Grammar.Combinators.ExceptionFailure init init Data.Set.Internal.empty+ else+ let _ = "checkHorizon.else"+ in let failExp =+ Data.Set.Internal.Bin+ 1+ ( Symantic.Parser.Grammar.Combinators.SomeFailure+ ( case inputToken of+ (Data.Proxy.Proxy :: Data.Proxy.Proxy tok') -> Symantic.Parser.Grammar.Combinators.FailureHorizon @tok' 1+ )+ )+ Data.Set.Internal.Tip+ Data.Set.Internal.Tip+ in let (#+ farInp,+ farExp+ #) = case (GHC.Classes.compare `Data.Function.on` Symantic.Parser.Machine.Input.offset) init init of+ GHC.Types.LT ->+ (#+ init,+ failExp+ #)+ GHC.Types.EQ ->+ (#+ init,+ failExp GHC.Base.<> Data.Set.Internal.empty+ #)+ GHC.Types.GT ->+ (#+ init,+ Data.Set.Internal.empty+ #)+ in readFail Symantic.Parser.Grammar.Combinators.ExceptionFailure init farInp farExp
− test/Golden/Splice/T1.hs
@@ -1,70 +0,0 @@-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE Rank2Types #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE UnboxedTuples #-}-module Golden.Splice.T1 where--import Control.Monad (Monad(..))-import Data.Char (Char)-import Data.Either (Either(..))-import Data.Function (($))-import Data.Semigroup (Semigroup(..))-import Data.String (String, IsString(..))-import Data.Text (Text)-import Data.Text.IO (readFile)-import System.IO (IO, FilePath)-import Test.Tasty-import Test.Tasty.Golden-import Text.Show (Show(..))-import qualified Data.ByteString.Lazy as BSL-import qualified Data.IORef as IORef-import qualified Data.Text.Lazy as TL-import qualified Data.Text.Lazy.Encoding as TL-import qualified Language.Haskell.TH.Syntax as TH--import qualified Symantic.Parser as P-import qualified Symantic.Parser.Haskell as H-import qualified Parser---import Golden.Utils---{--goldensParser :: TestTree-goldensParser = testGroup "Parser"- [ testGroup "runParser" $ tests $ \name p ->- let file = "test/Golden/Parser/"<>name in- goldenVsStringDiff (file<>".txt") diffGolden (file<>".dump") $ do- input :: Text <- readFile (file<>".txt")- return $ fromString $- case p input of- Left err -> show err- Right a -> show a- ]- where- tests :: (forall a. Show a => String -> (Text -> Either (P.ParsingError Text) a) -> TestTree) -> [TestTree]- tests test =- [ test "char" $$(P.runParser $ P.char 'a')- , test "string" $$(P.runParser $ P.string "abc")- , test "string-fail-horizon" $$(P.runParser $ P.string "abc")- , test "many-char" $$(P.runParser $ P.many (P.char 'a'))- , test "some-string" $$(P.runParser $ P.some (P.string "abcd"))- , test "some-string-fail" $$(P.runParser $ P.some (P.string "abcd"))- , test "some-string-eof-fail" $$(P.runParser $ P.some (P.string "abcd") P.<* P.eof)- , test "alt-right-notry" $$(P.runParser $ P.traverse P.char "aa" P.<|> P.traverse P.char "ab")- , test "alt-right-try" $$(P.runParser $ P.string "aa" P.<|> P.string "ab")- , test "alt-left" $$(P.runParser $ P.string "aa" P.<|> P.string "ab")- , test "many-char-eof" $$(P.runParser $ P.many (P.char 'r') P.<* P.eof)- , test "eof" $$(P.runParser $ P.eof)- , test "eof-fail" $$(P.runParser $ P.eof)- , test "alt-char-fail" $$(P.runParser $ P.char 'a' P.<|> P.char 'b')- , test "many-char-fail" $$(P.runParser $ P.many (P.char 'a') P.<* P.char 'b')- , test "many-oneOf" $$(P.runParser $ P.many (P.oneOf ['a', 'b', 'c', 'd']) P.<* P.eof)- ]--}--- | Resetting 'TH.counter' makes 'makeLetName' deterministic,--- except when flags change, like profiling--- or even --accept unfortunately,--- in those case the 'goldensMachine' tests may fail--- due to a different numbering of the 'def' and 'ref' combinators.-resetTHNameCounter :: IO ()-resetTHNameCounter = IORef.writeIORef TH.counter 0
+ test/Golden/Utils.hs view
@@ -0,0 +1,36 @@+module Golden.Utils where++import Control.Monad (Monad(..))+import Data.Either (Either(..))+import Data.Function (($))+import Data.Semigroup (Semigroup(..))+import Data.String (String)+import System.IO (IO, FilePath)+import System.IO.Unsafe (unsafePerformIO)+import qualified Data.ByteString.Lazy as BSL+import qualified Data.IORef as IORef++import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL+import qualified Language.Haskell.TH.Syntax as TH+import Paths_symantic_parser++getGoldenDir :: FilePath -> FilePath+getGoldenDir p = unsafePerformIO $ getDataFileName $ "test/Golden/" <> p++goldenDiff :: FilePath -> FilePath -> [String]+goldenDiff ref new = ["diff", "-u", "-w", "-B", ref, new]++-- | Resetting 'TH.counter' makes 'makeLetName' deterministic,+-- except when GHC or executable flags change, like profiling+-- or even --accept unfortunately,+-- in those case the 'goldensMachine' tests may fail+-- due to a different numbering of the 'def' and 'ref' combinators.+-- Hence 'ShowLetName' is used with 'False'.+resetTHNameCounter :: IO ()+resetTHNameCounter = IORef.writeIORef TH.counter 0++unLeft :: Either String BSL.ByteString -> IO BSL.ByteString+unLeft lr = case lr of+ Left err -> return $ TL.encodeUtf8 $ TL.pack err+ Right a -> return a
+ test/Grammar.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE NoMonomorphismRestriction #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -Wno-missing-signatures #-}+module Grammar where+import Data.Char (Char)+import Data.String (String)+import Text.Show (Show(..))+import qualified Data.Functor as Functor+import qualified Parsers.Nandlang+import qualified Parsers.Brainfuck.SymanticParser.Grammar++import Symantic.Parser++rawGrammars :: Grammarable Char repr => [repr String]+rawGrammars =+ [ production show [||show||] <$> g1+ , production show [||show||] <$> g2+ , production show [||show||] <$> g3+ , production show [||show||] <$> g4+ , production show [||show||] <$> g5+ , production show [||show||] <$> g6+ , production show [||show||] <$> g7+ , production show [||show||] <$> g8+ , production show [||show||] <$> g9+ , production show [||show||] <$> g10+ , production show [||show||] <$> g11+ , production show [||show||] <$> g12+ , production show [||show||] <$> g13+ , production show [||show||] <$> g14+ , production show [||show||] <$> g15+ , production show [||show||] <$> g16+ ]+grammars :: Grammarable Char repr => [repr String]+grammars = observeSharing Functor.<$> rawGrammars++g1 = char 'a'+g2 = string "abc"+g3 = many (char 'a')+g4 = some (string "abcd")+g5 = some (string "abcd") <* eof+g6 = traverse char "aa" <|> traverse char "ab"+g7 = string "aa" <|> string "ab"+g8 = many (char 'r') <* eof+g9 = eof+g10 = char 'a' <|> char 'b'+g11 = many (char 'a') <* char 'b'+g12 = many (oneOf ['a', 'b', 'c', 'd']) <* eof+g13 = Parsers.Brainfuck.SymanticParser.Grammar.grammar @Char @_+g14 = Parsers.Nandlang.grammar+g15 = (char 'a' <|> char 'b') <* char 'c'+g16 = (char 'a' <|> char 'b' <|> char 'c') <* char 'd'
test/Main.hs view
@@ -1,17 +1,15 @@ module Main where import System.IO (IO)-import Data.Function (($))- import Test.Tasty import Golden --import HUnit main :: IO () main = do- goldens <- goldensIO- defaultMain $+ defaultMain ( testGroup ""- [ goldens- --, hunits- ]+ [ Golden.goldens+ --, hunits+ ]+ )
− test/Parser.hs
@@ -1,8 +0,0 @@-module Parser- ( module Parser.Brainfuck- , module Parser.Nandlang- , module Parser.Playground- ) where-import Parser.Brainfuck-import Parser.Nandlang-import Parser.Playground
− test/Parser/Brainfuck.hs
@@ -1,47 +0,0 @@-{-# LANGUAGE DeriveLift #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE TemplateHaskell #-}-module Parser.Brainfuck where--import Data.Char (Char)-import Data.Eq (Eq(..))-import Text.Show (Show(..))-import qualified Prelude-import qualified Language.Haskell.TH.Syntax as TH--import Symantic.Univariant.Trans-import qualified Symantic.Parser as P-import qualified Symantic.Parser.Haskell as H--data BrainFuckOp- = RightPointer- | LeftPointer- | Increment- | Decrement- | Output- | Input- | Loop [BrainFuckOp]- deriving (Show, Eq, TH.Lift)--haskell :: TH.Lift a => a -> P.TermGrammar a-haskell a = H.Term (H.ValueCode a [||a||])--brainfuck :: forall repr.- P.Grammar Char repr =>- repr [BrainFuckOp]-brainfuck = whitespace P.*> bf- where- whitespace = P.skipMany (P.noneOf "<>+-[],.$")- lexeme p = p P.<* whitespace- bf :: repr [BrainFuckOp]- bf = P.many (lexeme (P.match (P.look P.anyChar) (haskell Prelude.<$> "><+-.,[") op P.empty))- op :: H.Term H.ValueCode Char -> repr BrainFuckOp- op (trans -> H.ValueCode c _) = case c of- '>' -> P.anyChar P.$> H.Term (H.ValueCode RightPointer [||RightPointer||])- '<' -> P.anyChar P.$> H.Term (H.ValueCode LeftPointer [||LeftPointer||])- '+' -> P.anyChar P.$> H.Term (H.ValueCode Increment [||Increment||])- '-' -> P.anyChar P.$> H.Term (H.ValueCode Decrement [||Decrement||])- '.' -> P.anyChar P.$> H.Term (H.ValueCode Output [||Output||])- ',' -> P.anyChar P.$> H.Term (H.ValueCode Input [||Input||])- '[' -> P.between (lexeme P.anyChar) (P.char ']') (H.Term (H.ValueCode Loop [||Loop||]) P.<$> bf)- _ -> Prelude.undefined
− test/Parser/Nandlang.hs
@@ -1,138 +0,0 @@-{-# LANGUAGE DeriveLift #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE Rank2Types #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE UnboxedTuples #-}-module Parser.Nandlang where--import Data.Bool-import Data.Char (isSpace, isAlpha, isAlphaNum)-import Data.Char (Char)-import Data.Eq (Eq(..))-import Data.Ord (Ord(..))-import Data.String (String)-import qualified Data.Set as Set-import qualified Data.Text as Text--import Symantic.Univariant.Trans-import qualified Symantic.Parser as P-import qualified Symantic.Parser.Haskell as H--type Parser a = P.Parser Text.Text a--nandIdentStart :: Char -> Bool-nandIdentStart c = isAlpha c || c == '_'--nandIdentLetter :: Char -> Bool-nandIdentLetter c = isAlphaNum c || c == '_'--nandUnreservedName :: String -> Bool-nandUnreservedName = \s -> not (Set.member s keys)- where- keys = Set.fromList ["if", "else", "while", "function", "var"]--nandStringLetter :: Char -> Bool-nandStringLetter c = (c /= '"') && (c /= '\\') && (c > '\026')--nandlang :: forall repr.- P.Grammar Char repr =>- repr ()-nandlang = whitespace P.*> P.skipMany funcdef P.<* P.eof- where- index :: repr ()- index = brackets nat- identifier :: repr ()- identifier = P.try (identStart P.*> P.skipMany identLetter) P.*> whitespace- variable :: repr ()- variable = identifier P.*> P.optional index-- literal :: repr ()- literal = bit P.<|> charLit-- keyword :: String -> repr ()- keyword s = P.try (P.string s P.*> notIdentLetter) P.*> whitespace-- identStart = P.satisfy- [P.ErrorItemLabel "identStart"]- (trans (H.ValueCode nandIdentStart [||nandIdentStart||]))- identLetter = P.satisfy- [P.ErrorItemLabel "identLetter"]- (trans (H.ValueCode nandIdentLetter [||nandIdentLetter||]))- notIdentLetter = P.negLook identLetter-- bit :: repr ()- bit = (P.char '0' P.<|> P.char '1') P.*> whitespace-- nat :: repr ()- nat = decimal-- charLit :: repr ()- charLit = P.between (P.char '\'') (symbol '\'') charChar-- charChar :: repr ()- charChar = P.void (P.satisfy- [P.ErrorItemLabel "Char"]- (trans (H.ValueCode nandStringLetter [||nandStringLetter||]))) P.<|> esc-- esc :: repr ()- esc = P.char '\\' P.*> P.void (P.oneOf "0tnvfr")-- expr :: repr ()- expr = nandexpr P.*> P.skipMany (symbol '!' P.*> nandexpr)-- nandexpr :: repr ()- nandexpr = literal P.<|> funccallOrVar-- funccallOrVar :: repr ()- funccallOrVar = identifier P.*> P.optional (parens exprlist P.<|> index)-- exprlist = commaSep expr- exprlist1 = commaSep1 expr- varlist = commaSep variable- varlist1 = commaSep1 variable-- funcparam = varlist P.*> P.optional (symbol ':' P.*> varlist)- varstmt = P.optional (keyword "var") P.*> varlist1 P.*> symbol '=' P.*> exprlist1 P.<* semi- ifstmt = keyword "if" P.*> expr P.*> block P.*> P.optional (keyword "else" P.*> block)- whilestmt = keyword "while" P.*> expr P.*> block- statement = ifstmt P.<|> whilestmt P.<|> P.try varstmt P.<|> expr P.<* semi- block = braces (P.skipMany statement)- funcdef = keyword "function" P.*> identifier P.*> parens funcparam P.*> block-- decimal :: repr ()- decimal = number (P.oneOf ['0'..'9'])- -- hexadecimal = P.oneOf "xX" P.*> number (P.oneOf (['a'..'f'] <> ['A'..'F'] <> ['0'..'9']))- -- octal = P.oneOf "oO" P.*> number (P.oneOf ['0'..'7'])- number :: repr a -> repr ()- number digit = P.skipSome digit-- symbol :: Char -> repr Char- symbol c = P.char c P.<* whitespace- parens :: repr a -> repr a- parens = P.between (symbol '(') (symbol ')')- brackets :: repr a -> repr a- brackets = P.between (symbol '[') (symbol ']')- braces :: repr a -> repr a- braces = P.between (symbol '{') (symbol '}')- semi :: repr Char- semi = symbol ';'- comma :: repr Char- comma = symbol ','- commaSep :: repr a -> repr ()- commaSep p = P.optional (commaSep1 p)- commaSep1 :: repr a -> repr ()- commaSep1 p = p P.*> P.skipMany (comma P.*> p)-- space :: repr ()- space = P.void (P.satisfy- [P.ErrorItemLabel "space"]- (trans (H.ValueCode isSpace [||isSpace||])))- whitespace :: repr ()- whitespace = P.skipMany (spaces P.<|> oneLineComment)- spaces :: repr ()- spaces = P.skipSome space- oneLineComment :: repr ()- oneLineComment = P.void (P.string "//" P.*> P.skipMany (P.satisfy- [P.ErrorItemLabel "oneLineComment"]- (trans (H.ValueCode (/= '\n') [||(/= '\n')||]))))
− test/Parser/Playground.hs
@@ -1,15 +0,0 @@-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE TemplateHaskell #-}-module Parser.Playground where--import Symantic.Parser-import qualified Symantic.Parser.Haskell as H--boom :: Applicable repr => repr ()-boom =- let foo = (-- newRegister_ unit (\r0 ->- let goo = (-- newRegister_ unit (\r1 ->- let hoo = {-get r0 <~> get r1 *>-} goo *> hoo in hoo- ) *> goo- in goo) *> pure H.unit- in foo *> foo