BNFC 2.8.4 → 2.9.0
raw patch · 125 files changed
+5099/−20436 lines, 125 filesdep +BNFCdep +string-qqdep ~basedep ~mtlbuild-type:Customsetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies added: BNFC, string-qq
Dependency ranges changed: base, mtl
API changes (from Hackage documentation)
- Algebra.RingUtils: (!!) :: () => [a] -> Int -> a
- Algebra.RingUtils: ($!) :: () => (a -> b) -> a -> b
- Algebra.RingUtils: ($) :: () => (a -> b) -> a -> b
- Algebra.RingUtils: (&&) :: Bool -> Bool -> Bool
- Algebra.RingUtils: (*) :: Ring a => a -> a -> a
- Algebra.RingUtils: (**) :: Floating a => a -> a -> a
- Algebra.RingUtils: (*>) :: Applicative f => f a -> f b -> f b
- Algebra.RingUtils: (+) :: AbelianGroup a => a -> a -> a
- Algebra.RingUtils: (++) :: () => [a] -> [a] -> [a]
- Algebra.RingUtils: (-) :: Num a => a -> a -> a
- Algebra.RingUtils: (.) :: () => (b -> c) -> (a -> b) -> a -> c
- Algebra.RingUtils: (/) :: Fractional a => a -> a -> a
- Algebra.RingUtils: (/=) :: Eq a => a -> a -> Bool
- Algebra.RingUtils: (:/:) :: a -> a -> Pair a
- Algebra.RingUtils: (<$) :: Functor f => a -> f b -> f a
- Algebra.RingUtils: (<$>) :: Functor f => (a -> b) -> f a -> f b
- Algebra.RingUtils: (<) :: Ord a => a -> a -> Bool
- Algebra.RingUtils: (<*) :: Applicative f => f a -> f b -> f a
- Algebra.RingUtils: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
- Algebra.RingUtils: (<=) :: Ord a => a -> a -> Bool
- Algebra.RingUtils: (<>) :: Semigroup a => a -> a -> a
- Algebra.RingUtils: (=<<) :: Monad m => (a -> m b) -> m a -> m b
- Algebra.RingUtils: (==) :: Eq a => a -> a -> Bool
- Algebra.RingUtils: (>) :: Ord a => a -> a -> Bool
- Algebra.RingUtils: (>=) :: Ord a => a -> a -> Bool
- Algebra.RingUtils: (>>) :: Monad m => m a -> m b -> m b
- Algebra.RingUtils: (>>=) :: Monad m => m a -> (a -> m b) -> m b
- Algebra.RingUtils: (^) :: (Num a, Integral b) => a -> b -> a
- Algebra.RingUtils: (^^) :: (Fractional a, Integral b) => a -> b -> a
- Algebra.RingUtils: (||) :: Bool -> Bool -> Bool
- Algebra.RingUtils: EQ :: Ordering
- Algebra.RingUtils: False :: Bool
- Algebra.RingUtils: GT :: Ordering
- Algebra.RingUtils: Just :: a -> Maybe a
- Algebra.RingUtils: LT :: Ordering
- Algebra.RingUtils: Left :: a -> Either a b
- Algebra.RingUtils: Nothing :: Maybe a
- Algebra.RingUtils: O :: f (g a) -> O f g a
- Algebra.RingUtils: Right :: b -> Either a b
- Algebra.RingUtils: True :: Bool
- Algebra.RingUtils: [fromO] :: O f g a -> f (g a)
- Algebra.RingUtils: [leftOf] :: Pair a -> a
- Algebra.RingUtils: [rightOf] :: Pair a -> a
- Algebra.RingUtils: abs :: Num a => a -> a
- Algebra.RingUtils: acos :: Floating a => a -> a
- Algebra.RingUtils: acosh :: Floating a => a -> a
- Algebra.RingUtils: all :: Foldable t => (a -> Bool) -> t a -> Bool
- Algebra.RingUtils: and :: Foldable t => t Bool -> Bool
- Algebra.RingUtils: any :: Foldable t => (a -> Bool) -> t a -> Bool
- Algebra.RingUtils: appendFile :: FilePath -> String -> IO ()
- Algebra.RingUtils: asTypeOf :: () => a -> a -> a
- Algebra.RingUtils: asin :: Floating a => a -> a
- Algebra.RingUtils: asinh :: Floating a => a -> a
- Algebra.RingUtils: atan :: Floating a => a -> a
- Algebra.RingUtils: atan2 :: RealFloat a => a -> a -> a
- Algebra.RingUtils: atanh :: Floating a => a -> a
- Algebra.RingUtils: break :: () => (a -> Bool) -> [a] -> ([a], [a])
- Algebra.RingUtils: ceiling :: (RealFrac a, Integral b) => a -> b
- Algebra.RingUtils: class AbelianGroup a
- Algebra.RingUtils: class AbelianGroup a => AbelianGroupZ a
- Algebra.RingUtils: class Functor f => Applicative (f :: Type -> Type)
- Algebra.RingUtils: class Bounded a
- Algebra.RingUtils: class Enum a
- Algebra.RingUtils: class Eq a
- Algebra.RingUtils: class Fractional a => Floating a
- Algebra.RingUtils: class Foldable (t :: Type -> Type)
- Algebra.RingUtils: class Num a => Fractional a
- Algebra.RingUtils: class Functor (f :: Type -> Type)
- Algebra.RingUtils: class (Real a, Enum a) => Integral a
- Algebra.RingUtils: class Applicative m => Monad (m :: Type -> Type)
- Algebra.RingUtils: class Semigroup a => Monoid a
- Algebra.RingUtils: class Num a
- Algebra.RingUtils: class Eq a => Ord a
- Algebra.RingUtils: class Read a
- Algebra.RingUtils: class (Num a, Ord a) => Real a
- Algebra.RingUtils: class (RealFrac a, Floating a) => RealFloat a
- Algebra.RingUtils: class (Real a, Fractional a) => RealFrac a
- Algebra.RingUtils: class AbelianGroupZ a => Ring a
- Algebra.RingUtils: class (AbelianGroupZ a) => RingP a
- Algebra.RingUtils: class Semigroup a
- Algebra.RingUtils: class Show a
- Algebra.RingUtils: class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
- Algebra.RingUtils: compare :: Ord a => a -> a -> Ordering
- Algebra.RingUtils: concat :: Foldable t => t [a] -> [a]
- Algebra.RingUtils: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- Algebra.RingUtils: const :: () => a -> b -> a
- Algebra.RingUtils: cos :: Floating a => a -> a
- Algebra.RingUtils: cosh :: Floating a => a -> a
- Algebra.RingUtils: curry :: () => ((a, b) -> c) -> a -> b -> c
- Algebra.RingUtils: cycle :: () => [a] -> [a]
- Algebra.RingUtils: data Bool
- Algebra.RingUtils: data Char
- Algebra.RingUtils: data Double
- Algebra.RingUtils: data Either a b
- Algebra.RingUtils: data Float
- Algebra.RingUtils: data IO a
- Algebra.RingUtils: data Int
- Algebra.RingUtils: data Integer
- Algebra.RingUtils: data Maybe a
- Algebra.RingUtils: data Ordering
- Algebra.RingUtils: data Pair a
- Algebra.RingUtils: data Word
- Algebra.RingUtils: decodeFloat :: RealFloat a => a -> (Integer, Int)
- Algebra.RingUtils: div :: Integral a => a -> a -> a
- Algebra.RingUtils: divMod :: Integral a => a -> a -> (a, a)
- Algebra.RingUtils: drop :: () => Int -> [a] -> [a]
- Algebra.RingUtils: dropWhile :: () => (a -> Bool) -> [a] -> [a]
- Algebra.RingUtils: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
- Algebra.RingUtils: elem :: (Foldable t, Eq a) => a -> t a -> Bool
- Algebra.RingUtils: encodeFloat :: RealFloat a => Integer -> Int -> a
- Algebra.RingUtils: enumFrom :: Enum a => a -> [a]
- Algebra.RingUtils: enumFromThen :: Enum a => a -> a -> [a]
- Algebra.RingUtils: enumFromThenTo :: Enum a => a -> a -> a -> [a]
- Algebra.RingUtils: enumFromTo :: Enum a => a -> a -> [a]
- Algebra.RingUtils: error :: HasCallStack => [Char] -> a
- Algebra.RingUtils: errorWithoutStackTrace :: () => [Char] -> a
- Algebra.RingUtils: even :: Integral a => a -> Bool
- Algebra.RingUtils: exp :: Floating a => a -> a
- Algebra.RingUtils: exponent :: RealFloat a => a -> Int
- Algebra.RingUtils: fail :: Monad m => String -> m a
- Algebra.RingUtils: filter :: () => (a -> Bool) -> [a] -> [a]
- Algebra.RingUtils: flip :: () => (a -> b -> c) -> b -> a -> c
- Algebra.RingUtils: floatDigits :: RealFloat a => a -> Int
- Algebra.RingUtils: floatRadix :: RealFloat a => a -> Integer
- Algebra.RingUtils: floatRange :: RealFloat a => a -> (Int, Int)
- Algebra.RingUtils: floor :: (RealFrac a, Integral b) => a -> b
- Algebra.RingUtils: fmap :: Functor f => (a -> b) -> f a -> f b
- Algebra.RingUtils: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Algebra.RingUtils: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Algebra.RingUtils: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- Algebra.RingUtils: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Algebra.RingUtils: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- Algebra.RingUtils: fromEnum :: Enum a => a -> Int
- Algebra.RingUtils: fromInteger :: Num a => Integer -> a
- Algebra.RingUtils: fromIntegral :: (Integral a, Num b) => a -> b
- Algebra.RingUtils: fromRational :: Fractional a => Rational -> a
- Algebra.RingUtils: fst :: () => (a, b) -> a
- Algebra.RingUtils: gcd :: Integral a => a -> a -> a
- Algebra.RingUtils: getChar :: IO Char
- Algebra.RingUtils: getContents :: IO String
- Algebra.RingUtils: getLine :: IO String
- Algebra.RingUtils: head :: () => [a] -> a
- Algebra.RingUtils: id :: () => a -> a
- Algebra.RingUtils: infix 4 `notElem`
- Algebra.RingUtils: infixl 1 >>
- Algebra.RingUtils: infixl 2 :/:
- Algebra.RingUtils: infixl 4 <$>
- Algebra.RingUtils: infixl 6 +
- Algebra.RingUtils: infixl 7 *
- Algebra.RingUtils: infixl 9 !!
- Algebra.RingUtils: infixr 0 $!
- Algebra.RingUtils: infixr 1 =<<
- Algebra.RingUtils: infixr 2 ||
- Algebra.RingUtils: infixr 3 &&
- Algebra.RingUtils: infixr 5 ++
- Algebra.RingUtils: infixr 6 <>
- Algebra.RingUtils: infixr 8 ^
- Algebra.RingUtils: infixr 9 .
- Algebra.RingUtils: init :: () => [a] -> [a]
- Algebra.RingUtils: instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (Algebra.RingUtils.O f g)
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroup (f (g a)) => Algebra.RingUtils.AbelianGroup (Algebra.RingUtils.O f g a)
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroup GHC.Types.Bool
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroup GHC.Types.Int
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroup a => Algebra.RingUtils.AbelianGroup (Data.Pair.Pair a)
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroupZ (f (g a)) => Algebra.RingUtils.AbelianGroupZ (Algebra.RingUtils.O f g a)
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroupZ GHC.Types.Int
- Algebra.RingUtils: instance Algebra.RingUtils.AbelianGroupZ a => Algebra.RingUtils.AbelianGroupZ (Data.Pair.Pair a)
- Algebra.RingUtils: instance Algebra.RingUtils.Ring GHC.Types.Int
- Algebra.RingUtils: instance GHC.Show.Show (f (g a)) => GHC.Show.Show (Algebra.RingUtils.O f g a)
- Algebra.RingUtils: interact :: (String -> String) -> IO ()
- Algebra.RingUtils: ioError :: () => IOError -> IO a
- Algebra.RingUtils: isDenormalized :: RealFloat a => a -> Bool
- Algebra.RingUtils: isIEEE :: RealFloat a => a -> Bool
- Algebra.RingUtils: isInfinite :: RealFloat a => a -> Bool
- Algebra.RingUtils: isNaN :: RealFloat a => a -> Bool
- Algebra.RingUtils: isNegativeZero :: RealFloat a => a -> Bool
- Algebra.RingUtils: isZero :: AbelianGroupZ a => a -> Bool
- Algebra.RingUtils: iterate :: () => (a -> a) -> a -> [a]
- Algebra.RingUtils: last :: () => [a] -> a
- Algebra.RingUtils: lcm :: Integral a => a -> a -> a
- Algebra.RingUtils: length :: Foldable t => t a -> Int
- Algebra.RingUtils: lex :: ReadS String
- Algebra.RingUtils: lines :: String -> [String]
- Algebra.RingUtils: log :: Floating a => a -> a
- Algebra.RingUtils: logBase :: Floating a => a -> a -> a
- Algebra.RingUtils: lookup :: Eq a => a -> [(a, b)] -> Maybe b
- Algebra.RingUtils: map :: () => (a -> b) -> [a] -> [b]
- Algebra.RingUtils: mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- Algebra.RingUtils: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- Algebra.RingUtils: mappend :: Monoid a => a -> a -> a
- Algebra.RingUtils: max :: Ord a => a -> a -> a
- Algebra.RingUtils: maxBound :: Bounded a => a
- Algebra.RingUtils: maximum :: (Foldable t, Ord a) => t a -> a
- Algebra.RingUtils: maybe :: () => b -> (a -> b) -> Maybe a -> b
- Algebra.RingUtils: mconcat :: Monoid a => [a] -> a
- Algebra.RingUtils: mempty :: Monoid a => a
- Algebra.RingUtils: min :: Ord a => a -> a -> a
- Algebra.RingUtils: minBound :: Bounded a => a
- Algebra.RingUtils: minimum :: (Foldable t, Ord a) => t a -> a
- Algebra.RingUtils: mod :: Integral a => a -> a -> a
- Algebra.RingUtils: mul :: RingP a => Bool -> a -> a -> Pair a
- Algebra.RingUtils: mulDefault :: RingP a => a -> a -> a
- Algebra.RingUtils: negate :: Num a => a -> a
- Algebra.RingUtils: newtype O f g a
- Algebra.RingUtils: not :: Bool -> Bool
- Algebra.RingUtils: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- Algebra.RingUtils: null :: Foldable t => t a -> Bool
- Algebra.RingUtils: odd :: Integral a => a -> Bool
- Algebra.RingUtils: onlyLeft :: () => [a] -> Pair [a]
- Algebra.RingUtils: onlyRight :: () => [a] -> Pair [a]
- Algebra.RingUtils: or :: Foldable t => t Bool -> Bool
- Algebra.RingUtils: otherwise :: Bool
- Algebra.RingUtils: pi :: Floating a => a
- Algebra.RingUtils: pred :: Enum a => a -> a
- Algebra.RingUtils: print :: Show a => a -> IO ()
- Algebra.RingUtils: product :: (Foldable t, Num a) => t a -> a
- Algebra.RingUtils: properFraction :: (RealFrac a, Integral b) => a -> (b, a)
- Algebra.RingUtils: pure :: Applicative f => a -> f a
- Algebra.RingUtils: putChar :: Char -> IO ()
- Algebra.RingUtils: putStr :: String -> IO ()
- Algebra.RingUtils: putStrLn :: String -> IO ()
- Algebra.RingUtils: quot :: Integral a => a -> a -> a
- Algebra.RingUtils: quotRem :: Integral a => a -> a -> (a, a)
- Algebra.RingUtils: read :: Read a => String -> a
- Algebra.RingUtils: readFile :: FilePath -> IO String
- Algebra.RingUtils: readIO :: Read a => String -> IO a
- Algebra.RingUtils: readList :: Read a => ReadS [a]
- Algebra.RingUtils: readLn :: Read a => IO a
- Algebra.RingUtils: readParen :: () => Bool -> ReadS a -> ReadS a
- Algebra.RingUtils: reads :: Read a => ReadS a
- Algebra.RingUtils: readsPrec :: Read a => Int -> ReadS a
- Algebra.RingUtils: realToFrac :: (Real a, Fractional b) => a -> b
- Algebra.RingUtils: recip :: Fractional a => a -> a
- Algebra.RingUtils: rem :: Integral a => a -> a -> a
- Algebra.RingUtils: repeat :: () => a -> [a]
- Algebra.RingUtils: replicate :: () => Int -> a -> [a]
- Algebra.RingUtils: return :: Monad m => a -> m a
- Algebra.RingUtils: reverse :: () => [a] -> [a]
- Algebra.RingUtils: round :: (RealFrac a, Integral b) => a -> b
- Algebra.RingUtils: scaleFloat :: RealFloat a => Int -> a -> a
- Algebra.RingUtils: scanl :: () => (b -> a -> b) -> b -> [a] -> [b]
- Algebra.RingUtils: scanl1 :: () => (a -> a -> a) -> [a] -> [a]
- Algebra.RingUtils: scanr :: () => (a -> b -> b) -> b -> [a] -> [b]
- Algebra.RingUtils: scanr1 :: () => (a -> a -> a) -> [a] -> [a]
- Algebra.RingUtils: select :: () => Bool -> [a] -> Pair [a]
- Algebra.RingUtils: seq :: () => a -> b -> b
- Algebra.RingUtils: sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
- Algebra.RingUtils: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
- Algebra.RingUtils: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- Algebra.RingUtils: show :: Show a => a -> String
- Algebra.RingUtils: showChar :: Char -> ShowS
- Algebra.RingUtils: showList :: Show a => [a] -> ShowS
- Algebra.RingUtils: showParen :: Bool -> ShowS -> ShowS
- Algebra.RingUtils: showString :: String -> ShowS
- Algebra.RingUtils: shows :: Show a => a -> ShowS
- Algebra.RingUtils: showsPrec :: Show a => Int -> a -> ShowS
- Algebra.RingUtils: significand :: RealFloat a => a -> a
- Algebra.RingUtils: signum :: Num a => a -> a
- Algebra.RingUtils: sin :: Floating a => a -> a
- Algebra.RingUtils: sinh :: Floating a => a -> a
- Algebra.RingUtils: snd :: () => (a, b) -> b
- Algebra.RingUtils: span :: () => (a -> Bool) -> [a] -> ([a], [a])
- Algebra.RingUtils: sqrt :: Floating a => a -> a
- Algebra.RingUtils: subtract :: Num a => a -> a -> a
- Algebra.RingUtils: succ :: Enum a => a -> a
- Algebra.RingUtils: sum :: AbelianGroup a => [a] -> a
- Algebra.RingUtils: tail :: () => [a] -> [a]
- Algebra.RingUtils: take :: () => Int -> [a] -> [a]
- Algebra.RingUtils: takeWhile :: () => (a -> Bool) -> [a] -> [a]
- Algebra.RingUtils: tan :: Floating a => a -> a
- Algebra.RingUtils: tanh :: Floating a => a -> a
- Algebra.RingUtils: toEnum :: Enum a => Int -> a
- Algebra.RingUtils: toInteger :: Integral a => a -> Integer
- Algebra.RingUtils: toRational :: Real a => a -> Rational
- Algebra.RingUtils: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- Algebra.RingUtils: truncate :: (RealFrac a, Integral b) => a -> b
- Algebra.RingUtils: type FilePath = String
- Algebra.RingUtils: type IOError = IOException
- Algebra.RingUtils: type Rational = Ratio Integer
- Algebra.RingUtils: type ReadS a = String -> [(a, String)]
- Algebra.RingUtils: type ShowS = String -> String
- Algebra.RingUtils: type String = [Char]
- Algebra.RingUtils: uncurry :: () => (a -> b -> c) -> (a, b) -> c
- Algebra.RingUtils: undefined :: HasCallStack => a
- Algebra.RingUtils: unlines :: [String] -> String
- Algebra.RingUtils: until :: () => (a -> Bool) -> (a -> a) -> a -> a
- Algebra.RingUtils: unwords :: [String] -> String
- Algebra.RingUtils: unzip :: () => [(a, b)] -> ([a], [b])
- Algebra.RingUtils: unzip3 :: () => [(a, b, c)] -> ([a], [b], [c])
- Algebra.RingUtils: userError :: String -> IOError
- Algebra.RingUtils: words :: String -> [String]
- Algebra.RingUtils: writeFile :: FilePath -> String -> IO ()
- Algebra.RingUtils: zero :: AbelianGroup a => a
- Algebra.RingUtils: zip :: () => [a] -> [b] -> [(a, b)]
- Algebra.RingUtils: zip3 :: () => [a] -> [b] -> [c] -> [(a, b, c)]
- Algebra.RingUtils: zipWith :: () => (a -> b -> c) -> [a] -> [b] -> [c]
- Algebra.RingUtils: zipWith3 :: () => (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- Data.Matrix.Class: (***) :: () => (t1 -> a) -> (t2 -> b) -> (t1, t2) -> (a, b)
- Data.Matrix.Class: (<->) :: (AbelianGroup a, Matrix m) => m a -> m a -> m a
- Data.Matrix.Class: (<|>) :: (AbelianGroup a, Matrix m) => m a -> m a -> m a
- Data.Matrix.Class: XD :: Dimension
- Data.Matrix.Class: YD :: Dimension
- Data.Matrix.Class: at :: (Matrix m, AbelianGroupZ a) => Int -> Int -> m a -> a
- Data.Matrix.Class: chopFirstColumn :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: chopFirstRow :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: chopLastColumn :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: chopLastRow :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: class Matrix m
- Data.Matrix.Class: countColumns :: Matrix m => m a -> Int
- Data.Matrix.Class: countRows :: Matrix m => m a -> Int
- Data.Matrix.Class: data Dimension
- Data.Matrix.Class: ext :: () => Dimension -> (p, p) -> p
- Data.Matrix.Class: extent :: Matrix m => m a -> Extent
- Data.Matrix.Class: fingerprint :: (AbelianGroupZ a, Matrix m) => m a -> [[Char]]
- Data.Matrix.Class: firstRow :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: glue :: (Matrix m, AbelianGroup a) => Dimension -> m a -> m a -> m a
- Data.Matrix.Class: glueExt :: (AbelianGroup a1, AbelianGroup a2) => Dimension -> (a1, a2) -> (a1, a2) -> (a1, a2)
- Data.Matrix.Class: instance Data.Matrix.Class.Matrix m => Data.Matrix.Class.Matrix (Algebra.RingUtils.O Data.Pair.Pair m)
- Data.Matrix.Class: instance GHC.Classes.Eq Data.Matrix.Class.Dimension
- Data.Matrix.Class: instance GHC.Show.Show Data.Matrix.Class.Dimension
- Data.Matrix.Class: lastColumn :: (AbelianGroupZ a, Matrix m) => m a -> m a
- Data.Matrix.Class: nextDim :: Dimension -> Dimension
- Data.Matrix.Class: quad :: (AbelianGroup a, Matrix m) => m a -> m a -> m a -> m a -> m a
- Data.Matrix.Class: singleton :: (Matrix m, AbelianGroupZ a) => a -> m a
- Data.Matrix.Class: split :: (Matrix m, AbelianGroupZ a) => Dimension -> Int -> m a -> (m a, m a)
- Data.Matrix.Class: splitExt :: Num a => Dimension -> a -> (a, a) -> ((a, a), (a, a))
- Data.Matrix.Class: type Extent = (Int, Int)
- Data.Matrix.Class: zeroMatrix :: (Matrix m, AbelianGroup a) => Int -> Int -> m a
- Data.Matrix.Quad: (-+-) :: () => [a] -> [a] -> [a]
- Data.Matrix.Quad: (.+.) :: AbelianGroupZ a => Mat x y a -> Mat x y a -> Mat x y a
- Data.Matrix.Quad: (<||>) :: Maybe (a, Path x) -> Maybe (a, Path x') -> Maybe (a, Path (Bin x x'))
- Data.Matrix.Quad: (|+|) :: () => [[a]] -> [[a]] -> [[a]]
- Data.Matrix.Quad: Bin :: Shape -> Shape -> Shape
- Data.Matrix.Quad: Leaf :: Shape
- Data.Matrix.Quad: [:!] :: Vec s a -> Vec s' a -> Vec (Bin s s') a
- Data.Matrix.Quad: [Bin'] :: !Int -> Shape' s -> Shape' s' -> Shape' (Bin s s')
- Data.Matrix.Quad: [Col] :: Mat Leaf y1 a -> Mat Leaf y2 a -> Mat Leaf (Bin y1 y2) a
- Data.Matrix.Quad: [Here] :: Path Leaf
- Data.Matrix.Quad: [High] :: Path s -> Path (Bin s' s)
- Data.Matrix.Quad: [Leaf'] :: Shape' Leaf
- Data.Matrix.Quad: [Low] :: Path s -> Path (Bin s s')
- Data.Matrix.Quad: [O] :: a -> Vec Leaf a
- Data.Matrix.Quad: [One] :: !a -> Mat Leaf Leaf a
- Data.Matrix.Quad: [Quad] :: !Mat x1 y1 a -> !Mat x2 y1 a -> !Mat x1 y2 a -> !Mat x2 y2 a -> Mat (Bin x1 x2) (Bin y1 y2) a
- Data.Matrix.Quad: [Row] :: Mat x1 Leaf a -> Mat x2 Leaf a -> Mat (Bin x1 x2) Leaf a
- Data.Matrix.Quad: [S] :: Shape' s -> SomeShape
- Data.Matrix.Quad: [T] :: Shape' s -> Pair (Mat s s a) -> SomeTri a
- Data.Matrix.Quad: [Z] :: Vec s a
- Data.Matrix.Quad: [Zero] :: Mat x y a
- Data.Matrix.Quad: bin' :: Shape' s -> Shape' s' -> Shape' (Bin s s')
- Data.Matrix.Quad: close :: RingP a => Bool -> Mat s s (Pair a) -> Pair (Mat s s a)
- Data.Matrix.Quad: closeDisjointP :: RingP a => Bool -> Mat x x a -> Mat y x (Pair a) -> Mat y y a -> Pair (Mat y x a)
- Data.Matrix.Quad: col :: Mat Leaf y1 a -> Mat Leaf y2 a -> Mat Leaf (Bin y1 y2) a
- Data.Matrix.Quad: contents :: Shape' x -> Vec x a -> [(Int, a)]
- Data.Matrix.Quad: data Mat :: Shape -> Shape -> * -> *
- Data.Matrix.Quad: data Path :: Shape -> *
- Data.Matrix.Quad: data Shape
- Data.Matrix.Quad: data Shape' :: Shape -> *
- Data.Matrix.Quad: data SomeShape
- Data.Matrix.Quad: data SomeTri a
- Data.Matrix.Quad: data Vec :: Shape -> * -> *
- Data.Matrix.Quad: fingerprint :: AbelianGroupZ a => SomeTri a -> [[Char]]
- Data.Matrix.Quad: first :: () => (t -> a) -> (t, b) -> (a, b)
- Data.Matrix.Quad: fromPath :: Shape' y -> Path y -> Int
- Data.Matrix.Quad: instance Algebra.RingUtils.AbelianGroup a => Algebra.RingUtils.AbelianGroup (Data.Matrix.Quad.Vec x a)
- Data.Matrix.Quad: instance Algebra.RingUtils.AbelianGroupZ a => Algebra.RingUtils.AbelianGroup (Data.Matrix.Quad.Mat x y a)
- Data.Matrix.Quad: isRightmost :: Path x -> Bool
- Data.Matrix.Quad: leftMost :: Shape' s -> Path s
- Data.Matrix.Quad: lin :: AbelianGroup a => Shape' x -> Shape' y -> Mat x y a -> [[a]]
- Data.Matrix.Quad: lin' :: AbelianGroup a => Mat x y a -> Vec y (Vec x a)
- Data.Matrix.Quad: lk :: AbelianGroup a => Int -> Shape' x -> Vec x a -> a
- Data.Matrix.Quad: mergein :: RingP a => Bool -> SomeTri a -> Pair a -> SomeTri a -> SomeTri a
- Data.Matrix.Quad: mkShape :: Int -> SomeShape
- Data.Matrix.Quad: mkSing :: AbelianGroupZ a => Shape' x -> Shape' y -> a -> Mat x y a
- Data.Matrix.Quad: mkTree :: RingP a => [Pair a] -> SomeTri a
- Data.Matrix.Quad: mkUpDiag :: AbelianGroupZ a => [a] -> Shape' s -> Mat s s a
- Data.Matrix.Quad: mult :: RingP a => Bool -> Mat x y a -> Mat z x a -> Mat z y (Pair a)
- Data.Matrix.Quad: one :: AbelianGroupZ a => a -> Mat Leaf Leaf a
- Data.Matrix.Quad: q0 :: Mat (Bin x x') (Bin y y') a
- Data.Matrix.Quad: quad :: () => Mat x1 y1 a -> Mat x2 y1 a -> Mat x1 y2 a -> Mat x2 y2 a -> Mat (Bin x1 x2) (Bin y1 y2) a
- Data.Matrix.Quad: quad' :: Applicative f => f (Mat x1 y1 a) -> f (Mat x2 y1 a) -> f (Mat x1 y2 a) -> f (Mat x2 y2 a) -> f (Mat (Bin x1 x2) (Bin y1 y2) a)
- Data.Matrix.Quad: results :: AbelianGroupZ a => SomeTri a -> [(Int, a, Int)]
- Data.Matrix.Quad: results' :: AbelianGroup a => Mat y y a -> Path y -> [(Path y, a, Path y)]
- Data.Matrix.Quad: rightmostOnLine :: Path y -> Mat x y a -> Maybe (a, Path x)
- Data.Matrix.Quad: root :: AbelianGroup p => SomeTri p -> p
- Data.Matrix.Quad: root' :: AbelianGroup a => Mat x y a -> a
- Data.Matrix.Quad: row :: () => Mat x1 Leaf a -> Mat x2 Leaf a -> Mat (Bin x1 x2) Leaf a
- Data.Matrix.Quad: scatterplot :: AbelianGroup a => SomeTri a -> [Char]
- Data.Matrix.Quad: second :: () => (t -> b) -> (a, t) -> (a, b)
- Data.Matrix.Quad: shiftX :: () => Shape' s -> [(Int, b, c)] -> [(Int, b, c)]
- Data.Matrix.Quad: shiftY :: () => Shape' s -> [(a, Int, c)] -> [(a, Int, c)]
- Data.Matrix.Quad: showR :: Mat x y a -> String
- Data.Matrix.Quad: single :: AbelianGroupZ a => Pair a -> SomeTri a
- Data.Matrix.Quad: sparse :: AbelianGroup a => Shape' x -> Shape' y -> Mat x y a -> [(Int, Int, a)]
- Data.Matrix.Quad: square2 :: AbelianGroupZ a => Pair a -> SomeTri a
- Data.Matrix.Quad: square3 :: RingP a => Bool -> Pair a -> Pair a -> SomeTri a
- Data.Matrix.Quad: sz' :: Shape' s -> Int
- Data.Matrix.Quad: trav :: AbelianGroupZ a => Mat y x (Pair a) -> Pair (Mat y x a)
- Data.Matrix.Quad: type Q a = SomeTri a
- Data.Matrix.Quad: zw :: (AbelianGroup a, AbelianGroup b) => (a -> b -> c) -> Vec y a -> Vec y b -> Vec y c
- Data.Pair: (:/:) :: a -> a -> Pair a
- Data.Pair: [leftOf] :: Pair a -> a
- Data.Pair: [rightOf] :: Pair a -> a
- Data.Pair: data Pair a
- Data.Pair: infixl 2 :/:
- Data.Pair: instance GHC.Base.Applicative Data.Pair.Pair
- Data.Pair: instance GHC.Base.Functor Data.Pair.Pair
- Data.Pair: instance GHC.Show.Show a => GHC.Show.Show (Data.Pair.Pair a)
- Parsing.Chart: fingerprint :: AbelianGroupZ a => SomeTri a -> [[Char]]
- Parsing.Chart: genXPM :: [[Char]] -> String
- Parsing.Chart: instance Algebra.RingUtils.AbelianGroup (Parsing.Chart.Set a)
- Parsing.Chart: instance Algebra.RingUtils.AbelianGroupZ (Parsing.Chart.Set a)
- Parsing.Chart: mergein :: RingP a => Bool -> SomeTri a -> Pair a -> SomeTri a -> SomeTri a
- Parsing.Chart: mkTree :: RingP a => [Pair a] -> Q a
- Parsing.Chart: mkTree' :: RingP a => [Pair a] -> Q a
- Parsing.Chart: mkTree2 :: RingP a => Bool -> [Pair a] -> Q a
- Parsing.Chart: root :: AbelianGroup p => SomeTri p -> p
- Parsing.Chart: single :: AbelianGroupZ a => Pair a -> SomeTri a
- Parsing.Chart: type MT2 a = Q a
- Parsing.Chart: type Set a = [a]
- Parsing.TestProgram: mainTest :: forall category token. (RingP [(category, Any)], Eq category) => ((category, Any) -> String) -> (Bool -> token -> Pair [(category, Any)]) -> (String -> [token]) -> (token -> (Int, Int)) -> (category -> String) -> (category -> [category]) -> IO ()
- Parsing.TestProgram: pairs :: () => [a] -> [(a, a)]
- Parsing.TestProgram: putStrV :: Verbosity -> String -> IO ()
- Parsing.TestProgram: resSz :: Num a => (a, b, a) -> a
- Parsing.TestProgram: type Verbosity = Int
+ BNFC.Abs: App :: Identifier -> [Exp] -> Exp
+ BNFC.Abs: Arg :: Identifier -> Arg
+ BNFC.Abs: Coercions :: Identifier -> Integer -> Def
+ BNFC.Abs: Comment :: String -> Def
+ BNFC.Abs: Comments :: String -> String -> Def
+ BNFC.Abs: Cons :: Exp -> Exp -> Exp
+ BNFC.Abs: Delimiters :: Cat -> String -> String -> Separation -> MinimumSize -> Def
+ BNFC.Abs: Entryp :: [Cat] -> Def
+ BNFC.Abs: Function :: Identifier -> [Arg] -> Exp -> Def
+ BNFC.Abs: Grammar :: [Def] -> Grammar
+ BNFC.Abs: Id :: Identifier -> Label
+ BNFC.Abs: IdCat :: Identifier -> Cat
+ BNFC.Abs: Identifier :: ((Int, Int), String) -> Identifier
+ BNFC.Abs: Internal :: Label -> Cat -> [Item] -> Def
+ BNFC.Abs: Layout :: [String] -> Def
+ BNFC.Abs: LayoutStop :: [String] -> Def
+ BNFC.Abs: LayoutTop :: Def
+ BNFC.Abs: List :: [Exp] -> Exp
+ BNFC.Abs: ListCat :: Cat -> Cat
+ BNFC.Abs: ListCons :: Label
+ BNFC.Abs: ListE :: Label
+ BNFC.Abs: ListOne :: Label
+ BNFC.Abs: LitChar :: Char -> Exp
+ BNFC.Abs: LitDouble :: Double -> Exp
+ BNFC.Abs: LitInt :: Integer -> Exp
+ BNFC.Abs: LitString :: String -> Exp
+ BNFC.Abs: MEmpty :: MinimumSize
+ BNFC.Abs: MNonempty :: MinimumSize
+ BNFC.Abs: NTerminal :: Cat -> Item
+ BNFC.Abs: PosToken :: Identifier -> Reg -> Def
+ BNFC.Abs: RAlt :: Reg -> Reg -> Reg
+ BNFC.Abs: RAlts :: String -> Reg
+ BNFC.Abs: RAny :: Reg
+ BNFC.Abs: RChar :: Char -> Reg
+ BNFC.Abs: RDigit :: Reg
+ BNFC.Abs: REps :: Reg
+ BNFC.Abs: RHS :: [Item] -> RHS
+ BNFC.Abs: RLetter :: Reg
+ BNFC.Abs: RLower :: Reg
+ BNFC.Abs: RMinus :: Reg -> Reg -> Reg
+ BNFC.Abs: ROpt :: Reg -> Reg
+ BNFC.Abs: RPlus :: Reg -> Reg
+ BNFC.Abs: RSeq :: Reg -> Reg -> Reg
+ BNFC.Abs: RSeqs :: String -> Reg
+ BNFC.Abs: RStar :: Reg -> Reg
+ BNFC.Abs: RUpper :: Reg
+ BNFC.Abs: Rule :: Label -> Cat -> [Item] -> Def
+ BNFC.Abs: Rules :: Identifier -> [RHS] -> Def
+ BNFC.Abs: SepNone :: Separation
+ BNFC.Abs: SepSepar :: String -> Separation
+ BNFC.Abs: SepTerm :: String -> Separation
+ BNFC.Abs: Separator :: MinimumSize -> Cat -> String -> Def
+ BNFC.Abs: Terminal :: String -> Item
+ BNFC.Abs: Terminator :: MinimumSize -> Cat -> String -> Def
+ BNFC.Abs: Token :: Identifier -> Reg -> Def
+ BNFC.Abs: Var :: Identifier -> Exp
+ BNFC.Abs: Wild :: Label
+ BNFC.Abs: data Arg
+ BNFC.Abs: data Cat
+ BNFC.Abs: data Def
+ BNFC.Abs: data Exp
+ BNFC.Abs: data Grammar
+ BNFC.Abs: data Item
+ BNFC.Abs: data Label
+ BNFC.Abs: data MinimumSize
+ BNFC.Abs: data RHS
+ BNFC.Abs: data Reg
+ BNFC.Abs: data Separation
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Arg
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Cat
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Def
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Exp
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Grammar
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Identifier
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Item
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Label
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.MinimumSize
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.RHS
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Reg
+ BNFC.Abs: instance GHC.Classes.Eq BNFC.Abs.Separation
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Arg
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Cat
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Def
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Exp
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Grammar
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Identifier
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Item
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Label
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.MinimumSize
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.RHS
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Reg
+ BNFC.Abs: instance GHC.Classes.Ord BNFC.Abs.Separation
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Arg
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Cat
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Def
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Exp
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Grammar
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Identifier
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Item
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Label
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.MinimumSize
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.RHS
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Reg
+ BNFC.Abs: instance GHC.Read.Read BNFC.Abs.Separation
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Arg
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Cat
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Def
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Exp
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Grammar
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Identifier
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Item
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Label
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.MinimumSize
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.RHS
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Reg
+ BNFC.Abs: instance GHC.Show.Show BNFC.Abs.Separation
+ BNFC.Abs: newtype Identifier
+ BNFC.Backend.Agda: instance GHC.Classes.Eq BNFC.Backend.Agda.ImportNumeric
+ BNFC.Backend.Agda: makeAgda :: String -> SharedOptions -> CF -> Backend
+ BNFC.Backend.Base: execBackend :: MkFiles () -> IO [(FilePath, String)]
+ BNFC.Backend.Base: instance BNFC.Backend.Base.FileContent Text.PrettyPrint.HughesPJ.Doc
+ BNFC.Backend.Base: instance BNFC.Backend.Base.FileContent [GHC.Types.Char]
+ BNFC.Backend.Base: liftIO :: MonadIO m => IO a -> m a
+ BNFC.Backend.Base: mkfile :: FileContent c => FilePath -> c -> MkFiles ()
+ BNFC.Backend.Base: type Backend = MkFiles ()
+ BNFC.Backend.Base: type MkFiles a = WriterT [(FilePath, String)] IO a
+ BNFC.Backend.Base: writeFiles :: FilePath -> MkFiles () -> IO ()
+ BNFC.Backend.C: bufferC :: String -> String
+ BNFC.Backend.C: bufferH :: String
+ BNFC.Backend.C: makeC :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.C.CFtoBisonC: cf2Bison :: RecordPositions -> String -> CF -> SymMap -> String
+ BNFC.Backend.C.CFtoBisonC: mkPointer :: Cat -> [String]
+ BNFC.Backend.C.CFtoBisonC: resultName :: String -> String
+ BNFC.Backend.C.CFtoBisonC: specialToks :: CF -> String
+ BNFC.Backend.C.CFtoBisonC: startSymbol :: CF -> String
+ BNFC.Backend.C.CFtoBisonC: typeName :: String -> String
+ BNFC.Backend.C.CFtoBisonC: unionBuiltinTokens :: [String]
+ BNFC.Backend.C.CFtoBisonC: varName :: Cat -> String
+ BNFC.Backend.C.CFtoCAbs: cf2CAbs :: RecordPositions -> String -> CF -> (String, String)
+ BNFC.Backend.C.CFtoCPrinter: cf2CPrinter :: CF -> (String, String)
+ BNFC.Backend.C.CFtoCSkel: cf2CSkel :: CF -> (String, String)
+ BNFC.Backend.C.CFtoFlexC: cMacros :: CF -> String
+ BNFC.Backend.C.CFtoFlexC: cf2flex :: String -> CF -> (String, SymMap)
+ BNFC.Backend.C.CFtoFlexC: commentStates :: [String]
+ BNFC.Backend.C.CFtoFlexC: lexChars :: String -> String -> [String]
+ BNFC.Backend.C.CFtoFlexC: lexComments :: Maybe String -> ([(String, String)], [String]) -> Doc
+ BNFC.Backend.C.CFtoFlexC: lexStrings :: String -> String -> String -> [String]
+ BNFC.Backend.C.CFtoFlexC: preludeForBuffer :: String -> [String]
+ BNFC.Backend.C.RegToFlex: instance BNFC.Backend.C.RegToFlex.Print BNFC.Abs.Identifier
+ BNFC.Backend.C.RegToFlex: instance BNFC.Backend.C.RegToFlex.Print BNFC.Abs.Reg
+ BNFC.Backend.C.RegToFlex: printRegFlex :: Reg -> String
+ BNFC.Backend.CPP.Makefile: makefile :: String -> String -> Doc
+ BNFC.Backend.CPP.Naming: cReservedWords :: [String]
+ BNFC.Backend.CPP.Naming: cppReservedWords :: [String]
+ BNFC.Backend.CPP.Naming: mkVariable :: String -> String
+ BNFC.Backend.CPP.NoSTL: makeCppNoStl :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.CPP.NoSTL.CFtoBison: cf2Bison :: String -> CF -> SymMap -> String
+ BNFC.Backend.CPP.NoSTL.CFtoCPPAbs: cf2CPPAbs :: String -> CF -> (String, String)
+ BNFC.Backend.CPP.NoSTL.CFtoFlex: cf2flex :: Maybe String -> String -> CF -> (String, SymMap)
+ BNFC.Backend.CPP.PrettyPrinter: cf2CPPPrinter :: Bool -> Maybe String -> CF -> (String, String)
+ BNFC.Backend.CPP.PrettyPrinter: prRender :: Bool -> String
+ BNFC.Backend.CPP.STL: makeCppStl :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.CPP.STL.CFtoBisonSTL: cf2Bison :: RecordPositions -> Maybe String -> String -> CF -> SymMap -> String
+ BNFC.Backend.CPP.STL.CFtoBisonSTL: definedRules :: CF -> String
+ BNFC.Backend.CPP.STL.CFtoBisonSTL: tokens :: [UserDef] -> SymMap -> String
+ BNFC.Backend.CPP.STL.CFtoBisonSTL: union :: Maybe String -> [Cat] -> Doc
+ BNFC.Backend.CPP.STL.CFtoCVisitSkelSTL: cf2CVisitSkel :: Bool -> Maybe String -> CF -> (String, String)
+ BNFC.Backend.CPP.STL.CFtoSTLAbs: cf2CPPAbs :: RecordPositions -> Maybe String -> String -> CF -> (String, String)
+ BNFC.Backend.CPP.STL.STLUtils: nsDefine :: Maybe String -> String -> String
+ BNFC.Backend.CPP.STL.STLUtils: nsEnd :: Maybe String -> String
+ BNFC.Backend.CPP.STL.STLUtils: nsScope :: Maybe String -> String
+ BNFC.Backend.CPP.STL.STLUtils: nsStart :: Maybe String -> String
+ BNFC.Backend.CPP.STL.STLUtils: nsString :: Maybe String -> String
+ BNFC.Backend.Common: asciiKeywords :: CF -> [String]
+ BNFC.Backend.Common: flexEps :: String
+ BNFC.Backend.Common: renderListSepByPrecedence :: Doc -> (String -> Doc) -> [(Integer, String)] -> Doc
+ BNFC.Backend.Common: unicodeAndSymbols :: CF -> [String]
+ BNFC.Backend.Common.Makefile: mkMakefile :: SharedOptions -> (String -> Doc) -> Backend
+ BNFC.Backend.Common.Makefile: mkRule :: String -> [String] -> [String] -> Doc
+ BNFC.Backend.Common.Makefile: mkVar :: String -> String -> Doc
+ BNFC.Backend.Common.Makefile: refVar :: String -> String
+ BNFC.Backend.Common.NamedVariables: Keyword :: String -> SymKey
+ BNFC.Backend.Common.NamedVariables: Tokentype :: String -> SymKey
+ BNFC.Backend.Common.NamedVariables: data SymKey
+ BNFC.Backend.Common.NamedVariables: firstLowerCase :: String -> String
+ BNFC.Backend.Common.NamedVariables: fixCoercions :: [(Cat, [Rule])] -> [(Cat, [Rule])]
+ BNFC.Backend.Common.NamedVariables: getVars :: [Cat] -> [IVar]
+ BNFC.Backend.Common.NamedVariables: instance GHC.Classes.Eq BNFC.Backend.Common.NamedVariables.SymKey
+ BNFC.Backend.Common.NamedVariables: instance GHC.Classes.Ord BNFC.Backend.Common.NamedVariables.SymKey
+ BNFC.Backend.Common.NamedVariables: instance GHC.Show.Show BNFC.Backend.Common.NamedVariables.SymKey
+ BNFC.Backend.Common.NamedVariables: numVars :: [Either Cat a] -> [Either (Cat, Doc) a]
+ BNFC.Backend.Common.NamedVariables: showNum :: (Eq a, Num a, Show a) => a -> [Char]
+ BNFC.Backend.Common.NamedVariables: type IVar = (String, Int)
+ BNFC.Backend.Common.NamedVariables: type KeywordEnv = [(String, String)]
+ BNFC.Backend.Common.NamedVariables: type SymEnv = KeywordEnv
+ BNFC.Backend.Common.NamedVariables: type SymMap = Map SymKey String
+ BNFC.Backend.Common.NamedVariables: type UserDef = TokenCat
+ BNFC.Backend.Common.NamedVariables: varName :: [Char] -> [Char]
+ BNFC.Backend.Common.OOAbstract: CAbs :: [String] -> [(String, Bool)] -> [String] -> [Fun] -> [(String, [CAbsRule])] -> [String] -> [Fun] -> CAbs
+ BNFC.Backend.Common.OOAbstract: [absclasses] :: CAbs -> [String]
+ BNFC.Backend.Common.OOAbstract: [conclasses] :: CAbs -> [Fun]
+ BNFC.Backend.Common.OOAbstract: [defineds] :: CAbs -> [Fun]
+ BNFC.Backend.Common.OOAbstract: [listtypes] :: CAbs -> [(String, Bool)]
+ BNFC.Backend.Common.OOAbstract: [postokens] :: CAbs -> [String]
+ BNFC.Backend.Common.OOAbstract: [signatures] :: CAbs -> [(String, [CAbsRule])]
+ BNFC.Backend.Common.OOAbstract: [tokentypes] :: CAbs -> [String]
+ BNFC.Backend.Common.OOAbstract: allClasses :: CAbs -> [String]
+ BNFC.Backend.Common.OOAbstract: allNonClasses :: CAbs -> [String]
+ BNFC.Backend.Common.OOAbstract: basetypes :: [([Char], [Char])]
+ BNFC.Backend.Common.OOAbstract: cf2cabs :: CF -> CAbs
+ BNFC.Backend.Common.OOAbstract: classVar :: String -> String
+ BNFC.Backend.Common.OOAbstract: data CAbs
+ BNFC.Backend.Common.OOAbstract: pointerIf :: Bool -> String -> String
+ BNFC.Backend.Common.OOAbstract: type CAbsRule = (Fun, [(String, Bool, String)])
+ BNFC.Backend.Common.StrUtils: escapeChars :: String -> String
+ BNFC.Backend.Common.StrUtils: renderCharOrString :: String -> (Char, String)
+ BNFC.Backend.Haskell: Alex3 :: AlexVersion
+ BNFC.Backend.Haskell: data AlexVersion
+ BNFC.Backend.Haskell: makeHaskell :: SharedOptions -> CF -> Backend
+ BNFC.Backend.Haskell: makefile :: Options -> String -> Doc
+ BNFC.Backend.Haskell: testfile :: Options -> CF -> String
+ BNFC.Backend.Haskell.CFtoAbstract: cf2Abstract :: TokenText -> Bool -> Bool -> String -> CF -> Doc
+ BNFC.Backend.Haskell.CFtoAbstract: definedRules :: Bool -> CF -> [Doc]
+ BNFC.Backend.Haskell.CFtoAlex3: cf2alex3 :: String -> TokenText -> CF -> String
+ BNFC.Backend.Haskell.CFtoAlex3: instance BNFC.Backend.Haskell.CFtoAlex3.Print BNFC.Abs.Identifier
+ BNFC.Backend.Haskell.CFtoAlex3: instance BNFC.Backend.Haskell.CFtoAlex3.Print BNFC.Abs.Reg
+ BNFC.Backend.Haskell.CFtoAlex3: instance BNFC.Backend.Haskell.CFtoAlex3.Print GHC.Types.Char
+ BNFC.Backend.Haskell.CFtoAlex3: instance BNFC.Backend.Haskell.CFtoAlex3.Print a => BNFC.Backend.Haskell.CFtoAlex3.Print [a]
+ BNFC.Backend.Haskell.CFtoAlex3: instance GHC.Show.Show BNFC.Backend.Haskell.CFtoAlex3.BTree
+ BNFC.Backend.Haskell.CFtoHappy: cf2Happy :: ModuleName -> ModuleName -> ModuleName -> HappyMode -> TokenText -> Bool -> CF -> String
+ BNFC.Backend.Haskell.CFtoHappy: convert :: String -> Doc
+ BNFC.Backend.Haskell.CFtoLayout: cf2Layout :: TokenText -> String -> String -> CF -> String
+ BNFC.Backend.Haskell.CFtoLayout: layoutClose :: [Char]
+ BNFC.Backend.Haskell.CFtoLayout: layoutOpen :: [Char]
+ BNFC.Backend.Haskell.CFtoLayout: layoutSep :: [Char]
+ BNFC.Backend.Haskell.CFtoPrinter: cf2Printer :: TokenText -> Bool -> Bool -> String -> AbsMod -> CF -> String
+ BNFC.Backend.Haskell.CFtoPrinter: compareRules :: IsFun f => Rul f -> Rul f -> Ordering
+ BNFC.Backend.Haskell.CFtoTemplate: cf2Template :: ModuleName -> ModuleName -> Bool -> CF -> String
+ BNFC.Backend.Haskell.HsOpts: absFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: absFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaASTFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaASTFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaLibFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaLibFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaMainFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaMainFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaParserFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: agdaParserFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: alexFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: alexFileHs :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: alexFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: codeDir :: Options -> FilePath
+ BNFC.Backend.Haskell.HsOpts: composOpFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: composOpFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: errFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: errFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: happyFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: happyFileHs :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: happyFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: layoutFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: layoutFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: mkFile :: (Options -> String -> String) -> String -> String -> Options -> FilePath
+ BNFC.Backend.Haskell.HsOpts: mkMod :: (Options -> String -> String) -> String -> Options -> String
+ BNFC.Backend.Haskell.HsOpts: mkNamespace :: Options -> FilePath
+ BNFC.Backend.Haskell.HsOpts: noLang :: Options -> String -> String
+ BNFC.Backend.Haskell.HsOpts: pkgToDir :: String -> FilePath
+ BNFC.Backend.Haskell.HsOpts: printerFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: printerFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: tFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: tFileExe :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: templateFile :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: templateFileM :: Options -> String
+ BNFC.Backend.Haskell.HsOpts: txtFile :: Options -> FilePath
+ BNFC.Backend.Haskell.HsOpts: type Options = SharedOptions
+ BNFC.Backend.Haskell.HsOpts: withLang :: Options -> String -> String
+ BNFC.Backend.Haskell.HsOpts: xmlFile :: Options -> FilePath
+ BNFC.Backend.Haskell.HsOpts: xmlFileM :: Options -> String
+ BNFC.Backend.Haskell.MkErrM: mkErrM :: String -> Doc
+ BNFC.Backend.Haskell.Utils: avoidReservedWords :: String -> String
+ BNFC.Backend.Haskell.Utils: catToType :: (Doc -> Doc) -> Doc -> Cat -> Doc
+ BNFC.Backend.Haskell.Utils: catToVar :: Cat -> String
+ BNFC.Backend.Haskell.Utils: catvars :: [Cat] -> [Doc]
+ BNFC.Backend.Haskell.Utils: hsReservedWords :: [String]
+ BNFC.Backend.Haskell.Utils: mkDefName :: IsFun f => f -> String
+ BNFC.Backend.Haskell.Utils: parserName :: Cat -> Doc
+ BNFC.Backend.Haskell.Utils: tokenTextImport :: TokenText -> [String]
+ BNFC.Backend.Haskell.Utils: tokenTextPack :: TokenText -> String -> String
+ BNFC.Backend.Haskell.Utils: tokenTextPackParens :: TokenText -> String -> String
+ BNFC.Backend.Haskell.Utils: tokenTextType :: TokenText -> String
+ BNFC.Backend.Haskell.Utils: tokenTextUnpack :: TokenText -> String -> String
+ BNFC.Backend.Haskell.Utils: typeToHaskell :: Type -> String
+ BNFC.Backend.Haskell.Utils: typeToHaskell' :: String -> Type -> String
+ BNFC.Backend.HaskellGADT: makeHaskellGadt :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.HaskellGADT.CFtoAbstractGADT: cf2Abstract :: TokenText -> String -> CF -> String -> String
+ BNFC.Backend.HaskellGADT.CFtoTemplateGADT: cf2Template :: ModuleName -> ModuleName -> CF -> String
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: Constructor :: Cat -> Fun -> Integer -> [(Cat, String)] -> [Either Cat String] -> Constructor
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: [consCat] :: Constructor -> Cat
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: [consFun] :: Constructor -> Fun
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: [consPrec] :: Constructor -> Integer
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: [consRhs] :: Constructor -> [Either Cat String]
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: [consVars] :: Constructor -> [(Cat, String)]
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: cf2cons :: CF -> [Constructor]
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: data Constructor
+ BNFC.Backend.HaskellGADT.HaskellGADTCommon: isTreeType :: CF -> Cat -> Bool
+ BNFC.Backend.Java: makeJava :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.Java.CFtoAbstractVisitor: cf2AbstractVisitor :: String -> String -> CF -> String
+ BNFC.Backend.Java.CFtoAllVisitor: cf2AllVisitor :: String -> String -> CF -> String
+ BNFC.Backend.Java.CFtoAntlr4Lexer: cf2AntlrLex :: String -> CF -> (Doc, KeywordEnv)
+ BNFC.Backend.Java.CFtoAntlr4Parser: cf2AntlrParse :: String -> String -> CF -> RecordPositions -> KeywordEnv -> String
+ BNFC.Backend.Java.CFtoComposVisitor: cf2ComposVisitor :: String -> String -> CF -> String
+ BNFC.Backend.Java.CFtoCup15: cf2Cup :: String -> String -> CF -> RecordPositions -> KeywordEnv -> String
+ BNFC.Backend.Java.CFtoCup15: definedRules :: String -> CF -> [String]
+ BNFC.Backend.Java.CFtoFoldVisitor: cf2FoldVisitor :: String -> String -> CF -> String
+ BNFC.Backend.Java.CFtoJLex15: cf2jlex :: JavaLexerParser -> RecordPositions -> String -> CF -> (Doc, SymEnv)
+ BNFC.Backend.Java.CFtoJavaAbs15: cat2JavaType :: [UserDef] -> Cat -> String
+ BNFC.Backend.Java.CFtoJavaAbs15: cf2JavaAbs :: String -> String -> CF -> RecordPositions -> [(FilePath, String)]
+ BNFC.Backend.Java.CFtoJavaAbs15: typename :: String -> [UserDef] -> String -> String
+ BNFC.Backend.Java.CFtoJavaPrinter15: cf2JavaPrinter :: String -> String -> CF -> String
+ BNFC.Backend.Java.CFtoVisitSkel15: cf2VisitSkel :: String -> String -> CF -> String
+ BNFC.Backend.Java.RegToAntlrLexer: escapeCharInSingleQuotes :: Char -> String
+ BNFC.Backend.Java.RegToAntlrLexer: instance BNFC.Backend.Java.RegToAntlrLexer.Print BNFC.Abs.Identifier
+ BNFC.Backend.Java.RegToAntlrLexer: instance BNFC.Backend.Java.RegToAntlrLexer.Print BNFC.Abs.Reg
+ BNFC.Backend.Java.RegToAntlrLexer: printRegJLex :: Reg -> String
+ BNFC.Backend.Java.RegToJLex: escapeChar :: JavaLexerParser -> Char -> String
+ BNFC.Backend.Java.RegToJLex: instance BNFC.Backend.Java.RegToJLex.Print BNFC.Abs.Identifier
+ BNFC.Backend.Java.RegToJLex: instance BNFC.Backend.Java.RegToJLex.Print BNFC.Abs.Reg
+ BNFC.Backend.Java.RegToJLex: instance BNFC.Backend.Java.RegToJLex.Print GHC.Types.Char
+ BNFC.Backend.Java.RegToJLex: instance BNFC.Backend.Java.RegToJLex.Print a => BNFC.Backend.Java.RegToJLex.Print [a]
+ BNFC.Backend.Java.RegToJLex: printRegJLex :: JavaLexerParser -> Reg -> String
+ BNFC.Backend.Java.Utils: getLabelName :: Fun -> String
+ BNFC.Backend.Java.Utils: getLastInPackage :: String -> String
+ BNFC.Backend.Java.Utils: getRuleName :: String -> String
+ BNFC.Backend.Java.Utils: javaReserved :: [String]
+ BNFC.Backend.Java.Utils: startSymbol :: String -> String
+ BNFC.Backend.Latex: arrow :: String
+ BNFC.Backend.Latex: beginDocument :: String -> String
+ BNFC.Backend.Latex: cfToLatex :: String -> CF -> String
+ BNFC.Backend.Latex: delimiter :: String
+ BNFC.Backend.Latex: empty :: String
+ BNFC.Backend.Latex: endDocument :: String
+ BNFC.Backend.Latex: identSection :: CF -> [String]
+ BNFC.Backend.Latex: introduction :: String
+ BNFC.Backend.Latex: latexRegExp :: Reg -> String
+ BNFC.Backend.Latex: literal :: String -> String
+ BNFC.Backend.Latex: macros :: String
+ BNFC.Backend.Latex: makeLatex :: SharedOptions -> CF -> Backend
+ BNFC.Backend.Latex: makefile :: String -> String -> Doc
+ BNFC.Backend.Latex: nonterminal :: Cat -> String
+ BNFC.Backend.Latex: prt :: String -> String
+ BNFC.Backend.Latex: prtBNF :: String -> CF -> String
+ BNFC.Backend.Latex: prtComments :: ([(String, String)], [String]) -> String
+ BNFC.Backend.Latex: prtIdentifiers :: [String]
+ BNFC.Backend.Latex: prtLiterals :: String -> CF -> String
+ BNFC.Backend.Latex: prtOwnToken :: (String, Reg) -> String
+ BNFC.Backend.Latex: prtReserved :: String -> CF -> String
+ BNFC.Backend.Latex: prtRules :: [(Cat, [Rule])] -> String
+ BNFC.Backend.Latex: prtSymb :: String -> CF -> String
+ BNFC.Backend.Latex: prtSymbols :: [Either Cat String] -> String
+ BNFC.Backend.Latex: prtTerminals :: String -> CF -> String
+ BNFC.Backend.Latex: reserved :: String -> String
+ BNFC.Backend.Latex: stringLit :: TokenCat -> [String]
+ BNFC.Backend.Latex: stringRes :: String -> String
+ BNFC.Backend.Latex: symbol :: String -> String
+ BNFC.Backend.Latex: tabular :: Int -> [[String]] -> String
+ BNFC.Backend.Latex: terminal :: String -> String
+ BNFC.Backend.Latex: three :: Monoid a => [a] -> [[a]]
+ BNFC.Backend.OCaml: makeOCaml :: SharedOptions -> CF -> MkFiles ()
+ BNFC.Backend.OCaml.CFtoOCamlAbs: cf2Abstract :: String -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlLex: cf2ocamllex :: String -> String -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlLex: instance BNFC.Backend.OCaml.CFtoOCamlLex.Print BNFC.Abs.Identifier
+ BNFC.Backend.OCaml.CFtoOCamlLex: instance BNFC.Backend.OCaml.CFtoOCamlLex.Print BNFC.Abs.Reg
+ BNFC.Backend.OCaml.CFtoOCamlLex: instance BNFC.Backend.OCaml.CFtoOCamlLex.Print GHC.Types.Char
+ BNFC.Backend.OCaml.CFtoOCamlLex: instance BNFC.Backend.OCaml.CFtoOCamlLex.Print a => BNFC.Backend.OCaml.CFtoOCamlLex.Print [a]
+ BNFC.Backend.OCaml.CFtoOCamlPrinter: cf2Printer :: String -> ModuleName -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlPrinter: prtFun :: Cat -> String
+ BNFC.Backend.OCaml.CFtoOCamlShow: cf2show :: String -> ModuleName -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlShow: showsFunQual :: (String -> String) -> Cat -> String
+ BNFC.Backend.OCaml.CFtoOCamlTemplate: cf2Template :: ModuleName -> ModuleName -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlTest: comment :: Doc -> Doc
+ BNFC.Backend.OCaml.CFtoOCamlTest: ocamlTestfile :: String -> String -> String -> String -> String -> CF -> Doc
+ BNFC.Backend.OCaml.CFtoOCamlYacc: cf2ocamlyacc :: String -> String -> String -> CF -> String
+ BNFC.Backend.OCaml.CFtoOCamlYacc: epName :: Cat -> String
+ BNFC.Backend.OCaml.CFtoOCamlYacc: terminal :: CF -> String -> String
+ BNFC.Backend.OCaml.OCamlUtil: fixType :: Cat -> String
+ BNFC.Backend.OCaml.OCamlUtil: fixTypeQual :: String -> Cat -> String
+ BNFC.Backend.OCaml.OCamlUtil: fixTypeUpper :: Cat -> String
+ BNFC.Backend.OCaml.OCamlUtil: insertBar :: [String] -> [String]
+ BNFC.Backend.OCaml.OCamlUtil: mkEsc :: String -> String
+ BNFC.Backend.OCaml.OCamlUtil: mkTuple :: [String] -> String
+ BNFC.Backend.OCaml.OCamlUtil: mutualDefs :: [String] -> [String]
+ BNFC.Backend.OCaml.OCamlUtil: ocamlTokenName :: String -> String
+ BNFC.Backend.OCaml.OCamlUtil: reservedOCaml :: [String]
+ BNFC.Backend.OCaml.OCamlUtil: reservedOCamlLex :: [String]
+ BNFC.Backend.Pygments: lexer :: String -> CF -> Doc
+ BNFC.Backend.Pygments: makePygments :: SharedOptions -> CF -> Backend
+ BNFC.Backend.Pygments: pyRegex :: Reg -> Doc
+ BNFC.Backend.Pygments: setup :: String -> Doc
+ BNFC.Backend.Txt2Tag: cfToTxt :: String -> CF -> String
+ BNFC.Backend.XML: alts :: [String] -> String
+ BNFC.Backend.XML: attlist :: [Char] -> [Char] -> String
+ BNFC.Backend.XML: case_fun :: Cat -> [(String, [String])] -> String
+ BNFC.Backend.XML: cf2DTD :: Coding -> String -> CF -> String
+ BNFC.Backend.XML: cf2XMLPrinter :: Bool -> SharedOptions -> String -> CF -> String
+ BNFC.Backend.XML: doubleRule :: p -> String
+ BNFC.Backend.XML: efunDef :: Bool -> String
+ BNFC.Backend.XML: efunDefConstr :: String
+ BNFC.Backend.XML: efunDefConstrs :: [Char]
+ BNFC.Backend.XML: efunDefNotyp :: String
+ BNFC.Backend.XML: elemAtt :: String -> [Char] -> [String] -> String
+ BNFC.Backend.XML: elemData :: Bool -> CF -> (Cat, [(Fun, [Cat])]) -> String
+ BNFC.Backend.XML: elemDataConstr :: CF -> (Cat, [(Fun, [Cat])]) -> String
+ BNFC.Backend.XML: elemDataConstrs :: CF -> (Cat, [(Fun, [Cat])]) -> String
+ BNFC.Backend.XML: elemDataNotyp :: CF -> (a, [(String, [Cat])]) -> String
+ BNFC.Backend.XML: elemEmp :: String -> String
+ BNFC.Backend.XML: elemc :: Cat -> [(Fun, String)] -> String
+ BNFC.Backend.XML: element :: String -> [String] -> String
+ BNFC.Backend.XML: elemt :: String -> [String] -> String
+ BNFC.Backend.XML: endtagDef :: Bool -> String
+ BNFC.Backend.XML: endtagDefConstr :: String
+ BNFC.Backend.XML: endtagDefConstrs :: [Char]
+ BNFC.Backend.XML: endtagDefNotyp :: String
+ BNFC.Backend.XML: identRule :: CF -> String
+ BNFC.Backend.XML: integerRule :: p -> String
+ BNFC.Backend.XML: makeXML :: SharedOptions -> Coding -> CF -> Backend
+ BNFC.Backend.XML: ownPrintRule :: CF -> TokenCat -> String
+ BNFC.Backend.XML: parenth :: [Char] -> [Char]
+ BNFC.Backend.XML: pragmas :: SharedOptions -> String
+ BNFC.Backend.XML: prologue :: Bool -> SharedOptions -> String -> String
+ BNFC.Backend.XML: rhsCat :: CF -> Fun -> [Cat] -> String
+ BNFC.Backend.XML: rhsCatNot :: CF -> [Cat] -> [Char]
+ BNFC.Backend.XML: rules :: CF -> String
+ BNFC.Backend.XML: showsPrintRule :: p -> [Char] -> String
+ BNFC.Backend.XML: stringRule :: p -> String
+ BNFC.Backend.XML: symbCat :: CF -> Cat -> [Char]
+ BNFC.Backend.XML: symbCatNot :: CF -> Cat -> [Char]
+ BNFC.Backend.XML: tag :: String -> String
+ BNFC.Backend.XML: type Coding = Bool
+ BNFC.CF: App :: String -> [Exp] -> Exp
+ BNFC.CF: BaseT :: String -> Base
+ BNFC.CF: CFG :: [Pragma] -> Set Cat -> [Literal] -> [Symbol] -> [KeyWord] -> [Cat] -> [Rul function] -> Signature -> CFG function
+ BNFC.CF: Cat :: String -> Cat
+ BNFC.CF: CoercCat :: String -> Integer -> Cat
+ BNFC.CF: CommentM :: (String, String) -> Pragma
+ BNFC.CF: CommentS :: String -> Pragma
+ BNFC.CF: EntryPoints :: [RCat] -> Pragma
+ BNFC.CF: FunDef :: RFun -> [String] -> Exp -> Pragma
+ BNFC.CF: FunT :: [Base] -> Base -> Type
+ BNFC.CF: Internal :: InternalRule
+ BNFC.CF: Layout :: [String] -> Pragma
+ BNFC.CF: LayoutStop :: [String] -> Pragma
+ BNFC.CF: LayoutTop :: Pragma
+ BNFC.CF: ListCat :: Cat -> Cat
+ BNFC.CF: ListT :: Base -> Base
+ BNFC.CF: LitChar :: Char -> Exp
+ BNFC.CF: LitDouble :: Double -> Exp
+ BNFC.CF: LitInt :: Integer -> Exp
+ BNFC.CF: LitString :: String -> Exp
+ BNFC.CF: NoPosition :: Position
+ BNFC.CF: Parsable :: InternalRule
+ BNFC.CF: Position :: FilePath -> Int -> Int -> Position
+ BNFC.CF: Rule :: function -> RCat -> SentForm -> InternalRule -> Rul function
+ BNFC.CF: TokenCat :: TokenCat -> Cat
+ BNFC.CF: TokenReg :: RString -> Bool -> Reg -> Pragma
+ BNFC.CF: Var :: String -> Exp
+ BNFC.CF: WithPosition :: Position -> a -> WithPosition a
+ BNFC.CF: [cfgKeywords] :: CFG function -> [KeyWord]
+ BNFC.CF: [cfgLiterals] :: CFG function -> [Literal]
+ BNFC.CF: [cfgPragmas] :: CFG function -> [Pragma]
+ BNFC.CF: [cfgReversibleCats] :: CFG function -> [Cat]
+ BNFC.CF: [cfgRules] :: CFG function -> [Rul function]
+ BNFC.CF: [cfgSignature] :: CFG function -> Signature
+ BNFC.CF: [cfgSymbols] :: CFG function -> [Symbol]
+ BNFC.CF: [cfgUsedCats] :: CFG function -> Set Cat
+ BNFC.CF: [funRule] :: Rul function -> function
+ BNFC.CF: [internal] :: Rul function -> InternalRule
+ BNFC.CF: [posColumn] :: Position -> Int
+ BNFC.CF: [posFile] :: Position -> FilePath
+ BNFC.CF: [posLine] :: Position -> Int
+ BNFC.CF: [rhsRule] :: Rul function -> SentForm
+ BNFC.CF: [valRCat] :: Rul function -> RCat
+ BNFC.CF: [wpPosition] :: WithPosition a -> Position
+ BNFC.CF: [wpThing] :: WithPosition a -> a
+ BNFC.CF: allCats :: (InternalRule -> Bool) -> CFG f -> [Cat]
+ BNFC.CF: allCatsIdNorm :: CF -> [RString]
+ BNFC.CF: allCatsNorm :: CF -> [Cat]
+ BNFC.CF: allEntryPoints :: CFG f -> List1 Cat
+ BNFC.CF: allNames :: CF -> [RString]
+ BNFC.CF: allParserCats :: CFG f -> [Cat]
+ BNFC.CF: allParserCatsNorm :: CFG f -> [Cat]
+ BNFC.CF: baseCat :: Cat -> Either BaseCat TokenCat
+ BNFC.CF: baseTokenCatNames :: [TokenCat]
+ BNFC.CF: blendInPosition :: RString -> String
+ BNFC.CF: catChar :: TokenCat
+ BNFC.CF: catDouble :: TokenCat
+ BNFC.CF: catIdent :: TokenCat
+ BNFC.CF: catInteger :: TokenCat
+ BNFC.CF: catOfList :: Cat -> Cat
+ BNFC.CF: catString :: TokenCat
+ BNFC.CF: catToStr :: Cat -> String
+ BNFC.CF: cf2data :: CF -> [Data]
+ BNFC.CF: cf2dataLists :: CF -> [Data]
+ BNFC.CF: cfTokens :: CFG f -> [(String, Int)]
+ BNFC.CF: class IsFun a
+ BNFC.CF: comments :: CF -> ([(String, String)], [String])
+ BNFC.CF: data Base
+ BNFC.CF: data CFG function
+ BNFC.CF: data Cat
+ BNFC.CF: data Exp
+ BNFC.CF: data InternalRule
+ BNFC.CF: data Position
+ BNFC.CF: data Pragma
+ BNFC.CF: data Rul function
+ BNFC.CF: data Type
+ BNFC.CF: data WithPosition a
+ BNFC.CF: filterNonUnique :: Ord a => [a] -> [a]
+ BNFC.CF: findAllReversibleCats :: CF -> [Cat]
+ BNFC.CF: firstEntry :: CF -> Cat
+ BNFC.CF: funName :: IsFun a => a -> String
+ BNFC.CF: getAbstractSyntax :: CF -> [Data]
+ BNFC.CF: getCons :: [Rule] -> String
+ BNFC.CF: getSeparatorByPrecedence :: [Rule] -> [(Integer, String)]
+ BNFC.CF: hasIdent :: CFG f -> Bool
+ BNFC.CF: hasIdentLikeTokens :: CFG g -> Bool
+ BNFC.CF: hasLayout :: CF -> Bool
+ BNFC.CF: hasOneFunc :: [Rule] -> Bool
+ BNFC.CF: hasPositionTokens :: CFG g -> Bool
+ BNFC.CF: identCat :: Cat -> String
+ BNFC.CF: instance BNFC.CF.IsFun GHC.Base.String
+ BNFC.CF: instance BNFC.CF.IsFun a => BNFC.CF.IsFun (BNFC.CF.WithPosition a)
+ BNFC.CF: instance Data.Foldable.Foldable BNFC.CF.WithPosition
+ BNFC.CF: instance Data.String.IsString BNFC.CF.RFun
+ BNFC.CF: instance Data.Traversable.Traversable BNFC.CF.WithPosition
+ BNFC.CF: instance GHC.Base.Functor BNFC.CF.CFG
+ BNFC.CF: instance GHC.Base.Functor BNFC.CF.Rul
+ BNFC.CF: instance GHC.Base.Functor BNFC.CF.WithPosition
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.Base
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.Cat
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.Exp
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.InternalRule
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.Position
+ BNFC.CF: instance GHC.Classes.Eq BNFC.CF.Type
+ BNFC.CF: instance GHC.Classes.Eq a => GHC.Classes.Eq (BNFC.CF.WithPosition a)
+ BNFC.CF: instance GHC.Classes.Eq function => GHC.Classes.Eq (BNFC.CF.Rul function)
+ BNFC.CF: instance GHC.Classes.Ord BNFC.CF.Base
+ BNFC.CF: instance GHC.Classes.Ord BNFC.CF.Cat
+ BNFC.CF: instance GHC.Classes.Ord BNFC.CF.Position
+ BNFC.CF: instance GHC.Classes.Ord BNFC.CF.Type
+ BNFC.CF: instance GHC.Classes.Ord a => GHC.Classes.Ord (BNFC.CF.WithPosition a)
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Base
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Cat
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Exp
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Position
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Pragma
+ BNFC.CF: instance GHC.Show.Show BNFC.CF.Type
+ BNFC.CF: instance GHC.Show.Show a => GHC.Show.Show (BNFC.CF.WithPosition a)
+ BNFC.CF: instance GHC.Show.Show function => GHC.Show.Show (BNFC.CF.CFG function)
+ BNFC.CF: instance GHC.Show.Show function => GHC.Show.Show (BNFC.CF.Rul function)
+ BNFC.CF: isCoercion :: IsFun a => a -> Bool
+ BNFC.CF: isConsFun :: IsFun a => a -> Bool
+ BNFC.CF: isDataCat :: Cat -> Bool
+ BNFC.CF: isDataOrListCat :: Cat -> Bool
+ BNFC.CF: isDefinedRule :: IsFun a => a -> Bool
+ BNFC.CF: isEmptyListCat :: CF -> Cat -> Bool
+ BNFC.CF: isList :: Cat -> Bool
+ BNFC.CF: isNilCons :: IsFun a => a -> Bool
+ BNFC.CF: isNilFun :: IsFun a => a -> Bool
+ BNFC.CF: isOneFun :: IsFun a => a -> Bool
+ BNFC.CF: isParsable :: Rul f -> Bool
+ BNFC.CF: isPositionCat :: CFG f -> TokenCat -> Bool
+ BNFC.CF: isProperLabel :: IsFun a => a -> Bool
+ BNFC.CF: isTokenCat :: Cat -> Bool
+ BNFC.CF: isUsedCat :: CFG f -> Cat -> Bool
+ BNFC.CF: layoutPragmas :: CF -> (Bool, [String], [String])
+ BNFC.CF: literals :: CFG f -> [TokenCat]
+ BNFC.CF: lookupRule :: Eq f => f -> [Rul f] -> Maybe (Cat, SentForm)
+ BNFC.CF: maybeTokenCat :: Cat -> Maybe TokenCat
+ BNFC.CF: noPosition :: a -> WithPosition a
+ BNFC.CF: normCat :: Cat -> Cat
+ BNFC.CF: normCatOfList :: Cat -> Cat
+ BNFC.CF: npIdentifier :: String -> Identifier
+ BNFC.CF: npRule :: Fun -> Cat -> SentForm -> InternalRule -> Rule
+ BNFC.CF: numberOfBlockCommentForms :: CF -> Int
+ BNFC.CF: precCat :: Cat -> Integer
+ BNFC.CF: precRule :: Rul f -> Integer
+ BNFC.CF: prettyPosition :: Position -> String
+ BNFC.CF: reallyAllCats :: CFG f -> [Cat]
+ BNFC.CF: reservedWords :: CFG f -> [String]
+ BNFC.CF: revSepListRule :: Rul f -> Rul f
+ BNFC.CF: ruleGroups :: CF -> [(Cat, [Rule])]
+ BNFC.CF: ruleGroupsInternals :: CF -> [(Cat, [Rule])]
+ BNFC.CF: rulesForCat :: CF -> Cat -> [Rule]
+ BNFC.CF: rulesForNormalizedCat :: CF -> Cat -> [Rule]
+ BNFC.CF: sameCat :: Cat -> Cat -> Bool
+ BNFC.CF: sigLookup :: IsFun a => a -> CF -> Maybe (WithPosition Type)
+ BNFC.CF: specialCats :: CF -> [TokenCat]
+ BNFC.CF: specialCatsP :: [TokenCat]
+ BNFC.CF: specialData :: CF -> [Data]
+ BNFC.CF: strToCat :: String -> Cat
+ BNFC.CF: tokenNames :: CFG f -> [String]
+ BNFC.CF: tokenPragmas :: CFG f -> [(TokenCat, Reg)]
+ BNFC.CF: type BaseCat = String
+ BNFC.CF: type CF = CFG RFun
+ BNFC.CF: type Data = (Cat, [(String, [Cat])])
+ BNFC.CF: type Fun = String
+ BNFC.CF: type KeyWord = String
+ BNFC.CF: type Literal = String
+ BNFC.CF: type NonTerminal = Cat
+ BNFC.CF: type RCat = WithPosition Cat
+ BNFC.CF: type RFun = RString
+ BNFC.CF: type RString = WithPosition String
+ BNFC.CF: type Rule = Rul RFun
+ BNFC.CF: type SentForm = [Either Cat String]
+ BNFC.CF: type Signature = Map String (WithPosition Type)
+ BNFC.CF: type Symbol = String
+ BNFC.CF: type TokenCat = String
+ BNFC.CF: valCat :: Rul fun -> Cat
+ BNFC.Check.EmptyTypes: emptyData :: forall f. IsFun f => [Rul f] -> [RCat]
+ BNFC.GetCF: checkRule :: CF -> Rule -> Maybe String
+ BNFC.GetCF: instance (BNFC.GetCF.FixTokenCats a, GHC.Classes.Ord a) => BNFC.GetCF.FixTokenCats (Data.Set.Internal.Set a)
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats (BNFC.CF.CFG f)
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats (BNFC.CF.Rul f)
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats (Data.Either.Either BNFC.CF.Cat GHC.Base.String)
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats BNFC.CF.Cat
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats BNFC.CF.Pragma
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats a => BNFC.GetCF.FixTokenCats (BNFC.CF.WithPosition a)
+ BNFC.GetCF: instance BNFC.GetCF.FixTokenCats a => BNFC.GetCF.FixTokenCats [a]
+ BNFC.GetCF: instance Control.Monad.Error.Class.MonadError GHC.Base.String BNFC.GetCF.Trans
+ BNFC.GetCF: instance Control.Monad.Reader.Class.MonadReader BNFC.Options.SharedOptions BNFC.GetCF.Trans
+ BNFC.GetCF: instance GHC.Base.Applicative BNFC.GetCF.Trans
+ BNFC.GetCF: instance GHC.Base.Functor BNFC.GetCF.Trans
+ BNFC.GetCF: instance GHC.Base.Monad BNFC.GetCF.Trans
+ BNFC.GetCF: parseCF :: SharedOptions -> Target -> String -> IO CF
+ BNFC.GetCF: transItem :: Item -> [Either Cat String]
+ BNFC.Lex: AlexA# :: Addr# -> AlexAddr
+ BNFC.Lex: AlexAcc :: Int -> AlexAcc user
+ BNFC.Lex: AlexAccNone :: AlexAcc user
+ BNFC.Lex: AlexAccSkip :: AlexAcc user
+ BNFC.Lex: AlexEOF :: AlexReturn a
+ BNFC.Lex: AlexError :: !AlexInput -> AlexReturn a
+ BNFC.Lex: AlexLastAcc :: !Int -> !AlexInput -> !Int -> AlexLastAcc
+ BNFC.Lex: AlexLastSkip :: !AlexInput -> !Int -> AlexLastAcc
+ BNFC.Lex: AlexNone :: AlexLastAcc
+ BNFC.Lex: AlexSkip :: !AlexInput -> !Int -> AlexReturn a
+ BNFC.Lex: AlexToken :: !AlexInput -> !Int -> a -> AlexReturn a
+ BNFC.Lex: B :: String -> Tok -> BTree -> BTree -> BTree
+ BNFC.Lex: Err :: Posn -> Token
+ BNFC.Lex: N :: BTree
+ BNFC.Lex: PT :: Posn -> Tok -> Token
+ BNFC.Lex: Pn :: !Int -> !Int -> !Int -> Posn
+ BNFC.Lex: TC :: !String -> Tok
+ BNFC.Lex: TD :: !String -> Tok
+ BNFC.Lex: TI :: !String -> Tok
+ BNFC.Lex: TL :: !String -> Tok
+ BNFC.Lex: TS :: !String -> !Int -> Tok
+ BNFC.Lex: TV :: !String -> Tok
+ BNFC.Lex: T_Identifier :: !String -> Tok
+ BNFC.Lex: alexGetByte :: AlexInput -> Maybe (Byte, AlexInput)
+ BNFC.Lex: alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int#
+ BNFC.Lex: alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int#
+ BNFC.Lex: alexInputPrevChar :: AlexInput -> Char
+ BNFC.Lex: alexMove :: Posn -> Char -> Posn
+ BNFC.Lex: alexScan :: (Posn, Char, [Byte], String) -> Int -> AlexReturn (Posn -> String -> Token)
+ BNFC.Lex: alexScanUser :: t -> (Posn, Char, [Byte], String) -> Int -> AlexReturn (Posn -> String -> Token)
+ BNFC.Lex: alexStartPos :: Posn
+ BNFC.Lex: alex_accept :: Array Int (AlexAcc user)
+ BNFC.Lex: alex_action_3 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_4 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_5 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_6 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_7 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_8 :: Posn -> String -> Token
+ BNFC.Lex: alex_action_9 :: Posn -> String -> Token
+ BNFC.Lex: alex_actions :: Array Int (Posn -> String -> Token)
+ BNFC.Lex: alex_base :: AlexAddr
+ BNFC.Lex: alex_check :: AlexAddr
+ BNFC.Lex: alex_deflt :: AlexAddr
+ BNFC.Lex: alex_scan_tkn :: t1 -> t2 -> Int# -> AlexInput -> Int# -> AlexLastAcc -> (AlexLastAcc, (Posn, Char, [Byte], String))
+ BNFC.Lex: alex_tab_size :: Int
+ BNFC.Lex: alex_table :: AlexAddr
+ BNFC.Lex: data AlexAcc user
+ BNFC.Lex: data AlexAddr
+ BNFC.Lex: data AlexLastAcc
+ BNFC.Lex: data AlexReturn a
+ BNFC.Lex: data BTree
+ BNFC.Lex: data Posn
+ BNFC.Lex: data Tok
+ BNFC.Lex: data Token
+ BNFC.Lex: eitherResIdent :: (String -> Tok) -> String -> Tok
+ BNFC.Lex: instance GHC.Classes.Eq BNFC.Lex.Posn
+ BNFC.Lex: instance GHC.Classes.Eq BNFC.Lex.Tok
+ BNFC.Lex: instance GHC.Classes.Eq BNFC.Lex.Token
+ BNFC.Lex: instance GHC.Classes.Ord BNFC.Lex.Posn
+ BNFC.Lex: instance GHC.Classes.Ord BNFC.Lex.Tok
+ BNFC.Lex: instance GHC.Classes.Ord BNFC.Lex.Token
+ BNFC.Lex: instance GHC.Show.Show BNFC.Lex.BTree
+ BNFC.Lex: instance GHC.Show.Show BNFC.Lex.Posn
+ BNFC.Lex: instance GHC.Show.Show BNFC.Lex.Tok
+ BNFC.Lex: instance GHC.Show.Show BNFC.Lex.Token
+ BNFC.Lex: mkPosToken :: Token -> ((Int, Int), String)
+ BNFC.Lex: posLineCol :: Posn -> (Int, Int)
+ BNFC.Lex: prToken :: Token -> String
+ BNFC.Lex: printPosn :: Posn -> String
+ BNFC.Lex: quickIndex :: Array Int (AlexAcc (Any :: Type)) -> Int -> AlexAcc (Any :: Type)
+ BNFC.Lex: resWords :: BTree
+ BNFC.Lex: tok :: (Posn -> String -> Token) -> Posn -> String -> Token
+ BNFC.Lex: tokenLineCol :: Token -> (Int, Int)
+ BNFC.Lex: tokenPos :: [Token] -> String
+ BNFC.Lex: tokenPosn :: Token -> Posn
+ BNFC.Lex: tokenText :: Token -> String
+ BNFC.Lex: tokens :: String -> [Token]
+ BNFC.Lex: type AlexInput = (Posn, Char, [Byte], String)
+ BNFC.Lex: type Byte = Word8
+ BNFC.Lex: unescapeInitTail :: String -> String
+ BNFC.Lex: utf8Encode :: Char -> [Word8]
+ BNFC.Lexing: LexComment :: LexType
+ BNFC.Lexing: LexSymbols :: LexType
+ BNFC.Lexing: LexToken :: String -> LexType
+ BNFC.Lexing: data LexType
+ BNFC.Lexing: mkLexer :: CF -> [(Reg, LexType)]
+ BNFC.Lexing: mkRegMultilineComment :: String -> String -> Reg
+ BNFC.License: license :: String
+ BNFC.Options: Alex3 :: AlexVersion
+ BNFC.Options: Antlr4 :: JavaLexerParser
+ BNFC.Options: ByteStringToken :: TokenText
+ BNFC.Options: GLR :: HappyMode
+ BNFC.Options: Help :: Mode
+ BNFC.Options: JFlexCup :: JavaLexerParser
+ BNFC.Options: JLexCup :: JavaLexerParser
+ BNFC.Options: License :: Mode
+ BNFC.Options: Menhir :: OCamlParser
+ BNFC.Options: NoRecordPositions :: RecordPositions
+ BNFC.Options: OCamlYacc :: OCamlParser
+ BNFC.Options: Options :: FilePath -> String -> FilePath -> Bool -> Target -> Maybe String -> Maybe String -> RecordPositions -> Bool -> Bool -> Bool -> AlexVersion -> TokenText -> HappyMode -> Int -> Bool -> OCamlParser -> JavaLexerParser -> Bool -> Bool -> SharedOptions
+ BNFC.Options: RecordPositions :: RecordPositions
+ BNFC.Options: Standard :: HappyMode
+ BNFC.Options: StringToken :: TokenText
+ BNFC.Options: Target :: SharedOptions -> FilePath -> Mode
+ BNFC.Options: TargetC :: Target
+ BNFC.Options: TargetCheck :: Target
+ BNFC.Options: TargetCpp :: Target
+ BNFC.Options: TargetCppNoStl :: Target
+ BNFC.Options: TargetHaskell :: Target
+ BNFC.Options: TargetHaskellGadt :: Target
+ BNFC.Options: TargetJava :: Target
+ BNFC.Options: TargetLatex :: Target
+ BNFC.Options: TargetOCaml :: Target
+ BNFC.Options: TargetPygments :: Target
+ BNFC.Options: TextToken :: TokenText
+ BNFC.Options: UsageError :: String -> Mode
+ BNFC.Options: Version :: Mode
+ BNFC.Options: [agda] :: SharedOptions -> Bool
+ BNFC.Options: [alexMode] :: SharedOptions -> AlexVersion
+ BNFC.Options: [force] :: SharedOptions -> Bool
+ BNFC.Options: [functor] :: SharedOptions -> Bool
+ BNFC.Options: [generic] :: SharedOptions -> Bool
+ BNFC.Options: [glr] :: SharedOptions -> HappyMode
+ BNFC.Options: [inDir] :: SharedOptions -> Bool
+ BNFC.Options: [inPackage] :: SharedOptions -> Maybe String
+ BNFC.Options: [javaLexerParser] :: SharedOptions -> JavaLexerParser
+ BNFC.Options: [lang] :: SharedOptions -> String
+ BNFC.Options: [lbnfFile] :: SharedOptions -> FilePath
+ BNFC.Options: [linenumbers] :: SharedOptions -> RecordPositions
+ BNFC.Options: [make] :: SharedOptions -> Maybe String
+ BNFC.Options: [ocamlParser] :: SharedOptions -> OCamlParser
+ BNFC.Options: [outDir] :: SharedOptions -> FilePath
+ BNFC.Options: [target] :: SharedOptions -> Target
+ BNFC.Options: [tokenText] :: SharedOptions -> TokenText
+ BNFC.Options: [visualStudio] :: SharedOptions -> Bool
+ BNFC.Options: [wcf] :: SharedOptions -> Bool
+ BNFC.Options: [xml] :: SharedOptions -> Int
+ BNFC.Options: data AlexVersion
+ BNFC.Options: data HappyMode
+ BNFC.Options: data JavaLexerParser
+ BNFC.Options: data Mode
+ BNFC.Options: data OCamlParser
+ BNFC.Options: data RecordPositions
+ BNFC.Options: data SharedOptions
+ BNFC.Options: data Target
+ BNFC.Options: data TokenText
+ BNFC.Options: defaultOptions :: SharedOptions
+ BNFC.Options: help :: String
+ BNFC.Options: instance BNFC.Options.Maintained BNFC.Options.AlexVersion
+ BNFC.Options: instance BNFC.Options.Maintained BNFC.Options.HappyMode
+ BNFC.Options: instance BNFC.Options.Maintained BNFC.Options.Target
+ BNFC.Options: instance GHC.Base.Monoid (BNFC.Options.ParseOpt ())
+ BNFC.Options: instance GHC.Base.Semigroup (BNFC.Options.ParseOpt ())
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.AlexVersion
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.HappyMode
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.JavaLexerParser
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.Mode
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.OCamlParser
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.RecordPositions
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.SharedOptions
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.Target
+ BNFC.Options: instance GHC.Classes.Eq BNFC.Options.TokenText
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.AlexVersion
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.HappyMode
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.JavaLexerParser
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.Mode
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.OCamlParser
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.RecordPositions
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.SharedOptions
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.Target
+ BNFC.Options: instance GHC.Classes.Ord BNFC.Options.TokenText
+ BNFC.Options: instance GHC.Enum.Bounded BNFC.Options.AlexVersion
+ BNFC.Options: instance GHC.Enum.Bounded BNFC.Options.HappyMode
+ BNFC.Options: instance GHC.Enum.Bounded BNFC.Options.Target
+ BNFC.Options: instance GHC.Enum.Enum BNFC.Options.AlexVersion
+ BNFC.Options: instance GHC.Enum.Enum BNFC.Options.HappyMode
+ BNFC.Options: instance GHC.Enum.Enum BNFC.Options.Target
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.AlexVersion
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.HappyMode
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.JavaLexerParser
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.Mode
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.OCamlParser
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.RecordPositions
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.SharedOptions
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.Target
+ BNFC.Options: instance GHC.Show.Show BNFC.Options.TokenText
+ BNFC.Options: isDefault :: Eq a => (SharedOptions -> a) -> SharedOptions -> Bool
+ BNFC.Options: parseMode :: [String] -> (Mode, UsageWarnings)
+ BNFC.Options: printOptions :: SharedOptions -> String
+ BNFC.Options: removedIn290 :: String
+ BNFC.Options: translateOldOptions :: [String] -> ParseOpt [String]
+ BNFC.Options: type Backend = SharedOptions " Options" -> CF " Grammar" -> IO ()
+ BNFC.Options: usage :: String
+ BNFC.Par: happyError :: [Token] -> Either String a
+ BNFC.Par: myLexer :: String -> [Token]
+ BNFC.Par: pArg :: [Token] -> Either String Arg
+ BNFC.Par: pCat :: [Token] -> Either String Cat
+ BNFC.Par: pDef :: [Token] -> Either String Def
+ BNFC.Par: pExp :: [Token] -> Either String Exp
+ BNFC.Par: pExp1 :: [Token] -> Either String Exp
+ BNFC.Par: pExp2 :: [Token] -> Either String Exp
+ BNFC.Par: pGrammar :: [Token] -> Either String Grammar
+ BNFC.Par: pItem :: [Token] -> Either String Item
+ BNFC.Par: pLabel :: [Token] -> Either String Label
+ BNFC.Par: pListArg :: [Token] -> Either String [Arg]
+ BNFC.Par: pListCat :: [Token] -> Either String [Cat]
+ BNFC.Par: pListDef :: [Token] -> Either String [Def]
+ BNFC.Par: pListExp :: [Token] -> Either String [Exp]
+ BNFC.Par: pListExp2 :: [Token] -> Either String [Exp]
+ BNFC.Par: pListItem :: [Token] -> Either String [Item]
+ BNFC.Par: pListRHS :: [Token] -> Either String [RHS]
+ BNFC.Par: pListString :: [Token] -> Either String [String]
+ BNFC.Par: pMinimumSize :: [Token] -> Either String MinimumSize
+ BNFC.Par: pRHS :: [Token] -> Either String RHS
+ BNFC.Par: pReg :: [Token] -> Either String Reg
+ BNFC.Par: pReg1 :: [Token] -> Either String Reg
+ BNFC.Par: pReg2 :: [Token] -> Either String Reg
+ BNFC.Par: pReg3 :: [Token] -> Either String Reg
+ BNFC.Par: pSeparation :: [Token] -> Either String Separation
+ BNFC.PrettyPrint: ($++$) :: Doc -> Doc -> Doc
+ BNFC.PrettyPrint: (<=>) :: Doc -> Doc -> Doc
+ BNFC.PrettyPrint: codeblock :: Int -> [Doc] -> Doc
+ BNFC.PrettyPrint: parensIf :: Bool -> Doc -> Doc
+ BNFC.PrettyPrint: prettyList :: Int -> Doc -> Doc -> Doc -> Doc -> [Doc] -> Doc
+ BNFC.PrettyPrint: vcat' :: [Doc] -> Doc
+ BNFC.PrettyPrint: vsep :: [Doc] -> Doc
+ BNFC.Print: class Print a
+ BNFC.Print: concatD :: [Doc] -> Doc
+ BNFC.Print: concatS :: [ShowS] -> ShowS
+ BNFC.Print: doc :: ShowS -> Doc
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Arg
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Cat
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Def
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Exp
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Grammar
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Identifier
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Item
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Label
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.MinimumSize
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.RHS
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Reg
+ BNFC.Print: instance BNFC.Print.Print BNFC.Abs.Separation
+ BNFC.Print: instance BNFC.Print.Print GHC.Integer.Type.Integer
+ BNFC.Print: instance BNFC.Print.Print GHC.Types.Char
+ BNFC.Print: instance BNFC.Print.Print GHC.Types.Double
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.Arg]
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.Cat]
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.Def]
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.Exp]
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.Item]
+ BNFC.Print: instance BNFC.Print.Print [BNFC.Abs.RHS]
+ BNFC.Print: instance BNFC.Print.Print [GHC.Base.String]
+ BNFC.Print: instance BNFC.Print.Print a => BNFC.Print.Print [a]
+ BNFC.Print: mkEsc :: Char -> Char -> ShowS
+ BNFC.Print: parenth :: Doc -> Doc
+ BNFC.Print: prPrec :: Int -> Int -> Doc -> Doc
+ BNFC.Print: printTree :: Print a => a -> String
+ BNFC.Print: prt :: Print a => Int -> a -> Doc
+ BNFC.Print: prtList :: Print a => Int -> [a] -> Doc
+ BNFC.Print: render :: Doc -> String
+ BNFC.Print: replicateS :: Int -> ShowS -> ShowS
+ BNFC.Print: type Doc = [ShowS] -> [ShowS]
+ BNFC.Regex: instance BNFC.Regex.ToReg BNFC.Regex.CharClass
+ BNFC.Regex: instance BNFC.Regex.ToReg BNFC.Regex.CharClassUnion
+ BNFC.Regex: instance BNFC.Regex.ToReg BNFC.Regex.RC
+ BNFC.Regex: instance GHC.Base.Monoid BNFC.Regex.CharClassUnion
+ BNFC.Regex: instance GHC.Base.Semigroup BNFC.Regex.CharClassUnion
+ BNFC.Regex: instance GHC.Classes.Eq BNFC.Regex.CharClass
+ BNFC.Regex: instance GHC.Classes.Eq BNFC.Regex.CharClassAtom
+ BNFC.Regex: instance GHC.Classes.Eq BNFC.Regex.CharClassUnion
+ BNFC.Regex: instance GHC.Classes.Ord BNFC.Regex.CharClass
+ BNFC.Regex: instance GHC.Classes.Ord BNFC.Regex.CharClassAtom
+ BNFC.Regex: instance GHC.Classes.Ord BNFC.Regex.CharClassUnion
+ BNFC.Regex: instance GHC.Show.Show BNFC.Regex.CharClass
+ BNFC.Regex: instance GHC.Show.Show BNFC.Regex.CharClassAtom
+ BNFC.Regex: instance GHC.Show.Show BNFC.Regex.CharClassUnion
+ BNFC.Regex: nullable :: Reg -> Bool
+ BNFC.Regex: simpReg :: Reg -> Reg
+ BNFC.TypeChecker: BaseT :: String -> Base
+ BNFC.TypeChecker: LC :: (Base -> String) -> (Base -> String) -> ListConstructors
+ BNFC.TypeChecker: ListT :: Base -> Base
+ BNFC.TypeChecker: buildContext :: CF -> Context
+ BNFC.TypeChecker: buildSignature :: [Rule] -> Err Signature
+ BNFC.TypeChecker: checkDefinition' :: ListConstructors -> Context -> RFun -> [String] -> Exp -> Err (Telescope, (Exp, Base))
+ BNFC.TypeChecker: checkDefinitions :: CF -> Err ()
+ BNFC.TypeChecker: ctxTokens :: Context -> [String]
+ BNFC.TypeChecker: data Base
+ BNFC.TypeChecker: data ListConstructors
+ BNFC.TypeChecker: instance Control.Monad.Error.Class.MonadError GHC.Base.String BNFC.TypeChecker.Err
+ BNFC.TypeChecker: instance Control.Monad.Reader.Class.MonadReader BNFC.CF.Position BNFC.TypeChecker.Err
+ BNFC.TypeChecker: instance GHC.Base.Applicative BNFC.TypeChecker.Err
+ BNFC.TypeChecker: instance GHC.Base.Functor BNFC.TypeChecker.Err
+ BNFC.TypeChecker: instance GHC.Base.Monad BNFC.TypeChecker.Err
+ BNFC.TypeChecker: isToken :: String -> Context -> Bool
+ BNFC.TypeChecker: runTypeChecker :: Err a -> Either String a
+ BNFC.Utils: (+++) :: String -> String -> String
+ BNFC.Utils: (++++) :: String -> String -> String
+ BNFC.Utils: (+-+) :: String -> String -> String
+ BNFC.Utils: (+.+) :: String -> String -> String
+ BNFC.Utils: CamelCase :: NameStyle
+ BNFC.Utils: LowerCase :: NameStyle
+ BNFC.Utils: MixedCase :: NameStyle
+ BNFC.Utils: SnakeCase :: NameStyle
+ BNFC.Utils: UpperCase :: NameStyle
+ BNFC.Utils: applyUnless :: Bool -> (a -> a) -> a -> a
+ BNFC.Utils: applyWhen :: Bool -> (a -> a) -> a -> a
+ BNFC.Utils: camelCase :: String -> Doc
+ BNFC.Utils: camelCase_ :: String -> String
+ BNFC.Utils: cstring :: String -> Doc
+ BNFC.Utils: curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
+ BNFC.Utils: data NameStyle
+ BNFC.Utils: duplicatesOn :: (Foldable t, Ord b) => (a -> b) -> t a -> [List1 a]
+ BNFC.Utils: for :: [a] -> (a -> b) -> [b]
+ BNFC.Utils: getZonedTimeTruncatedToSeconds :: IO ZonedTime
+ BNFC.Utils: hasNumericSuffix :: String -> Maybe (String, Integer)
+ BNFC.Utils: infixr 5 +.+
+ BNFC.Utils: instance GHC.Classes.Eq BNFC.Utils.NameStyle
+ BNFC.Utils: instance GHC.Show.Show BNFC.Utils.NameStyle
+ BNFC.Utils: lowerCase :: String -> Doc
+ BNFC.Utils: mapHead :: (a -> a) -> [a] -> [a]
+ BNFC.Utils: mixedCase :: String -> Doc
+ BNFC.Utils: mkName :: [String] -> NameStyle -> String -> String
+ BNFC.Utils: mkNames :: [String] -> NameStyle -> [String] -> [String]
+ BNFC.Utils: pad :: Int -> String -> String
+ BNFC.Utils: replace :: Eq a => a -> a -> [a] -> [a]
+ BNFC.Utils: singleton :: a -> [a]
+ BNFC.Utils: snakeCase :: String -> Doc
+ BNFC.Utils: snakeCase_ :: String -> String
+ BNFC.Utils: spanEnd :: (a -> Bool) -> [a] -> ([a], [a])
+ BNFC.Utils: table :: String -> [[String]] -> [String]
+ BNFC.Utils: type ModuleName = String
+ BNFC.Utils: uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
+ BNFC.Utils: unless :: Monoid m => Bool -> m -> m
+ BNFC.Utils: unlessNull :: Monoid m => [a] -> ([a] -> m) -> m
+ BNFC.Utils: unlessNull' :: Monoid m => [a] -> (a -> [a] -> m) -> m
+ BNFC.Utils: upperCase :: String -> Doc
+ BNFC.Utils: when :: Monoid m => Bool -> m -> m
+ BNFC.Utils: writeFileRep :: FilePath -> String -> IO ()
Files
- BNFC.cabal +134/−213
- CHANGELOG.md +134/−0
- LICENSE +6/−335
- Makefile +10/−4
- README.md +151/−0
- Setup.lhs +6/−2
- changelog +0/−96
- main/Main.hs +83/−0
- runtime/Algebra/RingUtils.hs +0/−74
- runtime/Data/Matrix/Class.hs +0/−81
- runtime/Data/Matrix/Quad.hs +0/−299
- runtime/Parsing/Chart.hs +0/−76
- runtime/Parsing/TestProgram.hs +0/−84
- src/AbsBNF.hs +0/−103
- src/BNF.cf +0/−168
- src/BNFC.cf +124/−0
- src/BNFC/Abs.hs +83/−0
- src/BNFC/Backend/Agda.hs +117/−125
- src/BNFC/Backend/Base.hs +17/−13
- src/BNFC/Backend/C.hs +222/−30
- src/BNFC/Backend/C/CFtoBisonC.hs +56/−59
- src/BNFC/Backend/C/CFtoCAbs.hs +1/−28
- src/BNFC/Backend/C/CFtoCPrinter.hs +8/−32
- src/BNFC/Backend/C/CFtoCSkel.hs +1/−28
- src/BNFC/Backend/C/CFtoFlexC.hs +126/−103
- src/BNFC/Backend/C/RegToFlex.hs +33/−32
- src/BNFC/Backend/CPP/Makefile.hs +12/−4
- src/BNFC/Backend/CPP/NoSTL.hs +7/−17
- src/BNFC/Backend/CPP/NoSTL/CFtoBison.hs +3/−31
- src/BNFC/Backend/CPP/NoSTL/CFtoCPPAbs.hs +2/−27
- src/BNFC/Backend/CPP/NoSTL/CFtoFlex.hs +21/−73
- src/BNFC/Backend/CPP/PrettyPrinter.hs +1/−5
- src/BNFC/Backend/CPP/STL.hs +12/−20
- src/BNFC/Backend/CPP/STL/CFtoBisonSTL.hs +4/−30
- src/BNFC/Backend/CPP/STL/CFtoCVisitSkelSTL.hs +1/−26
- src/BNFC/Backend/CPP/STL/CFtoSTLAbs.hs +1/−25
- src/BNFC/Backend/CPP/STL/STLUtils.hs +0/−13
- src/BNFC/Backend/CSharp.hs +0/−338
- src/BNFC/Backend/CSharp/CAbstoCSharpAbs.hs +0/−274
- src/BNFC/Backend/CSharp/CAbstoCSharpAbstractVisitSkeleton.hs +0/−94
- src/BNFC/Backend/CSharp/CAbstoCSharpVisitSkeleton.hs +0/−115
- src/BNFC/Backend/CSharp/CFtoCSharpPrinter.hs +0/−452
- src/BNFC/Backend/CSharp/CFtoGPLEX.hs +0/−225
- src/BNFC/Backend/CSharp/CFtoGPPG.hs +0/−285
- src/BNFC/Backend/CSharp/CSharpUtils.hs +0/−152
- src/BNFC/Backend/CSharp/RegToGPLEX.hs +0/−73
- src/BNFC/Backend/Common/Makefile.hs +1/−1
- src/BNFC/Backend/Common/NamedVariables.hs +0/−25
- src/BNFC/Backend/Common/OOAbstract.hs +0/−26
- src/BNFC/Backend/Haskell.hs +11/−54
- src/BNFC/Backend/Haskell/CFtoAbstract.hs +1/−14
- src/BNFC/Backend/Haskell/CFtoAlex.hs +0/−199
- src/BNFC/Backend/Haskell/CFtoAlex2.hs +0/−343
- src/BNFC/Backend/Haskell/CFtoAlex3.hs +18/−35
- src/BNFC/Backend/Haskell/CFtoHappy.hs +14/−19
- src/BNFC/Backend/Haskell/CFtoLayout.hs +2/−16
- src/BNFC/Backend/Haskell/CFtoPrinter.hs +0/−13
- src/BNFC/Backend/Haskell/CFtoTemplate.hs +1/−14
- src/BNFC/Backend/Haskell/HsOpts.hs +0/−21
- src/BNFC/Backend/Haskell/MkErrM.hs +3/−14
- src/BNFC/Backend/Haskell/MkSharedString.hs +0/−92
- src/BNFC/Backend/Haskell/RegToAlex.hs +0/−84
- src/BNFC/Backend/Haskell/ToCNF.hs +0/−280
- src/BNFC/Backend/HaskellGADT.hs +3/−27
- src/BNFC/Backend/HaskellGADT/CFtoAbstractGADT.hs +1/−14
- src/BNFC/Backend/HaskellGADT/CFtoTemplateGADT.hs +1/−14
- src/BNFC/Backend/HaskellGADT/HaskellGADTCommon.hs +1/−14
- src/BNFC/Backend/HaskellProfile.hs +0/−204
- src/BNFC/Backend/HaskellProfile/CFtoHappyProfile.hs +0/−190
- src/BNFC/Backend/Java.hs +2/−15
- src/BNFC/Backend/Java/CFtoAbstractVisitor.hs +0/−13
- src/BNFC/Backend/Java/CFtoAllVisitor.hs +0/−13
- src/BNFC/Backend/Java/CFtoAntlr4Lexer.hs +3/−28
- src/BNFC/Backend/Java/CFtoAntlr4Parser.hs +3/−29
- src/BNFC/Backend/Java/CFtoComposVisitor.hs +0/−13
- src/BNFC/Backend/Java/CFtoCup15.hs +3/−26
- src/BNFC/Backend/Java/CFtoFoldVisitor.hs +0/−13
- src/BNFC/Backend/Java/CFtoJLex15.hs +2/−26
- src/BNFC/Backend/Java/CFtoJavaAbs15.hs +2/−27
- src/BNFC/Backend/Java/CFtoJavaPrinter15.hs +2/−24
- src/BNFC/Backend/Java/CFtoVisitSkel15.hs +2/−27
- src/BNFC/Backend/Java/RegToAntlrLexer.hs +38/−34
- src/BNFC/Backend/Java/RegToJLex.hs +1/−1
- src/BNFC/Backend/Latex.hs +10/−24
- src/BNFC/Backend/OCaml.hs +9/−17
- src/BNFC/Backend/OCaml/CFtoOCamlAbs.hs +0/−13
- src/BNFC/Backend/OCaml/CFtoOCamlLex.hs +110/−101
- src/BNFC/Backend/OCaml/CFtoOCamlPrinter.hs +0/−13
- src/BNFC/Backend/OCaml/CFtoOCamlShow.hs +0/−13
- src/BNFC/Backend/OCaml/CFtoOCamlTemplate.hs +0/−13
- src/BNFC/Backend/OCaml/CFtoOCamlTest.hs +0/−18
- src/BNFC/Backend/OCaml/CFtoOCamlYacc.hs +3/−15
- src/BNFC/Backend/OCaml/OCamlUtil.hs +0/−13
- src/BNFC/Backend/Pygments.hs +1/−1
- src/BNFC/Backend/Txt2Tag.hs +2/−15
- src/BNFC/Backend/XML.hs +0/−13
- src/BNFC/CF.hs +62/−112
- src/BNFC/Check/EmptyTypes.hs +81/−0
- src/BNFC/GetCF.hs +208/−197
- src/BNFC/Lex.hs +525/−0
- src/BNFC/Lex.x +199/−0
- src/BNFC/Lexing.hs +2/−2
- src/BNFC/License.hs +22/−0
- src/BNFC/MultiView.hs +0/−126
- src/BNFC/Options.hs +81/−64
- src/BNFC/Par.hs +1596/−0
- src/BNFC/Par.y +259/−0
- src/BNFC/PrettyPrint.hs +0/−9
- src/BNFC/Print.hs +230/−0
- src/BNFC/Regex.hs +4/−4
- src/BNFC/ToCNFCore.hs +0/−315
- src/BNFC/Utils.hs +65/−52
- src/Data/Pair.hs +0/−19
- src/LexBNF.hs +0/−8786
- src/LexBNF.x +0/−202
- src/Main.hs +0/−102
- src/Makefile +65/−0
- src/ParBNF.hs +0/−3273
- src/ParBNF.y +0/−280
- src/PrintBNF.hs +0/−278
- stack-8.10.2.yaml +2/−34
- stack-8.10.3.yaml +34/−0
- test/BNFC/Backend/CSharpSpec.hs +0/−26
- test/BNFC/GetCFSpec.hs +4/−5
- test/doctests.hs +34/−15
BNFC.cabal view
@@ -1,10 +1,12 @@ Name: BNFC-Version: 2.8.4+Version: 2.9.0 cabal-version: >= 1.10-build-type: Simple+ -- ? set to >=1.24 for the custom-setup section?+ -- ? set to >=2.0 for the build-tools: hspec-discover+build-type: Custom category: Development-Copyright: (c) Andreas Abel, Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt, Paul Callaghan, Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Pascal Hof, Simon Huber, Patrik Jansson, Kristofer Johannisson, Antti-Juhani Kaijanaho, Andreas Lööw, Justin Meiners, Kent Mein, Ulf Norell, Gabriele Paganelli, Michael Pellauer, Fabian Ruch, and Aarne Ranta 2002 - 2020. Free software under GNU General Public License (GPL).-License: GPL-2+Copyright: (c) Andreas Abel, Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt, Paul Callaghan, Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Pascal Hof, Simon Huber, Patrik Jansson, Kristofer Johannisson, Antti-Juhani Kaijanaho, Andreas Lööw, Justin Meiners, Kent Mein, Ulf Norell, Gabriele Paganelli, Michael Pellauer, Fabian Ruch, and Aarne Ranta 2002 - 2020. Free software under the BSD 3-clause license.+License: BSD3 License-File: LICENSE Maintainer: bnfc-dev@googlegroups.com Homepage: http://bnfc.digitalgrammars.com/@@ -13,29 +15,34 @@ Description: The BNF Converter is a compiler construction tool generating a compiler front-end from a Labelled BNF grammar. It was originally written to generate Haskell code,- but can also be used for generating Agda, C, C++, C#, Java, Ocaml and XML code.+ but can also be used for generating Agda, C, C++, Java, Ocaml and XML code. . Given a Labelled BNF grammar the tool produces:- an abstract syntax as a Haskell, Agda, C, C++, C#, Ocaml module or Java directory,+ an abstract syntax as a Haskell, Agda, C, C++, Ocaml module or Java directory, a case skeleton for the abstract syntax in the same language, an Alex, JLex, or Flex lexer generator file, a Happy, CUP, Bison, or Antlr parser generator file,- a pretty-printer as a Haskell, Agda, C, C++, C#, Java, or Ocaml module,+ a pretty-printer as a Haskell, Agda, C, C++, Java, or Ocaml module, an XML representation, a LaTeX file containing a readable specification of the language. -tested-with: GHC == 7.10.3- GHC == 8.0.2- GHC == 8.2.2- GHC == 8.4.4- GHC == 8.6.5- GHC == 8.8.4- GHC == 8.10.2+tested-with:+ GHC == 7.10.3+ GHC == 8.0.2+ GHC == 8.2.2+ GHC == 8.4.4+ GHC == 8.6.5+ GHC == 8.8.4+ GHC == 8.10.3 Extra-source-files:- src/BNF.cf- changelog+ README.md+ CHANGELOG.md+ -- LICENSE is automatically included Makefile+ src/BNFC.cf+ src/Makefile+ stack-8.10.3.yaml stack-8.10.2.yaml stack-8.8.4.yaml stack-8.8.3.yaml@@ -56,25 +63,58 @@ type: git location: git://github.com/BNFC/bnfc.git subdir: source- tag: v2.8.4+ tag: v2.9.0 -Library- hs-source-dirs: runtime, src- default-language: Haskell2010- Build-Depends: base>=4.8 && <5, array- exposed-modules:- Algebra.RingUtils- Data.Pair- Data.Matrix.Quad- Data.Matrix.Class- Parsing.Chart- Parsing.TestProgram+-- Setup using https://github.com/haskellari/cabal-doctest+-- Regarding Cabal >= 1.24, see+-- https://github.com/haskell-CI/haskell-ci/issues/81#issuecomment-304087288+-- Cabal >= 2.0 is for build-tools: hspec-discover+custom-setup+ setup-depends:+ base >= 4 && <5,+ Cabal >= 2.0,+ cabal-doctest >= 1 && < 1.1 -Executable bnfc- default-language: Haskell2010- Build-Depends:- base>=4.8 && <5,- semigroups,+executable bnfc+ default-language: Haskell2010+ main-is: Main.hs+ hs-source-dirs: main+ build-depends:+ BNFC+ , base+ other-modules:+ -- Generated by cabal+ Paths_BNFC+ default-extensions:+ -- Keep the list of language extensions in sync with its other occurrences.+ -- Keep in alphabetical order.+ -- No CPP since doctests don't like it.+ DefaultSignatures+ DoAndIfThenElse+ FlexibleContexts+ FlexibleInstances+ LambdaCase+ OverloadedStrings+ PatternGuards+ RecordWildCards+ ScopedTypeVariables+ TupleSections++-- The library goal is there for internal reasons:+-- It gives us a dependency BNFC which we can use to steer+-- the build order. For doctests, we need Build_doctests,+-- which is generated by Setup.lhs when building the library.+--+-- As added value, the bundling of the library saves us+-- from compiling every module twice:+-- once for the executable, and once for unit-tests.+-- Now, both can depend on the library.++library+ default-language:+ Haskell2010+ build-depends:+ base >=4.8 && < 5, mtl >= 2.2.1, directory, array,@@ -83,33 +123,45 @@ pretty >=1.1 && <1.2, filepath, deepseq,+ string-qq, time- build-tools: alex, happy- Main-is: Main.hs- HS-source-dirs: src+ if impl(ghc < 8.0)+ build-depends:+ semigroups+ build-tools:+ alex,+ happy+ hs-source-dirs:+ src default-extensions:- CPP+ -- Keep the list of language extensions in sync with its other occurrences.+ -- Keep in alphabetical order.+ -- No CPP since doctests doesn't like it.+ DefaultSignatures DoAndIfThenElse FlexibleContexts+ FlexibleInstances LambdaCase OverloadedStrings PatternGuards RecordWildCards ScopedTypeVariables TupleSections- Other-modules:- -- generated by cabal+ other-modules:+ -- Generated by cabal Paths_BNFC+ exposed-modules:+ -- Generated from LICENSE+ BNFC.License -- Generated by bnfc- LexBNF- ParBNF- AbsBNF- PrintBNF+ BNFC.Abs+ BNFC.Lex+ BNFC.Par+ BNFC.Print -- BNFC core BNFC.Utils BNFC.CF- BNFC.ToCNFCore- BNFC.MultiView+ BNFC.Check.EmptyTypes BNFC.Regex BNFC.TypeChecker BNFC.GetCF@@ -122,7 +174,6 @@ BNFC.Backend.Common.StrUtils BNFC.Options BNFC.PrettyPrint- Data.Pair -- Documentation backends BNFC.Backend.Latex@@ -130,23 +181,15 @@ -- Haskell backend BNFC.Backend.Haskell- BNFC.Backend.Haskell.ToCNF- BNFC.Backend.Haskell.RegToAlex BNFC.Backend.Haskell.CFtoTemplate BNFC.Backend.Haskell.CFtoAlex3- BNFC.Backend.Haskell.CFtoAlex2- BNFC.Backend.Haskell.CFtoAlex BNFC.Backend.Haskell.CFtoHappy BNFC.Backend.Haskell.CFtoPrinter BNFC.Backend.Haskell.CFtoAbstract BNFC.Backend.Haskell.CFtoLayout BNFC.Backend.Haskell.MkErrM- BNFC.Backend.Haskell.MkSharedString BNFC.Backend.Haskell.HsOpts BNFC.Backend.Haskell.Utils- -- Profile- BNFC.Backend.HaskellProfile- BNFC.Backend.HaskellProfile.CFtoHappyProfile -- Haskell GADT BNFC.Backend.HaskellGADT BNFC.Backend.HaskellGADT.HaskellGADTCommon@@ -189,17 +232,6 @@ BNFC.Backend.CPP.STL.STLUtils BNFC.Backend.CPP.STL.CFtoCVisitSkelSTL - -- C# backend- BNFC.Backend.CSharp- BNFC.Backend.CSharp.RegToGPLEX- BNFC.Backend.CSharp.CFtoGPLEX- BNFC.Backend.CSharp.CSharpUtils- BNFC.Backend.CSharp.CFtoCSharpPrinter- BNFC.Backend.CSharp.CAbstoCSharpAbs- BNFC.Backend.CSharp.CAbstoCSharpAbstractVisitSkeleton- BNFC.Backend.CSharp.CAbstoCSharpVisitSkeleton- BNFC.Backend.CSharp.CFtoGPPG- -- Java backend BNFC.Backend.Java BNFC.Backend.Java.CFtoAntlr4Lexer@@ -226,14 +258,17 @@ -- Agda backend BNFC.Backend.Agda --- --- Testing ---------------------------------------------------------------Test-suite unit-tests- default-language: Haskell2010- Type: exitcode-stdio-1.0- Build-Depends:+----- Testing --------------------------------------------------------------++test-suite unit-tests+ default-language:+ Haskell2010+ type:+ exitcode-stdio-1.0+ build-depends:+ BNFC, -- base-4.9 would be needed for Show1 needed for Show WriterT- base>=4.8 && <5,- semigroups,+ base >= 4.8 && < 5, mtl >= 2.2.1, directory, array,@@ -246,21 +281,36 @@ temporary, containers, deepseq,+ string-qq, time- Main-is: unit-tests.hs- HS-source-dirs: src test- ghc-options: -W+ if impl(ghc < 8.0)+ build-depends:+ semigroups+ build-tools:+ alex,+ happy,+ hspec-discover+ main-is:+ unit-tests.hs+ hs-source-dirs:+ test+ ghc-options:+ -W default-extensions:- CPP+ -- Keep the list of language extensions in sync with its other occurrences.+ -- Keep in alphabetical order.+ -- No CPP since doctests doesn't like it.+ DefaultSignatures DoAndIfThenElse FlexibleContexts+ FlexibleInstances LambdaCase OverloadedStrings PatternGuards RecordWildCards ScopedTypeVariables TupleSections- Other-modules:+ other-modules: BNFC.CFSpec BNFC.GetCFSpec BNFC.OptionsSpec@@ -270,7 +320,6 @@ BNFC.Backend.Common.NamedVariablesSpec BNFC.Backend.CPP.NoSTLSpec BNFC.Backend.CPP.STLSpec- BNFC.Backend.CSharpSpec BNFC.Backend.CSpec BNFC.Backend.HaskellSpec BNFC.Backend.HaskellGADTSpec@@ -278,145 +327,17 @@ BNFC.Backend.JavaSpec BNFC.Backend.LatexSpec BNFC.Backend.OCamlSpec-- -- Repetition of modules from main:- ------------------------------------- -- generated by cabal+ -- Generated by cabal Paths_BNFC- -- Generated by bnfc- LexBNF- ParBNF- AbsBNF- PrintBNF - -- BNFC core- BNFC.Utils- BNFC.CF- BNFC.ToCNFCore- BNFC.MultiView- BNFC.Regex- BNFC.TypeChecker- BNFC.GetCF- BNFC.Lexing- BNFC.Backend.Base- BNFC.Backend.Common- BNFC.Backend.Common.Makefile- BNFC.Backend.Common.NamedVariables- BNFC.Backend.Common.OOAbstract- BNFC.Backend.Common.StrUtils- BNFC.Options- BNFC.PrettyPrint- Data.Pair-- -- Documentation backends- BNFC.Backend.Latex- BNFC.Backend.Txt2Tag-- -- Haskell backend- BNFC.Backend.Haskell- BNFC.Backend.Haskell.ToCNF- BNFC.Backend.Haskell.RegToAlex- BNFC.Backend.Haskell.CFtoTemplate- BNFC.Backend.Haskell.CFtoAlex3- BNFC.Backend.Haskell.CFtoAlex2- BNFC.Backend.Haskell.CFtoAlex- BNFC.Backend.Haskell.CFtoHappy- BNFC.Backend.Haskell.CFtoPrinter- BNFC.Backend.Haskell.CFtoAbstract- BNFC.Backend.Haskell.CFtoLayout- BNFC.Backend.Haskell.MkErrM- BNFC.Backend.Haskell.MkSharedString- BNFC.Backend.Haskell.HsOpts- BNFC.Backend.Haskell.Utils- -- Profile- BNFC.Backend.HaskellProfile- BNFC.Backend.HaskellProfile.CFtoHappyProfile- -- Haskell GADT- BNFC.Backend.HaskellGADT- BNFC.Backend.HaskellGADT.HaskellGADTCommon- BNFC.Backend.HaskellGADT.CFtoTemplateGADT- BNFC.Backend.HaskellGADT.CFtoAbstractGADT-- -- O'Caml backend- BNFC.Backend.OCaml- BNFC.Backend.OCaml.OCamlUtil- BNFC.Backend.OCaml.CFtoOCamlTest- BNFC.Backend.OCaml.CFtoOCamlShow- BNFC.Backend.OCaml.CFtoOCamlPrinter- BNFC.Backend.OCaml.CFtoOCamlTemplate- BNFC.Backend.OCaml.CFtoOCamlAbs- BNFC.Backend.OCaml.CFtoOCamlYacc- BNFC.Backend.OCaml.CFtoOCamlLex-- -- C backend- BNFC.Backend.C- BNFC.Backend.C.CFtoCPrinter- BNFC.Backend.C.CFtoCSkel- BNFC.Backend.C.CFtoBisonC- BNFC.Backend.C.CFtoFlexC- BNFC.Backend.C.CFtoCAbs- BNFC.Backend.C.RegToFlex-- -- C++ backend- BNFC.Backend.CPP.PrettyPrinter- BNFC.Backend.CPP.Makefile- BNFC.Backend.CPP.Naming- BNFC.Backend.CPP.NoSTL- BNFC.Backend.CPP.NoSTL.CFtoFlex- BNFC.Backend.CPP.NoSTL.CFtoBison- BNFC.Backend.CPP.NoSTL.CFtoCPPAbs-- -- C++ STL backend- BNFC.Backend.CPP.STL- BNFC.Backend.CPP.STL.CFtoBisonSTL- BNFC.Backend.CPP.STL.CFtoSTLAbs- BNFC.Backend.CPP.STL.STLUtils- BNFC.Backend.CPP.STL.CFtoCVisitSkelSTL-- -- C# backend- BNFC.Backend.CSharp- BNFC.Backend.CSharp.RegToGPLEX- BNFC.Backend.CSharp.CFtoGPLEX- BNFC.Backend.CSharp.CSharpUtils- BNFC.Backend.CSharp.CFtoCSharpPrinter- BNFC.Backend.CSharp.CAbstoCSharpAbs- BNFC.Backend.CSharp.CAbstoCSharpAbstractVisitSkeleton- BNFC.Backend.CSharp.CAbstoCSharpVisitSkeleton- BNFC.Backend.CSharp.CFtoGPPG-- -- Java backend- BNFC.Backend.Java- BNFC.Backend.Java.CFtoAntlr4Lexer- BNFC.Backend.Java.CFtoAntlr4Parser- BNFC.Backend.Java.CFtoJavaAbs15- BNFC.Backend.Java.CFtoAllVisitor- BNFC.Backend.Java.CFtoFoldVisitor- BNFC.Backend.Java.CFtoAbstractVisitor- BNFC.Backend.Java.CFtoComposVisitor- BNFC.Backend.Java.CFtoVisitSkel15- BNFC.Backend.Java.CFtoJavaPrinter15- BNFC.Backend.Java.CFtoJLex15- BNFC.Backend.Java.CFtoCup15- BNFC.Backend.Java.RegToJLex- BNFC.Backend.Java.RegToAntlrLexer- BNFC.Backend.Java.Utils-- -- XML backend- BNFC.Backend.XML-- -- Pygments backend- BNFC.Backend.Pygments-- -- Agda backend- BNFC.Backend.Agda---Test-suite bnfc-doctests+test-suite doctests default-language: Haskell2010 type: exitcode-stdio-1.0 ghc-options: -threaded default-extensions: CPP main-is: doctests.hs- build-depends: base, doctest >= 0.8- HS-source-dirs: test+ build-depends: base, doctest >= 0.8, filepath, BNFC+ -- The dependency BNFC ensures the build of the library first+ -- and hence, the presence of Build_doctests.+ -- See https://hackage.haskell.org/package/cabal-doctest+ hs-source-dirs: test
+ CHANGELOG.md view
@@ -0,0 +1,134 @@+# 2.9.0++Andreas Abel <andreas.abel@gu.se> December 2020++## Major changes++* New license: BSD 3-clause [#308]+* LBNF: removed `delimiters` pragma [#308]+* Haskell: removed options `--alex1`, `--alex2`, `--sharestrings`, `--profile`, and `--cnf` [#265]+* C#: backend removed [#265]++## Bug fixes++* LBNF: allow list categories in `entrypoints` pragma [#306]+* LBNF: report clashes between token and ordinary categories [#323]+* C: `strdup` is not part of C89 standard, `_POSIX_C_SOURCE` required [#318]+* C/C++: fixed buffer overrun in `String` literal lexer [#316]+* C++: fixed regressions (one of them #310) introduced by #288+* C/C++/OCaml: allow unicode characters in token definitions [#324]+* C/OCaml: sanitize grammar file names [#325]+* Java/ANTLR: removed superfluous quotation in lexer character sets [#319]++# 2.8.4++Andreas Abel <andreas.abel@gu.se> October 2020++* GHC versions 7.10 - 8.10 supported, dropped GHC 7.6 and 7.8+* LBNF: whitespace list separators are now accepted; treated like "" [#70]+* `define` pragma now implemented by all maintained backends [#266, #285]+* BNFC performs more sanity checks on the grammar, reports errors with source locations [#186, #213, #214]+* option `--check` to only perform sanity checks [#286]+* Backends now more resilient against keyword and name clashes (e.g. via qualified imports) [#278, #289]+* Haskell: new option `--text-token` to use `Data.Text` instead of `String` in the lexer [#167]+* Haskell: allow block comment delimiters of any length [#169, #202]+* Haskell: define `Err` monad as `Either String` [#273], migration guide at https://bnfc.readthedocs.io/en/v2.8.4/user_guide.html#haskell-backend+* Haskell: `IsString` instances for `Ident`-like token types [#192]+* C/C++/Java: support multiple block comment forms per grammar [#202]+* C++(STL): parser now throws exception on parse error [#288]+* C++: fixed quadratic behavior in C++-generated printer (regression in 2.8.2)+* Java: escape JFlex special characters [#299]+* Java/ANTLR: emit start rules to work around ANTLR issue #2689 [#272]+* Ocaml: new flag `--menhir` to generate parser with menhir instead of ocamlyacc+* Bug fixes: #163, #169, #196, #212, #235, #256, #264, #269, #274, #276, #277, #279, #282, #283, #290+* Fact-checking and revising LBNF documentation at https://bnfc.readthedocs.io/en/v2.8.4/lbnf.html++# 2.8.3++Andreas Abel <andreas.abel@gu.se> August 2019++* GHC 8.8 compatibility+* Stack installation supported by provided .yaml files [#198]+* Unicode support in lexer, excl. C, C++ and Ocaml [#249]+* LBNF: support \r (carriage return) and \f (form feed) in token declaration [#257]+* LBNF: allow numbered categories (like Foo2) independent of coercions [#210]+* Agda: new (experimental) backend, providing bindings to AST/parser/printer of Haskell backend+* C: supports now the -l option to give error locations [#238]+* C: correct function names in generated skeletons [#239]+* C, C++: handle regular expression difference (subtraction) correctly [#237]+* Haskell: generates now more fine-grained Makefile that invokes bnfc on changed .cf file+* Haskell: use qualified import of AST in generated printer [#128,#228]+* Haskell: printer code no longer produces deprecation warning concerning OverlappingInstances [#233]+* Haskell/CNF: fixed problem with Any type in generated code [#216]+* Haskell/CNF: generated test program now same name (Test) as w/o --cnf+* Haskell/GLR: correct module header in .y file [#252]++# 2.8.2++Andreas Abel <andreas.abel@gu.se> November 2018++* GHC 8.4 compatibility [#227,#236]+* bnfc now puts current timestamp on all created files, even unchanged ones [#219]+* bnfc is now more accepting about border-line terminals [#149]+* Improved error messages [#144] in particular on undefined categories [#151]+* C: Emit correct function prototypes [#185]+* C++: Fix buffer overrun in pretty printer [#242]+* C++: Fix regression introduced in 2.8 in Skeleton.H [#164]+* C++: Replace `%name-prefix` with `%define api.prefix` in bison files [#181]+* C++: Fix a bug that appeared if you had a category named "List"+* C, C++: Add usage output to the test program [#141]+* C, C++: Fix a bug in the parser file when using -p [#172]+* C, C++, OCaml, Java: Accept ' or " as comment delimiters [#146]+* Haskell: Generated code mostly hlint-warning free+* Haskell: Small fixes [#166,#170,#222]+* Java: Add an experimental ANTLR4 backend [#155]+* Java: Add support for passing line numbers to parser [#217,#224,#226]+* OCaml: Reserved symbols now have a higher precedence than predefined+ tokens as in Haskell+* Some updates of the documentation [#211,#223]+* And various small fixes [#139,#159,#195,#201,#215]++# 2.8.1++Grégoire Détrez <gregoire.detrez@gu.se> February 2016++* Fix compatibility with GHC 7.10.2 and Alex 3.14+* Fixed #160++# 2.8 Grégoire Détrez <gregoire.detrez@gu.se> May 2015++* Builds with ghc 7.10.1+* Add support for JFlex (java)+* Add an option to generate files in an other directory+* Add an experimental option that turns the AST into a parametrized functor (in Haskell only)+* New pygment backend to generate syntax highlighters+* Bug fixes++# 2.7.1++Grégoire Détrez <gregoire.detrez@gu.se> October 2014++* Generated haskell code is now warning free+* Removed unused terminal in happy+* Correctly escape backslashes in symbols+* Fix problem that was preventing custom tokens to work in OCaml if they conflict with the build-in Ident+* BNFC build is also warning free (ghc 7.4.2)+* Test programs return non-zerro exit code on parse error++# 2.7.0.0++Grégoire Détrez <gregoire.detrez@gu.se> September 2014++* Add token support for Ocaml+* New option parser+* Adds an optional argument to change Makefile name+* Add a --ghc option to derive Data, Typeable, Generic in Haskell+* New online documentation (https://bnfc.readthedocs.org)+* Derive ``Read`` for newtype decls in Haskell+* New option to get the version number --version+* Remove the F# backend+* Remove the Java4 backend+* New Applicative and Alternative instances to ``Err``+* Remove the coupling between building the parser and the pdf from latex+* Improvement to the CNF Backend+* Bug fixes #92, #21, #34, #33, #90, #30, #60
LICENSE view
@@ -1,340 +1,11 @@- GNU GENERAL PUBLIC LICENSE- Version 2, June 1991-- Copyright (C) 1989, 1991 Free Software Foundation, Inc.- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA- Everyone is permitted to copy and distribute verbatim copies- of this license document, but changing it is not allowed.-- Preamble-- The licenses for most software are designed to take away your-freedom to share and change it. By contrast, the GNU General Public-License is intended to guarantee your freedom to share and change free-software--to make sure the software is free for all its users. This-General Public License applies to most of the Free Software-Foundation's software and to any other program whose authors commit to-using it. (Some other Free Software Foundation software is covered by-the GNU Library General Public License instead.) You can apply it to-your programs, too.-- When we speak of free software, we are referring to freedom, not-price. Our General Public Licenses are designed to make sure that you-have the freedom to distribute copies of free software (and charge for-this service if you wish), that you receive source code or can get it-if you want it, that you can change the software or use pieces of it-in new free programs; and that you know you can do these things.-- To protect your rights, we need to make restrictions that forbid-anyone to deny you these rights or to ask you to surrender the rights.-These restrictions translate to certain responsibilities for you if you-distribute copies of the software, or if you modify it.-- For example, if you distribute copies of such a program, whether-gratis or for a fee, you must give the recipients all the rights that-you have. You must make sure that they, too, receive or can get the-source code. And you must show them these terms so they know their-rights.-- We protect your rights with two steps: (1) copyright the software, and-(2) offer you this license which gives you legal permission to copy,-distribute and/or modify the software.-- Also, for each author's protection and ours, we want to make certain-that everyone understands that there is no warranty for this free-software. If the software is modified by someone else and passed on, we-want its recipients to know that what they have is not the original, so-that any problems introduced by others will not reflect on the original-authors' reputations.-- Finally, any free program is threatened constantly by software-patents. We wish to avoid the danger that redistributors of a free-program will individually obtain patent licenses, in effect making the-program proprietary. To prevent this, we have made it clear that any-patent must be licensed for everyone's free use or not licensed at all.-- The precise terms and conditions for copying, distribution and-modification follow.-- GNU GENERAL PUBLIC LICENSE- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION-- 0. This License applies to any program or other work which contains-a notice placed by the copyright holder saying it may be distributed-under the terms of this General Public License. The "Program", below,-refers to any such program or work, and a "work based on the Program"-means either the Program or any derivative work under copyright law:-that is to say, a work containing the Program or a portion of it,-either verbatim or with modifications and/or translated into another-language. (Hereinafter, translation is included without limitation in-the term "modification".) Each licensee is addressed as "you".--Activities other than copying, distribution and modification are not-covered by this License; they are outside its scope. The act of-running the Program is not restricted, and the output from the Program-is covered only if its contents constitute a work based on the-Program (independent of having been made by running the Program).-Whether that is true depends on what the Program does.-- 1. You may copy and distribute verbatim copies of the Program's-source code as you receive it, in any medium, provided that you-conspicuously and appropriately publish on each copy an appropriate-copyright notice and disclaimer of warranty; keep intact all the-notices that refer to this License and to the absence of any warranty;-and give any other recipients of the Program a copy of this License-along with the Program.--You may charge a fee for the physical act of transferring a copy, and-you may at your option offer warranty protection in exchange for a fee.-- 2. You may modify your copy or copies of the Program or any portion-of it, thus forming a work based on the Program, and copy and-distribute such modifications or work under the terms of Section 1-above, provided that you also meet all of these conditions:-- a) You must cause the modified files to carry prominent notices- stating that you changed the files and the date of any change.-- b) You must cause any work that you distribute or publish, that in- whole or in part contains or is derived from the Program or any- part thereof, to be licensed as a whole at no charge to all third- parties under the terms of this License.-- c) If the modified program normally reads commands interactively- when run, you must cause it, when started running for such- interactive use in the most ordinary way, to print or display an- announcement including an appropriate copyright notice and a- notice that there is no warranty (or else, saying that you provide- a warranty) and that users may redistribute the program under- these conditions, and telling the user how to view a copy of this- License. (Exception: if the Program itself is interactive but- does not normally print such an announcement, your work based on- the Program is not required to print an announcement.)--These requirements apply to the modified work as a whole. If-identifiable sections of that work are not derived from the Program,-and can be reasonably considered independent and separate works in-themselves, then this License, and its terms, do not apply to those-sections when you distribute them as separate works. But when you-distribute the same sections as part of a whole which is a work based-on the Program, the distribution of the whole must be on the terms of-this License, whose permissions for other licensees extend to the-entire whole, and thus to each and every part regardless of who wrote it.--Thus, it is not the intent of this section to claim rights or contest-your rights to work written entirely by you; rather, the intent is to-exercise the right to control the distribution of derivative or-collective works based on the Program.--In addition, mere aggregation of another work not based on the Program-with the Program (or with a work based on the Program) on a volume of-a storage or distribution medium does not bring the other work under-the scope of this License.-- 3. You may copy and distribute the Program (or a work based on it,-under Section 2) in object code or executable form under the terms of-Sections 1 and 2 above provided that you also do one of the following:-- a) Accompany it with the complete corresponding machine-readable- source code, which must be distributed under the terms of Sections- 1 and 2 above on a medium customarily used for software interchange; or,-- b) Accompany it with a written offer, valid for at least three- years, to give any third party, for a charge no more than your- cost of physically performing source distribution, a complete- machine-readable copy of the corresponding source code, to be- distributed under the terms of Sections 1 and 2 above on a medium- customarily used for software interchange; or,-- c) Accompany it with the information you received as to the offer- to distribute corresponding source code. (This alternative is- allowed only for noncommercial distribution and only if you- received the program in object code or executable form with such- an offer, in accord with Subsection b above.)--The source code for a work means the preferred form of the work for-making modifications to it. For an executable work, complete source-code means all the source code for all modules it contains, plus any-associated interface definition files, plus the scripts used to-control compilation and installation of the executable. However, as a-special exception, the source code distributed need not include-anything that is normally distributed (in either source or binary-form) with the major components (compiler, kernel, and so on) of the-operating system on which the executable runs, unless that component-itself accompanies the executable.--If distribution of executable or object code is made by offering-access to copy from a designated place, then offering equivalent-access to copy the source code from the same place counts as-distribution of the source code, even though third parties are not-compelled to copy the source along with the object code.-- 4. You may not copy, modify, sublicense, or distribute the Program-except as expressly provided under this License. Any attempt-otherwise to copy, modify, sublicense or distribute the Program is-void, and will automatically terminate your rights under this License.-However, parties who have received copies, or rights, from you under-this License will not have their licenses terminated so long as such-parties remain in full compliance.-- 5. You are not required to accept this License, since you have not-signed it. However, nothing else grants you permission to modify or-distribute the Program or its derivative works. These actions are-prohibited by law if you do not accept this License. Therefore, by-modifying or distributing the Program (or any work based on the-Program), you indicate your acceptance of this License to do so, and-all its terms and conditions for copying, distributing or modifying-the Program or works based on it.-- 6. Each time you redistribute the Program (or any work based on the-Program), the recipient automatically receives a license from the-original licensor to copy, distribute or modify the Program subject to-these terms and conditions. You may not impose any further-restrictions on the recipients' exercise of the rights granted herein.-You are not responsible for enforcing compliance by third parties to-this License.-- 7. If, as a consequence of a court judgment or allegation of patent-infringement or for any other reason (not limited to patent issues),-conditions are imposed on you (whether by court order, agreement or-otherwise) that contradict the conditions of this License, they do not-excuse you from the conditions of this License. If you cannot-distribute so as to satisfy simultaneously your obligations under this-License and any other pertinent obligations, then as a consequence you-may not distribute the Program at all. For example, if a patent-license would not permit royalty-free redistribution of the Program by-all those who receive copies directly or indirectly through you, then-the only way you could satisfy both it and this License would be to-refrain entirely from distribution of the Program.--If any portion of this section is held invalid or unenforceable under-any particular circumstance, the balance of the section is intended to-apply and the section as a whole is intended to apply in other-circumstances.--It is not the purpose of this section to induce you to infringe any-patents or other property right claims or to contest validity of any-such claims; this section has the sole purpose of protecting the-integrity of the free software distribution system, which is-implemented by public license practices. Many people have made-generous contributions to the wide range of software distributed-through that system in reliance on consistent application of that-system; it is up to the author/donor to decide if he or she is willing-to distribute software through any other system and a licensee cannot-impose that choice.--This section is intended to make thoroughly clear what is believed to-be a consequence of the rest of this License.-- 8. If the distribution and/or use of the Program is restricted in-certain countries either by patents or by copyrighted interfaces, the-original copyright holder who places the Program under this License-may add an explicit geographical distribution limitation excluding-those countries, so that distribution is permitted only in or among-countries not thus excluded. In such case, this License incorporates-the limitation as if written in the body of this License.-- 9. The Free Software Foundation may publish revised and/or new versions-of the General Public License from time to time. Such new versions will-be similar in spirit to the present version, but may differ in detail to-address new problems or concerns.--Each version is given a distinguishing version number. If the Program-specifies a version number of this License which applies to it and "any-later version", you have the option of following the terms and conditions-either of that version or of any later version published by the Free-Software Foundation. If the Program does not specify a version number of-this License, you may choose any version ever published by the Free Software-Foundation.-- 10. If you wish to incorporate parts of the Program into other free-programs whose distribution conditions are different, write to the author-to ask for permission. For software which is copyrighted by the Free-Software Foundation, write to the Free Software Foundation; we sometimes-make exceptions for this. Our decision will be guided by the two goals-of preserving the free status of all derivatives of our free software and-of promoting the sharing and reuse of software generally.-- NO WARRANTY-- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,-REPAIR OR CORRECTION.-- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE-POSSIBILITY OF SUCH DAMAGES.-- END OF TERMS AND CONDITIONS-- How to Apply These Terms to Your New Programs-- If you develop a new program, and you want it to be of the greatest-possible use to the public, the best way to achieve this is to make it-free software which everyone can redistribute and change under these terms.-- To do so, attach the following notices to the program. It is safest-to attach them to the start of each source file to most effectively-convey the exclusion of warranty; and each file should have at least-the "copyright" line and a pointer to where the full notice is found.-- <one line to give the program's name and a brief idea of what it does.>- Copyright (C) <year> <name of author>-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA---Also add information on how to contact you by electronic and paper mail.--If the program is interactive, make it output a short notice like this-when it starts in an interactive mode:-- Gnomovision version 69, Copyright (C) year name of author- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.- This is free software, and you are welcome to redistribute it- under certain conditions; type `show c' for details.+Copyright 2002-2020 Andreas Abel, Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt, Paul Callaghan, Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Pascal Hof, Simon Huber, Patrik Jansson, Kristofer Johannisson, Antti-Juhani Kaijanaho, Andreas Lööw, Justin Meiners, Kent Mein, Ulf Norell, Gabriele Paganelli, Michael Pellauer, Fabian Ruch, and Aarne Ranta. -The hypothetical commands `show w' and `show c' should show the appropriate-parts of the General Public License. Of course, the commands you use may-be called something other than `show w' and `show c'; they could even be-mouse-clicks or menu items--whatever suits your program.+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -You should also get your employer (if you work as a programmer) or your-school, if any, to sign a "copyright disclaimer" for the program, if-necessary. Here is a sample; alter the names:+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program- `Gnomovision' (which makes passes at compilers) written by James Hacker.+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - <signature of Ty Coon>, 1 April 1989- Ty Coon, President of Vice+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -This General Public License does not permit incorporating your program into-proprietary programs. If your program is a subroutine library, you may-consider it more useful to permit linking proprietary applications with the-library. If this is what you want to do, use the GNU Library General-Public License instead of this License.+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Makefile view
@@ -19,7 +19,7 @@ # Name for binary distribution (e.g. bnfc-2.4.5-linux32) BDIST_TAG=bnfc-${BNFC_VERSION}-$(shell uname -s)-$(shell uname -m) -.PHONY: default build install doc test bdist show-version debug TAGS+.PHONY: default build install doc test bdist show-version debug weed TAGS default: install test @@ -30,11 +30,17 @@ $(CABAL_INSTALL) test:- $(CABAL_CONFIGURE) $(CABAL_TEST) -doc:- $(CABAL) v1-haddock --executables --internal+haddock doc:+ $(CABAL) v1-haddock --hyperlink-source+# --executables --internal++# See https://hackage.haskell.org/package/weeder+# weeder can find dead code starting from the .hie files+weed:+ $(CABAL) build --project-file=cabal.project.local+ weeder TAGS : hasktags --etags .
+ README.md view
@@ -0,0 +1,151 @@+[](http://hackage.haskell.org/package/BNFC)+[](https://stackage.org/nightly/package/BNFC)+[](https://www.stackage.org/package/BNFC)+[](https://github.com/andreasabel/agda2lagda/actions)+[](http://bnfc.readthedocs.io/en/latest/?badge=latest)++The BNF Converter+=================++What is the BNF Converter?+--------------------------++The BNF Converter (bnfc) is a compiler construction tool generating a compiler+front-end from a Labelled BNF grammar. It is currently able to generate Haskell,+Agda, C, C++, Java, and OCaml, as well as XML representations.++Given a Labelled BNF grammar the tool produces:+- an abstract syntax implementation+- a case skeleton for the abstract syntax in the same language+- an Alex, Ocamllex, JLex, or Flex lexer generator file+- a Happy, Ocamlyacc, Menhir, ANTLR, CUP, or Bison parser generator file+- a pretty-printer as a Haskell/Agda/C/C++/Java/Ocaml module+- a Latex file containing a readable specification of the language++*More information*: http://bnfc.digitalgrammars.com/++Installation+------------++Some binaries are available at https://github.com/BNFC/bnfc/releases.+Installation from the Haskell sources is possible via `stack` or `cabal`.++### Installation via stack (recommended)++You need a running installation of+[stack](https://docs.haskellstack.org/en/stable/install_and_upgrade/).+To install and run the latest version of [bnfc from+stackage](https://www.stackage.org/package/BNFC),+enter at the command line:++```+ stack install BNFC+ bnfc --help+```++### Installation via cabal++You need a running installation of a recent version of+[GHC](https://www.haskell.org/ghc/) and+[Cabal](https://www.haskell.org/cabal/), most easily available via the+[Haskell Platform](https://www.haskell.org/platform/). To install and+[bnfc from hackage](https://hackage.haskell.org/package/BNFC),+enter at the command line:+```+ cabal install BNFC+ bnfc --help+```++### Installing the development version++To install the [development version of+bnfc](https://github.com/BNFC/bnfc) with the latest bugfixes (and+regressions ;-)):+```+ git clone https://github.com/BNFC/bnfc.git+ cd bnfc/source+```+and then either+```+ cabal install+```+or+```+ stack install --stack-yaml stack-8.10.3.yaml+```+(replace `8.10.3` with your GHC version, and if you want to build with+your installed GHC then add flag `--system-ghc`).++Mini tutorial+-------------++- Build a first parser in 5 min (Haskell backend):++ 1. In a fresh directory, prepare a grammar file `Sum.cf` with the following content:+ ```+ EInt. Exp ::= Integer;+ EPlus. Exp ::= Exp "+" Integer;+ ```+ 2. Build a parser (in Haskell) with bnfc:+ ```+ bnfc -d -m Sum.cf && make+ ```+ The `make` step needs the Haskell compiler [GHC](https://www.haskell.org/ghc/), the lexer+ generator [alex](https://www.haskell.org/alex/) and the parser generator [happy](https://www.haskell.org/happy/) (all included in the GHC installation).++ 3. Inspect the generated files in directory `Sum`.+ 4. Test the parser.+ ```+ echo "1 + 2 + 3" | Sum/Test+ ```++- Try the C-family backends. (The prerequisites, GNU C(++) compiler+ (`gcc` / `g++`), lexer generator `flex` and parser generator `bison`,+ are usually present):+ ```+ bnfc --c -m -o sum-c Sum.cf && make -C sum-c && echo "1 + 2 + 3" | sum-c/TestSum+ bnfc --cpp -m -o sum-cpp Sum.cf && make -C sum-cpp && echo "1 + 2 + 3" | sum-cpp/TestSum+ ```++- Try the other backends:++ | Option | Backend |+ | --- | --- |+ | `--java` | Requires Java, [JLex](https://www.cs.princeton.edu/~appel/modern/java/JLex/) or [JFlex](https://jflex.de/), and [CUP](http://www2.cs.tum.edu/projects/cup/).|+ | `--java-antlr` | Requires [ANTLR](https://www.antlr.org/).|+ | `--ocaml` | Requires [OCaml](https://ocaml.org/), `ocamllex` and `ocamlyacc`.|+ | `--ocaml-menhir` | Uses [menhir](http://gallium.inria.fr/~fpottier/menhir/) instead of `ocamlyacc`.|+ | `--agda` | Produces [Agda](https://agda-lang.org) bindings to the parser generated for Haskell.|+ | `--pygments` | Produces a lexer definition for the Python highlighting suite [Pygments](https://pygments.org/).|++Documentation+-------------++https://bnfc.readthedocs.org/en/latest/++Support+-------++You can discuss with us issues around bnfc on our mailing list bnfc-dev@googlegroups.com.++For current limitations of bnfc, or to report a new bug, please consult our [issue tracker](https://github.com/BNFC/bnfc/issues).++Contribute+----------++- Issue Tracker: https://github.com/BNFC/bnfc/issues+- Source Code: https://github.com/BNFC/bnfc+- Haskell coding style guide: https://github.com/andreasabel/haskell-style-guide/+- Some pull request etiquette:+ * Document, document, document! (See style guide)+ * Include test cases that cover your feature.+ * Include changelog entry.+ * More etiquette: E.g. https://gist.github.com/mikepea/863f63d6e37281e329f8++License+-------++The project is licensed under the [BSD 3-clause license](https://raw.githubusercontent.com/BNFC/bnfc/master/source/LICENSE).++BNFC versions until 2.8.4 released under the+[GNU General Public License](https://www.gnu.org/licenses/gpl-2.0.html).
Setup.lhs view
@@ -1,6 +1,10 @@ #!/usr/bin/env runghc > module Main where-> import Distribution.Simple+>+> import Distribution.Extra.Doctest (defaultMainWithDoctests)+> > main :: IO ()-> main = defaultMain+> main = defaultMainWithDoctests "doctests"++This generates the module Build_doctests.
− changelog
@@ -1,96 +0,0 @@-2.8.4 Andreas Abel <andreas.abel@gu.se> October 2020- * GHC versions 7.10 - 8.10 supported, dropped GHC 7.6 and 7.8- * LBNF: whitespace list separators are now accepted; treated like "" [#70]- * `define` pragma now implemented by all maintained backends [#266, #285]- * BNFC performs more sanity checks on the grammar, reports errors with source locations [#186, #213, #214]- * option `--check` to only perform sanity checks [#286]- * Backends now more resilient against keyword and name clashes (e.g. via qualified imports) [#278, #289]- * Haskell: new option --text-token to use Data.Text instead of String in the lexer [#167]- * Haskell: allow block comment delimiters of any length [#169, #202]- * Haskell: define Err monad as Either String [#273], migration guide at https://bnfc.readthedocs.io/en/v2.8.4/user_guide.html#haskell-backend- * Haskell: IsString instances for Ident-like token types [#192]- * C/C++/Java: support multiple block comment forms per grammar [#202]- * C++(STL): parser now throws exception on parse error [#288]- * C++: fixed quadratic behavior in C++-generated printer (regression in 2.8.2)- * Java: escape JFlex special characters [#299]- * Java/ANTLR: emit start rules to work around ANTLR issue #2689 [#272]- * Ocaml: new flag --menhir to generate parser with menhir instead of ocamlyacc- * Bug fixes: #163, #169, #196, #212, #235, #256, #264, #269, #274, #276, #277, #279, #282, #283, #290- * Fact-checking and revising LBNF documentation at https://bnfc.readthedocs.io/en/v2.8.4/lbnf.html--2.8.3 Andreas Abel <andreas.abel@gu.se> August 2019- * GHC 8.8 compatibility- * Stack installation supported by provided .yaml files [#198]- * Unicode support in lexer, excl. C, C++ and Ocaml [#249]- * LBNF: support \r (carriage return) and \f (form feed) in token declaration [#257]- * LBNF: allow numbered categories (like Foo2) independent of coercions [#210]- * Agda: new (experimental) backend, providing bindings to AST/parser/printer of Haskell backend- * C: supports now the -l option to give error locations [#238]- * C: correct function names in generated skeletons [#239]- * C, C++: handle regular expression difference (subtraction) correctly [#237]- * Haskell: generates now more fine-grained Makefile that invokes bnfc on changed .cf file- * Haskell: use qualified import of AST in generated printer [#128,#228]- * Haskell: printer code no longer produces deprecation warning concerning OverlappingInstances [#233]- * Haskell/CNF: fixed problem with Any type in generated code [#216]- * Haskell/CNF: generated test program now same name (Test) as w/o --cnf- * Haskell/GLR: correct module header in .y file [#252]--2.8.2 Andreas Abel <andreas.abel@gu.se> November 2018- * GHC 8.4 compatibility [#227,#236]- * bnfc now puts current timestamp on all created files, even unchanged ones [#219]- * bnfc is now more accepting about border-line terminals [#149]- * Improved error messages [#144] in particular on undefined categories [#151]- * C: Emit correct function prototypes [#185]- * C++: Fix buffer overrun in pretty printer [#242]- * C++: Fix regression introduced in 2.8 in Skeleton.H [#164]- * C++: Replace `%name-prefix` with `%define api.prefix` in bison files [#181]- * C++: Fix a bug that appeared if you had a category named "List"- * C, C++: Add usage output to the test program [#141]- * C, C++: Fix a bug in the parser file when using -p [#172]- * C, C++, OCaml, Java: Accept ' or " as comment delimiters [#146]- * Haskell: Generated code mostly hlint-warning free- * Haskell: Small fixes [#166,#170,#222]- * Java: Add an experimental ANTLR4 backend [#155]- * Java: Add support for passing line numbers to parser [#217,#224,#226]- * OCaml: Reserved symbols now have a higher precedence than predefined- tokens as in Haskell- * Some updates of the documentation [#211,#223]- * And various small fixes [#139,#159,#195,#201,#215]--2.8.1 Grégoire Détrez <gregoire.detrez@gu.se> February 2016- * Fix compatibility with GHC 7.10.2 and Alex 3.14- * Fixed #160--2.8 Grégoire Détrez <gregoire.detrez@gu.se> May 2015- * Builds with ghc 7.10.1- * Add support for JFlex (java)- * Add an option to generate files in an other directory- * Add an experimental option that turns the AST into a parametrized- functor (in Haskell only)- * New pygment backend to generate syntax highlighters- * Bug fixes--2.7.1 Grégoire Détrez <gregoire.detrez@gu.se> October 2014- * Generated haskell code is now warning free- * Removed unused terminal in happy- * Correctly escape backslashes in symbols- * Fix problem that was preventing custom tokens to work in OCaml if- they conflict with the build-in Ident- * BNFC build is also warning free (ghc 7.4.2)- * Test programs return non-zerro exit code on parse error--2.7.0.0 Grégoire Détrez <gregoire.detrez@gu.se> September 2014- * Add token support for Ocaml- * New option parser- * Adds an optional argument to change Makefile name- * Add a --ghc option to derive Data, Typeable, Generic in Haskell- * New online documentation (https://bnfc.readthedocs.org)- * Derive ``Read`` for newtype decls in Haskell- * New option to get the version number --version- * Remove the F# backend- * Remove the Java4 backend- * New Applicative and Alternative instances to ``Err``- * Remove the coupling between building the parser and the pdf from- latex- * Improvement to the CNF Backend- * Bug fixes #92, #21, #34, #33, #90, #30, #60
+ main/Main.hs view
@@ -0,0 +1,83 @@+{-+ BNF Converter: Main file+ Copyright (C) 2002-2013 Authors:+ Jonas Almström Duregård, Krasimir Angelov, Björn Bringert, Johan Broberg, Paul Callaghan,+ Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Patrik Jansson,+ Kristofer Johannisson, Antti-Juhani Kaijanaho, Ulf Norell,+ Michael Pellauer and Aarne Ranta 2002 - 2013.++ Björn Bringert, Johan Broberg, Markus Forsberg, Peter Gammie,+ Patrik Jansson, Antti-Juhani Kaijanaho, Ulf Norell,+ Michael Pellauer, Aarne Ranta++-}+++module Main where++import BNFC.Backend.Base+import BNFC.Backend.C+import BNFC.Backend.CPP.NoSTL+import BNFC.Backend.CPP.STL+import BNFC.Backend.Haskell+import BNFC.Backend.HaskellGADT+import BNFC.Backend.Java+import BNFC.Backend.Latex+import BNFC.Backend.OCaml+import BNFC.Backend.Pygments+import BNFC.CF (CF)+import BNFC.GetCF+import BNFC.Options hiding (make, Backend)++import BNFC.License ( license )+import Paths_BNFC ( version )++import Data.Version ( showVersion )+import System.Environment (getArgs)+import System.Exit (exitFailure, exitSuccess)+import System.IO (stderr, hPutStrLn)++-- Print an error message and a (short) usage help and exit+printUsageErrors :: [String] -> IO ()+printUsageErrors msg = do+ mapM_ (hPutStrLn stderr) msg+ hPutStrLn stderr usage+ exitFailure++main :: IO ()+main = do+ args <- getArgs+ let (mode, warnings) = parseMode args++ -- Print command-line argument warnings (if any).+ mapM_ (hPutStrLn stderr) warnings++ case mode of++ UsageError e -> printUsageErrors [e]+ Help -> putStrLn help >> exitSuccess+ Version -> putStrLn (showVersion version) >> exitSuccess+ License -> putStr license >> exitSuccess++ Target options file+ | target options == TargetCheck ->+ readFile file+ >>= parseCF options TargetCheck+ >> return ()+ | otherwise ->+ readFile file+ >>= parseCF options (target options)+ >>= writeFiles (outDir options) . maketarget (target options) options++maketarget :: Target -> SharedOptions -> CF -> Backend+maketarget = \case+ TargetC -> makeC+ TargetCpp -> makeCppStl+ TargetCppNoStl -> makeCppNoStl+ TargetHaskell -> makeHaskell+ TargetHaskellGadt -> makeHaskellGadt+ TargetLatex -> makeLatex+ TargetJava -> makeJava+ TargetOCaml -> makeOCaml+ TargetPygments -> makePygments+ TargetCheck -> error "impossible"
− runtime/Algebra/RingUtils.hs
@@ -1,74 +0,0 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}--module Algebra.RingUtils- ( module Prelude- , AbelianGroup(..)- , AbelianGroupZ(..)- , Ring(..)- , RingP(..)- , Pair(..), select, onlyLeft, onlyRight- , O(..)- , sum- , mulDefault- , module Data.Pair- )- where--import qualified Prelude as P-import Prelude hiding ( (+), (*), splitAt, sum )-import Control.Applicative-import Data.Pair--class AbelianGroup a where- zero :: a- (+) :: a -> a -> a--instance AbelianGroup Int where- zero = 0- (+) = (P.+)--class AbelianGroup a => AbelianGroupZ a where- isZero :: a -> Bool--instance AbelianGroupZ Int where- isZero x = x == 0--class AbelianGroupZ a => Ring a where- (*) :: a -> a -> a--class (AbelianGroupZ a) => RingP a where- mul :: Bool -> a -> a -> Pair a--- mul _ x y = pure $ x * y--mulDefault x y = leftOf (mul False x y)--onlyLeft x = x :/: []-onlyRight x = [] :/: x--select p = if p then onlyRight else onlyLeft--newtype O f g a = O {fromO :: f (g a)}- deriving (AbelianGroup, AbelianGroupZ, Show)--instance (Functor f,Functor g) => Functor (O f g) where- fmap f (O x) = O (fmap (fmap f) x)--instance AbelianGroup a => AbelianGroup (Pair a) where- zero = (zero:/:zero)- (a:/:b) + (x:/:y) = (a+x) :/: (b+y)--instance AbelianGroupZ a => AbelianGroupZ (Pair a) where- isZero (a:/:b) = isZero a && isZero b--instance Ring Int where- (*) = (P.*)--infixl 7 *-infixl 6 +--sum :: AbelianGroup a => [a] -> a-sum = foldr (+) zero--instance AbelianGroup Bool where- zero = False- (+) = (||)
− runtime/Data/Matrix/Class.hs
@@ -1,81 +0,0 @@-{-# LANGUAGE FlexibleInstances #-}--module Data.Matrix.Class where--import Prelude ()-import Algebra.RingUtils-import Control.Applicative hiding ((<|>))---fingerprint m = [[ if isZero (at i j m) then ' ' else 'X' | i <- [0..x-1] ] | j <- [0..y-1]]- where x = countColumns m- y = countRows m--(f *** g) (x,y) = (f x,g y)--data Dimension- = XD- | YD- deriving (Eq,Show)--quad a b c d = (a <|> b) <-> (c <|> d)---nextDim XD = YD-nextDim YD = XD--type Extent = (Int,Int)--ext XD (x,y) = x-ext YD (x,y) = y--glueExt XD (x1,y1) (x2,y2) = (x1+x2,y1)-glueExt YD (x1,y1) (x2,y2) = (x1,y1+y2)--splitExt XD k (x,y) = ((k,y),(x-k,y))-splitExt YD k (x,y) = ((x,k),(x,y-k))--class Matrix m where- at :: AbelianGroupZ a => Int -> Int -> m a -> a- extent :: m a -> Extent- -- | Sigleton matrix- singleton :: AbelianGroupZ a => a -> m a- glue :: AbelianGroup a => Dimension -> m a -> m a -> m a- split :: AbelianGroupZ a => Dimension -> Int -> m a -> (m a, m a)- zeroMatrix :: AbelianGroup a => Int -> Int -> m a--instance Matrix m => Matrix (O Pair m) where- at i j (O (x :/: y)) = at i j x + at i j y- extent (O (x :/: y)) = extent x -- union with y- glue d (O p) (O q) = O $ glue d <$> p <*> q- split d k (O (x :/: y)) = (O $ ax :/: ay, O $ bx :/: by)- where (ax,bx) = split d k x- (ay,by) = split d k y- zeroMatrix x y = O $ pure (zeroMatrix x y)- singleton x = O $ pure (singleton x) -- Attention: on both sides always!---(<|>) :: (AbelianGroup a, Matrix m) => m a -> m a -> m a-(<|>) = glue XD--(<->) :: (AbelianGroup a, Matrix m) => m a -> m a -> m a-(<->) = glue YD--countColumns, countRows :: Matrix m => m a -> Int-countColumns = ext XD . extent-countRows = ext YD . extent--chopLastColumn, chopFirstRow, chopFirstColumn, chopLastRow, lastColumn, firstRow :: (AbelianGroupZ a, Matrix m) => m a -> m a-chopFirstRow = snd . split YD 1-chopFirstColumn = snd . split XD 1-chopLastColumn x = fst . split XD (countColumns x - 1) $ x-firstRow = fst . split YD 1-lastColumn x = snd . split XD (countColumns x - 1) $ x--chopLastRow x = fst . split YD (countRows x - 1) $ x------
− runtime/Data/Matrix/Quad.hs
@@ -1,299 +0,0 @@-{-# LANGUAGE GADTs, DataKinds, ScopedTypeVariables, KindSignatures #-}--module Data.Matrix.Quad where--import Prelude ()-import Data.List (splitAt,intercalate)-import Control.Applicative-import Algebra.RingUtils hiding (O,concat)-import Data.Traversable-import Data.Foldable--data Shape = Bin Shape Shape | Leaf--data Shape' :: Shape -> * where- Bin' :: !Int -> Shape' s -> Shape' s' -> Shape' (Bin s s')- Leaf' :: Shape' Leaf--data SomeShape where- S :: Shape' s -> SomeShape--data Mat :: Shape -> Shape -> * -> * where- Quad :: !(Mat x1 y1 a) -> !(Mat x2 y1 a) ->- !(Mat x1 y2 a) -> !(Mat x2 y2 a) ->- Mat (Bin x1 x2) (Bin y1 y2) a- Zero :: Mat x y a- One :: !a -> Mat Leaf Leaf a- Row :: Mat x1 Leaf a -> Mat x2 Leaf a -> Mat (Bin x1 x2) Leaf a- Col :: Mat Leaf y1 a -> Mat Leaf y2 a -> Mat Leaf (Bin y1 y2) a--data Vec :: Shape -> * -> * where- Z :: Vec s a- O :: a -> Vec Leaf a- (:!) :: Vec s a -> Vec s' a -> Vec (Bin s s') a---row Zero Zero = Zero-row x y = Row x y--col :: Mat Leaf y1 a -> Mat Leaf y2 a -> Mat Leaf (Bin y1 y2) a-col Zero Zero = Zero-col x y = Col x y--quad Zero Zero Zero Zero = Zero-quad a b c d = Quad a b c d--one :: AbelianGroupZ a => a -> Mat Leaf Leaf a-one x | isZero x = Zero- | otherwise = One x--(.+.) :: AbelianGroupZ a => Mat x y a -> Mat x y a -> Mat x y a-Zero .+. x = x-x .+. Zero = x-Quad a b c d .+. Quad a' b' c' d' = quad (a .+. a') (b .+. b') (c .+. c') (d .+. d')-One x .+. One x' = one (x + x')-Row x y .+. Row x' y' = row (x .+. x') (y .+. y')-Col x y .+. Col x' y' = col (x .+. x') (y .+. y')--instance AbelianGroupZ a => AbelianGroup (Mat x y a) where- (+) = (.+.)- zero = Zero--mult :: RingP a => Bool -> Mat x y a -> Mat z x a -> Mat z y (Pair a)-mult p a b = a & b where- infixl 7 &- (&) :: RingP a => Mat x y a -> Mat z x a -> Mat z y (Pair a)- Zero & x = Zero- x & Zero = Zero- One x & One x' = one (mul p x x')- One x & Row a b = row (One x & a) (One x & b)- Col a b & One x = col (a & One x) (b & One x)- Row a b & Col a' b' = a & a' + b & b'- Col a b & Row a' b' = quad (a & a') (a & b') (b & a') (b & b')- Row a b & Quad a' b' c' d' = row (a & a' + b & c') (a & b' + b & d')- Quad a b c d & Col a' c' = col (a & a' + b & c') (c & a' + d & c')- Quad a b c d & Quad a' b' c' d' =- quad (a & a' + b & c') (a & b' + b & d')- (c & a' + d & c') (c & b' + d & d')-- -- REDUNANT CLAUSE:- x & y = error $ "mult:" ++ intercalate "; " [showR x,showR y]---- a variant of traverse. The constraint prevents to just use traverse.-trav :: AbelianGroupZ a => Mat y x (Pair a) -> Pair (Mat y x a)-trav Zero = pure Zero-trav (Quad a b c d) = quad <$> trav a <*> trav b <*> trav c <*> trav d-trav (One x) = one <$> x-trav (Col a b) = col <$> trav a <*> trav b-trav (Row a b) = row <$> trav a <*> trav b--q0 :: Mat (Bin x x') (Bin y y') a-q0 = Quad Zero Zero Zero Zero--closeDisjointP :: RingP a => Bool -> Mat x x a -> Mat y x (Pair a) -> Mat y y a -> Pair (Mat y x a)-closeDisjointP p l c r = close l c r- where close :: RingP a => Mat x x a -> Mat y x (Pair a) -> Mat y y a -> Pair (Mat y x a)- close l Zero r = Zero :/: Zero- close Zero x Zero = trav x -- if x = One x', we are in this case- close (Quad a11 a12 Zero a22) (Quad c11 c12 c21 c22) (Quad b11 b12 Zero b22) = quad <$> x11 <*> x12 <*> x21 <*> x22- where x21 = close a22 c21 b11- x11 = close a11 (a12 & rightOf x21 + c11) b11- x22 = close a22 (leftOf x21 & b12 + c22) b22- x12 = close a11 (a12 & rightOf x22 + leftOf x11 & b12 + c12) b22- close Zero (Quad c11 c12 c21 c22) (Quad b11 b12 Zero b22) = close q0 (Quad c11 c12 c21 c22) (Quad b11 b12 Zero b22)- close (Quad a11 a12 Zero a22) (Quad c11 c12 c21 c22) Zero = close (Quad a11 a12 Zero a22) (Quad c11 c12 c21 c22) q0- close (Quad a11 a12 Zero a22) (Col c1 c2) (Zero) = col <$> x1 <*> x2- where x2 = close a22 c2 Zero- x1 = close a11 (mult p a12 (rightOf x2) + c1) Zero- close Zero (Row c1 c2) (Quad b11 b12 Zero b22) = row <$> x1 <*> x2- where x1 = close Zero c1 b11- x2 = close Zero (mult p (leftOf x1) b12 + c2) b22- close a c b = error $ "closeDisjointP:" ++ intercalate "; " [showR a,showR c,showR b]- (&) :: RingP a => Mat x y a -> Mat z x a -> Mat z y (Pair a)- (&) = mult p--showR :: Mat x y a -> String-showR Zero = "0"-showR (One _) = "1"-showR (Row a b) = "("++showR a++"-"++showR b++")"-showR (Col a b) = "("++showR a++"|"++showR b++")"-showR (Quad a b c d) = "#("++ intercalate "," [showR a,showR b,showR c,showR d]++")"--bin' :: Shape' s -> Shape' s' -> Shape' (Bin s s')-bin' s s' = Bin' (sz' s + sz' s') s s'--mkShape :: Int -> SomeShape-mkShape 1 = S (bin' Leaf' Leaf')-mkShape 2 = S (bin' (bin' Leaf' Leaf') Leaf')-mkShape n = case (mkShape n'1, mkShape n'2) of- (S x, S y) -> S (bin' x y)- where n'1 = n `div` 2- n'2 = n - n'1 - 1--mkSing :: AbelianGroupZ a => Shape' x -> Shape' y -> a -> Mat x y a-mkSing (Bin' _ x1 x2) (Bin' _ y1 y2) a = quad Zero Zero (mkSing x1 y2 a) Zero-mkSing Leaf' Leaf' a = one a-mkSing Leaf' (Bin' _ y1 y2) a = col Zero (mkSing Leaf' y2 a)-mkSing (Bin' _ x1 x2) Leaf' a = row (mkSing x1 Leaf' a) Zero--data SomeTri a where- T :: Shape' s -> Pair (Mat s s a) -> SomeTri a--type Q a = SomeTri a--mkUpDiag :: AbelianGroupZ a => [a] -> Shape' s -> Mat s s a-mkUpDiag [] Leaf' = Zero-mkUpDiag xs (Bin' _ s s') = Quad (mkUpDiag a s) (mkSing s' s c) Zero (mkUpDiag b s')- where (a,c:b) = splitAt (sz' s - 1) xs--close :: RingP a => Bool -> Mat s s (Pair a) -> Pair (Mat s s a)-close p Zero = zero-close p (One x) = one <$> x-close p (Quad a11 a12 Zero a22) = quad' x11 (closeDisjointP p (leftOf x11) a12 (rightOf x22)) zero x22- where x11 = close (not p) a11- x22 = close (not p) a22--mkTree :: RingP a => [Pair a] -> SomeTri a-mkTree xs = case mkShape (length xs) of- S s -> T s (close True $ mkUpDiag xs s)--quad' a b c d = quad <$> a <*> b <*> c <*> d--mergein :: RingP a => Bool -> SomeTri a -> Pair a -> SomeTri a -> SomeTri a-mergein p (T y a) c (T x b) = T (bin' y x) (quad' a (closeDisjointP p (leftOf a) c' (rightOf b)) zero b)- where c' = mkSing x y c---- | A variant of zipWith on vectors-zw :: (AbelianGroup a, AbelianGroup b) => (a -> b -> c) -> Vec y a -> Vec y b -> Vec y c-zw f Z Z = Z-zw f Z (a :! b) = zw f (Z :! Z) (a :! b)-zw f (a :! b) Z = zw f (a :! b) (Z :! Z)-zw f Z (O x) = O $ f zero x-zw f (O x) Z = O $ f x zero-zw f (O x) (O y) = O (f x y)-zw f (a :! b) (a' :! b') = zw f a a' :! zw f b b'---- | Lookup in a vector-lk :: AbelianGroup a => Int -> Shape' x -> Vec x a -> a-lk n _ Z = zero-lk 0 Leaf' (O x) = x-lk i (Bin' _ s s') (x :! x')- | i < sz' s = lk i s x- | otherwise = lk (i - sz' s) s' x'---- | Linearize a matrix-lin' :: AbelianGroup a => Mat x y a -> Vec y (Vec x a)-lin' Zero = Z-lin' (One a) = O (O a)-lin' (Row a b) = zw (:!) (lin' a) (lin' b)-lin' (Col a b) = lin' a :! lin' b-lin' (Quad a b c d) = zw (:!) (lin' a) (lin' b) :!zw (:!) (lin' c) (lin' d)---- | Contents of a vector-contents :: Shape' x -> Vec x a -> [(Int,a)]-contents s Z = []-contents s (O a) = [(0,a)]-contents (Bin' _ s s') (xs :! xs') = contents s xs ++ map (first (+sz' s)) (contents s' xs')---first f (a,b) = (f a,b)-second f (a,b) = (a,f b)--instance AbelianGroup a => AbelianGroup (Vec x a) where- zero = Z- (+) = zw (+)--data Path :: Shape -> * where- Here :: Path Leaf- Low :: Path s -> Path (Bin s s')- High :: Path s -> Path (Bin s' s)--(<||>) :: Maybe (a,Path x) -> Maybe (a,Path x') -> Maybe (a,Path (Bin x x'))-x <||> y = (second High <$> y) <|> (second Low <$> x)---- | What is, and where is the rightmost non-zero element on a given--- line of the matrix?-rightmostOnLine :: Path y -> Mat x y a -> Maybe (a,Path x)-rightmostOnLine _ Zero = Nothing-rightmostOnLine Here (One x) = Just (x,Here)-rightmostOnLine Here (Row a b) = rightmostOnLine Here a <||> rightmostOnLine Here b-rightmostOnLine (Low p) (Col a b) = rightmostOnLine p a-rightmostOnLine (High p) (Col a b) = rightmostOnLine p b-rightmostOnLine (Low p) (Quad a b _ _) = rightmostOnLine p a <||> rightmostOnLine p b-rightmostOnLine (High p) (Quad _ _ a b) = rightmostOnLine p a <||> rightmostOnLine p b---- | Is this the rightmost path?-isRightmost :: Path x -> Bool-isRightmost (Low _) = False-isRightmost (Here) = True-isRightmost (High x) = isRightmost x--results' :: AbelianGroup a => Mat y y a -> Path y -> [(Path y, a, Path y)]-results' m y | isRightmost y = []- | otherwise = (y,a,x) : results' m x- where Just (a,x) = rightmostOnLine y m--results :: AbelianGroupZ a => SomeTri a -> [(Int, a, Int)]-results (T s (m :/: m')) = [(fromPath s x,a,fromPath s y) | (x,a,y) <- results' (m+m') (leftMost s)]--leftMost :: Shape' s -> Path s-leftMost Leaf' = Here-leftMost (Bin' _ s _) = Low $ leftMost s--fromPath :: Shape' y -> Path y -> Int-fromPath _ Here = 0-fromPath (Bin' _ s s') (Low x) = fromPath s x-fromPath (Bin' _ s s') (High x) = sz' s + fromPath s' x---root' :: AbelianGroup a => Mat x y a -> a-root' Zero = zero-root' (One x) = x-root' (Quad _ a _ _) = root' a-root' (Col a _) = root' a-root' (Row _ a) = root' a--root (T _ (m :/: m')) = root' m + root' m'--single x = T Leaf' (one <$> x)--square2 x = T (bin' Leaf' Leaf') $ quad' zero (one <$> x) zero zero--square3 p x y = T (bin' (bin' Leaf' Leaf') (Leaf'))- (quad' (quad' zero (one <$> x) zero zero) (Col <$> (one <$> mul p (leftOf x) (rightOf y)) <*> (one <$> y)) zero zero)---sz' :: Shape' s -> Int-sz' Leaf' = 1-sz' (Bin' x l r) = x -- sz' l + sz' r---(|+|) = zipWith (++)-(-+-) = (++)---- TODO: reimplement using lin'-lin :: AbelianGroup a => Shape' x -> Shape' y -> Mat x y a -> [[a]]-lin x y Zero = replicate (sz' y) $ replicate (sz' x) zero-lin _ _ (One x) = [[x]]-lin (Bin' _ x x') (Bin' _ y y') (Quad a b c d) = (lin x y a |+| lin x' y b) -+- (lin x y' c |+| lin x' y' d)-lin Leaf' (Bin' _ y y') (Col a b) = lin Leaf' y a -+- lin Leaf' y' b-lin (Bin' _ x x') Leaf' (Row a b) = (lin x Leaf' a) |+| (lin x' Leaf' b)--sparse :: AbelianGroup a => Shape' x -> Shape' y -> Mat x y a -> [(Int,Int,a)]-sparse x y Zero = []-sparse _ _ (One x) = [(0,0,x)]-sparse (Bin' _ x x') (Bin' _ y y') (Quad a b c d) = sparse x y a ++ shiftX x (sparse x' y b) ++ shiftY y (sparse x y' c) ++ shiftX x (shiftY y(sparse x' y' d))-sparse Leaf' (Bin' _ y y') (Col a b) = sparse Leaf' y a ++ shiftY y (sparse Leaf' y' b)-sparse (Bin' _ x x') Leaf' (Row a b) = sparse x Leaf' a ++ shiftX x (sparse x' Leaf' b)--shiftX x0 as = [(x+sz' x0,y,a) | (x,y,a) <- as]-shiftY y0 as = [(x,y+sz' y0,a) | (x,y,a) <- as]--fingerprint (T s (m :/: m')) = zipWith (zipWith c) (lin s s m) (lin s s m')- where c x y = case (isZero x,isZero y) of- (True , True) -> ' '- (True , False) -> '>'- (False , True) -> '<'- (False , False) -> 'X'--scatterplot (T s (m :/: m')) = concat [show x ++ " " ++ show y ++ "\n" | (x,y,_) <- sparse s s m ++ sparse s s m']
− runtime/Parsing/Chart.hs
@@ -1,76 +0,0 @@-{-# LANGUAGE NoMonomorphismRestriction, TypeSynonymInstances, FlexibleInstances #-}--module Parsing.Chart where--import Data.Array-import Data.Maybe-import Prelude ()-import Data.Traversable (sequenceA)-import Control.Applicative ((<$>),(<*>),pure)-import Control.Monad(join)--import Data.List (splitAt)-import Algebra.RingUtils-import qualified Data.Matrix.Quad as Q-import Data.Matrix.Class--fingerprint = Q.fingerprint--{--mkTreeHelp alt s = sweeps (map single s)- where- sweeps [] = error "can't parse the empty string, sorry"- sweeps [p] = p- sweeps ps = sweeps (pairs ps alts)-- pairs [] _ = []- pairs [p] _ = [p]- pairs (p:q:ps) (b:bs) = (merging b p q) : pairs ps bs-- alts = cycle alt- -}---- mkTree2 :: (AbelianGroupZ (c a), RingP a, IsChart c) => Bool -> [Pair a] -> c a-mkTree2 :: RingP a => Bool -> [Pair a] -> Q.Q a-mkTree2 p [] = error "can't parse the empty string, sorry"-mkTree2 p [x] = Q.square2 x-mkTree2 p [x,y] = Q.square3 p x y-mkTree2 p leaves = Q.mergein p (mkTree2 False xs) y (mkTree2 True zs)- where (xs,y:zs) = splitAt n2 leaves- n2 = length leaves `div` 2----- mkTree :: (RingP a, IsChart c) => [Pair a] -> c a-mkTree = mkTree2 False -- mkTreeHelp [False,True]-mkTree' = mkTree2 True -- mkTreeHelp [True,False]---type Set a = [a]---- Sets form an abelian group-instance AbelianGroup (Set a) where- zero = []- (+) = (++)--instance AbelianGroupZ (Set a) where- isZero = null--type MT2 a = Q.Q a--genXPM xs@(h:_) = unlines $- ["! XPM2",- -- <width/cols> <height/rows> <colors> <char on pixel>- show width ++ " " ++ show height ++ " 4 1",- "X c cyan",- "< c blue",- "> c red",- " c black"- ] ++- xs- where width = length h- height = length xs--root = Q.root-mergein a c b = Q.mergein a c b-single x = Q.single x-
− runtime/Parsing/TestProgram.hs
@@ -1,84 +0,0 @@-{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-}-module Parsing.TestProgram where--import System.IO ( stdin, hGetContents )-import System.Environment ( getArgs, getProgName )--import GHC.Exts-import Control.Monad-import Control.Applicative (pure)-import Parsing.Chart hiding (fingerprint,mkTree)-import Data.Matrix.Quad-import Data.Pair-import Algebra.RingUtils--type Verbosity = Int--putStrV :: Verbosity -> String -> IO ()-putStrV v s = if v > 1 then putStrLn s else return ()---mainTest :: forall category token.- (RingP [(category,Any)], Eq category) =>- ((category,Any) -> String) ->- (Bool -> token -> Pair [(category,Any)]) ->- (String -> [token]) ->- (token -> (Int,Int)) ->- (category -> String) ->- (category -> [category]) ->- IO ()-mainTest showAst cnfToksToCat myLLexer getTokPos describe follows =- do args <- getArgs- case args of- [] -> hGetContents stdin >>= run "stdin" 2- "-s":fs -> mapM_ (runFile 0) fs- fs -> mapM_ (runFile 2) fs-- where- neighbors a b = b `elem` follows a- showResults :: [(category,Any)] -> IO ()- showResults x = do- putStrLn $ show (length x) ++ " results"- forM_ x $ \(cat,ast) -> do- putStrLn $ describe cat- putStrLn $ showAst (cat,ast)-- runFile v f = putStrLn f >> readFile f >>= run f v- run f v s =- do case rs of- [(_,x,_)] -> showResults x- _ -> do let errs = pairs rs- best = minimum $ map quality errs- mapM_ (putStrLn . showErr ts) $ filter (\x -> quality x == best) errs- when (v >= 2) $ do- writeFile (f ++ ".xpm") (genXPM $ fingerprint chart)- let scatt = scatterplot chart- putStrLn $ "Scatterplot data size:" ++ show (length scatt)- writeFile (f ++ ".data") scatt- where ts = myLLexer s- chart = mkTree $ zipWith cnfToksToCat (cycle [False,True]) ts- rs = results chart-- showTokPos :: (Int,Int) -> String- showTokPos (l,c) = show l ++ "," ++ show (c-1)-- showPos :: [token] -> Int -> String- showPos ts x = showTokPos (getTokPos $ ts !! x)-- showErr ts ((_,x',p),(_,y',_)) =- showPos ts p ++ ": cannot combine " ++ showBestCat x' ++ " with " ++ showBestCat y'-- quality (a@(_,x',p),b@(_,y',_)) = (or [ neighbors x y | x <- map fst x', y <- map fst y'],- (resSz a) Prelude.+ (resSz b))--- showBestCat ((x,_):_) = describe x--pairs (x:y:xs) = (x,y):pairs (y:xs)-pairs _ = []--resSz (i,_,j) = j-i----
− src/AbsBNF.hs
@@ -1,103 +0,0 @@--- Haskell data types for the abstract syntax.--- Generated by the BNF converter.--module AbsBNF where--import Prelude (Char, Double, Int, Integer, String)-import qualified Prelude as C (Eq, Ord, Show, Read)--newtype Identifier = Identifier ((Int, Int), String)- deriving (C.Eq, C.Ord, C.Show, C.Read)--data LGrammar = LGr [LDef]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data LDef- = DefAll Def | DefSome [Identifier] Def | LDefView [Identifier]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Grammar = Grammar [Def]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Def- = Rule Label Cat [Item]- | Comment String- | Comments String String- | Internal Label Cat [Item]- | Token Identifier Reg- | PosToken Identifier Reg- | Entryp [Identifier]- | Separator MinimumSize Cat String- | Terminator MinimumSize Cat String- | Delimiters Cat String String Separation MinimumSize- | Coercions Identifier Integer- | Rules Identifier [RHS]- | Function Identifier [Arg] Exp- | Layout [String]- | LayoutStop [String]- | LayoutTop- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Item = Terminal String | NTerminal Cat- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Cat = ListCat Cat | IdCat Identifier- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Label- = LabNoP LabelId- | LabP LabelId [ProfItem]- | LabPF LabelId LabelId [ProfItem]- | LabF LabelId LabelId- deriving (C.Eq, C.Ord, C.Show, C.Read)--data LabelId = Id Identifier | Wild | ListE | ListCons | ListOne- deriving (C.Eq, C.Ord, C.Show, C.Read)--data ProfItem = ProfIt [IntList] [Integer]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data IntList = Ints [Integer]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Arg = Arg Identifier- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Separation = SepNone | SepTerm String | SepSepar String- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Exp- = Cons Exp Exp- | App Identifier [Exp]- | Var Identifier- | LitInt Integer- | LitChar Char- | LitString String- | LitDouble Double- | List [Exp]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data RHS = RHS [Item]- deriving (C.Eq, C.Ord, C.Show, C.Read)--data MinimumSize = MNonempty | MEmpty- deriving (C.Eq, C.Ord, C.Show, C.Read)--data Reg- = RAlt Reg Reg- | RMinus Reg Reg- | RSeq Reg Reg- | RStar Reg- | RPlus Reg- | ROpt Reg- | REps- | RChar Char- | RAlts String- | RSeqs String- | RDigit- | RLetter- | RUpper- | RLower- | RAny- deriving (C.Eq, C.Ord, C.Show, C.Read)-
− src/BNF.cf
@@ -1,168 +0,0 @@-{-- BNF Converter: Language definition- Copyright (C) 2004 Author: Markus Forberg, Michael Pellauer, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---- Multi-view grammars (undocumented)--LGr. LGrammar ::= [LDef] ;--DefAll. LDef ::= Def ;-DefSome. LDef ::= [Identifier] ":" Def ;-LDefView. LDef ::= "views" [Identifier] ;---- separator LDef ";" ;-[]. [LDef] ::= ;-(:[]). [LDef] ::= LDef ;-(:). [LDef] ::= LDef ";" [LDef] ;--- extra semicolons allowed-_. [LDef] ::= ";" [LDef] ;--separator nonempty Identifier "," ;---- A Grammar is a sequence of definitions--Grammar . Grammar ::= [Def] ;---- separator Def ";" ; -- Note: this still permits a final semicolon.-[]. [Def] ::= ;-(:[]). [Def] ::= Def ;-(:). [Def] ::= Def ";" [Def] ;--- extra semicolons allowed-_. [Def] ::= ";" [Def] ;---- The rules of the grammar-Rule . Def ::= Label "." Cat "::=" [Item] ;---- Items-Terminal . Item ::= String ;-NTerminal . Item ::= Cat ;--terminator Item "" ;---- Categories (non-terminals)-ListCat . Cat ::= "[" Cat "]" ;-IdCat . Cat ::= Identifier ;---- Labels with or without profiles-LabNoP . Label ::= LabelId ;-LabP . Label ::= LabelId [ProfItem] ;--- A second label can be given in use of profiles and serves as--- ``original function name'' (undocumented feature).-LabPF . Label ::= LabelId LabelId [ProfItem] ;-LabF . Label ::= LabelId LabelId ;---- functional labels-Id . LabelId ::= Identifier ; -- AST constructor-Wild . LabelId ::= "_" ; -- No AST constructor (embedding)-ListE . LabelId ::= "[" "]" ; -- Empty list-ListCons . LabelId ::= "(" ":" ")" ; -- Cons-ListOne . LabelId ::= "(" ":" "[" "]" ")" ; -- Singleton list---- profiles (= permutation and binding patterns)-ProfIt . ProfItem ::= "(" "[" [IntList] "]" "," "[" [Integer] "]" ")" ;--Ints . IntList ::= "[" [Integer] "]" ;--separator Integer "," ;-separator IntList "," ;-terminator nonempty ProfItem "" ;---- Pragmas-Comment . Def ::= "comment" String ; -- Line comment-Comments . Def ::= "comment" String String ; -- Block comment-Internal . Def ::= "internal" Label "." Cat "::=" [Item] ; -- No parsing, AST and printing only-Token. Def ::= "token" Identifier Reg ; -- Lexer token-PosToken. Def ::= "position" "token" Identifier Reg ; -- Lexer token with position info-Entryp. Def ::= "entrypoints" [Identifier] ; -- Names of parsers-Separator. Def ::= "separator" MinimumSize Cat String ; -- List-Terminator. Def ::= "terminator" MinimumSize Cat String ; -- List-Delimiters. Def ::= "delimiters" Cat String String Separation MinimumSize;-Coercions. Def ::= "coercions" Identifier Integer ; -- Embeddings and parenthesized exprs.-Rules. Def ::= "rules" Identifier "::=" [RHS] ; -- Automatically generated lables (e.g. enums)-Function. Def ::= "define" Identifier [Arg] "=" Exp;--Arg. Arg ::= Identifier ;-separator Arg "" ;---- Lists-SepNone. Separation ::= ;-SepTerm. Separation ::= "terminator" String;-SepSepar. Separation ::= "separator" String;---- Layout-Layout. Def ::= "layout" [String] ; -- Layout start keywords-LayoutStop. Def ::= "layout" "stop" [String] ; -- Layout stop keywords-LayoutTop. Def ::= "layout" "toplevel" ; -- Should the toplevel be a block?--separator nonempty String "," ;---- Expressions-Cons. Exp ::= Exp1 ":" Exp ;-App. Exp1 ::= Identifier [Exp2] ;-Var. Exp2 ::= Identifier ;-LitInt. Exp2 ::= Integer ;-LitChar. Exp2 ::= Char ;-LitString. Exp2 ::= String ;-LitDouble. Exp2 ::= Double ;-List. Exp2 ::= "[" [Exp] "]" ;--coercions Exp 2;--separator Exp "," ; -- list list-separator nonempty Exp2 "" ; -- argument list--RHS. RHS ::= [Item] ;-separator nonempty RHS "|" ;---- List size condition-MNonempty. MinimumSize ::= "nonempty" ;-MEmpty. MinimumSize ::= ;---- Regular expressions--RAlt. Reg ::= Reg "|" Reg1 ; -- left-associative--RMinus. Reg1 ::= Reg1 "-" Reg2 ; -- left-associative--RSeq. Reg2 ::= Reg2 Reg3 ; -- left-associative--RStar. Reg3 ::= Reg3 "*" ;-RPlus. Reg3 ::= Reg3 "+" ;-ROpt. Reg3 ::= Reg3 "?" ;--REps. Reg3 ::= "eps" ; -- empty string, same as {""}--RChar. Reg3 ::= Char ; -- single character-RAlts. Reg3 ::= "[" String "]" ; -- list of alternative characters-RSeqs. Reg3 ::= "{" String "}" ; -- character sequence--RDigit. Reg3 ::= "digit" ;-RLetter. Reg3 ::= "letter" ;-RUpper. Reg3 ::= "upper" ;-RLower. Reg3 ::= "lower" ;-RAny. Reg3 ::= "char" ;--coercions Reg 3;---- LBNF identifiers--position token Identifier letter (letter | digit | '_')* ;---- Comments in BNF source-comment "--" ;-comment "{-" "-}" ;
+ src/BNFC.cf view
@@ -0,0 +1,124 @@+{-+ BNF Converter: Language definition+ Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer, Aarne Ranta+++-}++-- A Grammar is a sequence of definitions++Grammar . Grammar ::= [Def] ;++-- separator Def ";" ; -- Note: this still permits a final semicolon.+[]. [Def] ::= ;+(:[]). [Def] ::= Def ;+(:). [Def] ::= Def ";" [Def] ;+-- extra semicolons allowed+_. [Def] ::= ";" [Def] ;++-- The rules of the grammar+Rule . Def ::= Label "." Cat "::=" [Item] ;++-- Items+Terminal . Item ::= String ;+NTerminal . Item ::= Cat ;++terminator Item "" ;++-- Categories (non-terminals)+ListCat . Cat ::= "[" Cat "]" ;+IdCat . Cat ::= Identifier ;++separator Cat "," ; -- for "entrypoints"++-- Labels+Id . Label ::= Identifier ; -- AST constructor+Wild . Label ::= "_" ; -- No AST constructor (embedding)+ListE . Label ::= "[" "]" ; -- Empty list+ListCons . Label ::= "(" ":" ")" ; -- Cons+ListOne . Label ::= "(" ":" "[" "]" ")" ; -- Singleton list++-- Pragmas+Comment . Def ::= "comment" String ; -- Line comment+Comments . Def ::= "comment" String String ; -- Block comment+Internal . Def ::= "internal" Label "." Cat "::=" [Item] ; -- No parsing, AST and printing only+Token. Def ::= "token" Identifier Reg ; -- Lexer token+PosToken. Def ::= "position" "token" Identifier Reg ; -- Lexer token with position info+Entryp. Def ::= "entrypoints" [Cat] ; -- Names of parsers+Separator. Def ::= "separator" MinimumSize Cat String ; -- List+Terminator. Def ::= "terminator" MinimumSize Cat String ; -- List+Delimiters. Def ::= "delimiters" Cat String String Separation MinimumSize;+Coercions. Def ::= "coercions" Identifier Integer ; -- Embeddings and parenthesized exprs.+Rules. Def ::= "rules" Identifier "::=" [RHS] ; -- Automatically generated lables (e.g. enums)+Function. Def ::= "define" Identifier [Arg] "=" Exp;++Arg. Arg ::= Identifier ;+separator Arg "" ;++-- Lists+SepNone. Separation ::= ;+SepTerm. Separation ::= "terminator" String;+SepSepar. Separation ::= "separator" String;++-- Layout+Layout. Def ::= "layout" [String] ; -- Layout start keywords+LayoutStop. Def ::= "layout" "stop" [String] ; -- Layout stop keywords+LayoutTop. Def ::= "layout" "toplevel" ; -- Should the toplevel be a block?++separator nonempty String "," ;++-- Expressions for "define" pragma+Cons. Exp ::= Exp1 ":" Exp ;+App. Exp1 ::= Identifier [Exp2] ;+Var. Exp2 ::= Identifier ;+LitInt. Exp2 ::= Integer ;+LitChar. Exp2 ::= Char ;+LitString. Exp2 ::= String ;+LitDouble. Exp2 ::= Double ;+List. Exp2 ::= "[" [Exp] "]" ;++coercions Exp 2;++separator Exp "," ; -- list list+separator nonempty Exp2 "" ; -- argument list++RHS. RHS ::= [Item] ;+separator nonempty RHS "|" ;++-- List size condition+MNonempty. MinimumSize ::= "nonempty" ;+MEmpty. MinimumSize ::= ;++-- Regular expressions++RAlt. Reg ::= Reg "|" Reg1 ; -- left-associative++RMinus. Reg1 ::= Reg1 "-" Reg2 ; -- left-associative++RSeq. Reg2 ::= Reg2 Reg3 ; -- left-associative++RStar. Reg3 ::= Reg3 "*" ;+RPlus. Reg3 ::= Reg3 "+" ;+ROpt. Reg3 ::= Reg3 "?" ;++REps. Reg3 ::= "eps" ; -- empty string, same as {""}++RChar. Reg3 ::= Char ; -- single character+RAlts. Reg3 ::= "[" String "]" ; -- list of alternative characters+RSeqs. Reg3 ::= "{" String "}" ; -- character sequence++RDigit. Reg3 ::= "digit" ;+RLetter. Reg3 ::= "letter" ;+RUpper. Reg3 ::= "upper" ;+RLower. Reg3 ::= "lower" ;+RAny. Reg3 ::= "char" ;++coercions Reg 3;++-- LBNF identifiers++position token Identifier letter (letter | digit | '_')* ;++-- Comments in BNF source+comment "--" ;+comment "{-" "-}" ;
+ src/BNFC/Abs.hs view
@@ -0,0 +1,83 @@+-- Haskell data types for the abstract syntax.+-- Generated by the BNF converter.++module BNFC.Abs where++import Prelude (Char, Double, Int, Integer, String)+import qualified Prelude as C (Eq, Ord, Show, Read)++newtype Identifier = Identifier ((Int, Int), String)+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Grammar = Grammar [Def]+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Def+ = Rule Label Cat [Item]+ | Comment String+ | Comments String String+ | Internal Label Cat [Item]+ | Token Identifier Reg+ | PosToken Identifier Reg+ | Entryp [Cat]+ | Separator MinimumSize Cat String+ | Terminator MinimumSize Cat String+ | Delimiters Cat String String Separation MinimumSize+ | Coercions Identifier Integer+ | Rules Identifier [RHS]+ | Function Identifier [Arg] Exp+ | Layout [String]+ | LayoutStop [String]+ | LayoutTop+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Item = Terminal String | NTerminal Cat+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Cat = ListCat Cat | IdCat Identifier+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Label = Id Identifier | Wild | ListE | ListCons | ListOne+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Arg = Arg Identifier+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Separation = SepNone | SepTerm String | SepSepar String+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Exp+ = Cons Exp Exp+ | App Identifier [Exp]+ | Var Identifier+ | LitInt Integer+ | LitChar Char+ | LitString String+ | LitDouble Double+ | List [Exp]+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data RHS = RHS [Item]+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data MinimumSize = MNonempty | MEmpty+ deriving (C.Eq, C.Ord, C.Show, C.Read)++data Reg+ = RAlt Reg Reg+ | RMinus Reg Reg+ | RSeq Reg Reg+ | RStar Reg+ | RPlus Reg+ | ROpt Reg+ | REps+ | RChar Char+ | RAlts String+ | RSeqs String+ | RDigit+ | RLetter+ | RUpper+ | RLower+ | RAny+ deriving (C.Eq, C.Ord, C.Show, C.Read)+
src/BNFC/Backend/Agda.hs view
@@ -1,114 +1,112 @@-{- | Agda backend.-Generate bindings to Haskell data types for use in Agda.--Example for abstract syntax generated in Haskell backend:-@@-- module CPP.Abs where-- import Prelude (Char, Double, Integer, String)- import qualified Prelude as C (Eq, Ord, Show, Read)-- import qualified Data.Text-- newtype Ident = Ident Data.Text.Text- deriving (C.Eq, C.Ord, C.Show, C.Read)-- data Def = DFun Type Ident [Arg] [Stm]- deriving (C.Eq, C.Ord, C.Show, C.Read)-- data Arg = ADecl Type Ident- deriving (C.Eq, C.Ord, C.Show, C.Read)-- data Stm- = SExp Exp- | SInit Type Ident Exp- | SBlock [Stm]- | SIfElse Exp Stm Stm- deriving (C.Eq, C.Ord, C.Show, C.Read)-- data Exp-- data Type = Type_bool | Type_int | Type_double | Type_void- deriving (C.Eq, C.Ord, C.Show, C.Read)-@@-This should be accompanied by the following Agda code:-@@- module CPP.AST where-- open import Agda.Builtin.Char using () renaming (Char to Char)- open import Agda.Builtin.Float public using () renaming (Float to Double)- open import Agda.Builtin.Int public using () renaming (Int to Integer)- open import Agda.Builtin.List using () renaming (List to #List)- open import Agda.Builtin.String using () renaming- ( String to #String- ; primStringFromList to #stringFromList- )-- {-# FOREIGN GHC import Prelude (Char, Double, Integer, String) #-}- {-# FOREIGN GHC import qualified Data.Text #-}- {-# FOREIGN GHC import qualified CPP.Abs #-}- {-# FOREIGN GHC import CPP.Print (printTree) #-}-- data Ident : Set where- ident : #String → Ident-- {-# COMPILE GHC Ident = data CPP.Abs.Ident (CPP.Abs.Ident) #-}-- data Def : Set where- dFun : (t : Type) (x : Ident) (as : List Arg) (ss : List Stm) → Def-- {-# COMPILE GHC Def = data CPP.Abs.Def (CPP.Abs.DFun) #-}-- data Arg : Set where- aDecl : (t : Type) (x : Ident) → Arg-- {-# COMPILE GHC Arg = data CPP.Abs.Arg (CPP.Abs.ADecl) #-}-- data Stm : Set where- sExp : (e : Exp) → Stm- sInit : (t : Type) (x : Ident) (e : Exp) → Stm- sBlock : (ss : List Stm) → Stm- sIfElse : (e : Exp) (s s' : Stm) → Stm-- {-# COMPILE GHC Stm = data CPP.Abs.Stm- ( CPP.Abs.SExp- | CPP.Abs.SInit- | CPP.Abs.SBlock- | CPP.Abs.SIfElse- ) #-}-- data Type : Set where- typeBool typeInt typeDouble typeVoid : Type-- {-# COMPILE GHC Type = data CPP.Abs.Type- ( CPP.Abs.Type_bool- | CPP.Abs.Type_int- | CPP.Abs.Type_double- | CPP.Abs.Type_void- ) #-}-- -- Binding the BNFC pretty printers.-- printIdent : Ident → String- printIdent (ident s) = String.fromList s-- postulate- printType : Type → String- printExp : Exp → String- printStm : Stm → String- printArg : Arg → String- printDef : Def → String- printProgram : Program → String-- {-# COMPILE GHC printType = \ t -> Data.Text.pack (printTree (t :: CPP.Abs.Type)) #-}- {-# COMPILE GHC printExp = \ e -> Data.Text.pack (printTree (e :: CPP.Abs.Exp)) #-}- {-# COMPILE GHC printStm = \ s -> Data.Text.pack (printTree (s :: CPP.Abs.Stm)) #-}- {-# COMPILE GHC printArg = \ a -> Data.Text.pack (printTree (a :: CPP.Abs.Arg)) #-}- {-# COMPILE GHC printDef = \ d -> Data.Text.pack (printTree (d :: CPP.Abs.Def)) #-}- {-# COMPILE GHC printProgram = \ p -> Data.Text.pack (printTree (p :: CPP.Abs.Program)) #-}-@@--}+-- | Agda backend.+--+-- Generate bindings to Haskell data types for use in Agda.+--+-- Example for abstract syntax generated in Haskell backend:+--+-- > module CPP.Abs where+-- >+-- > import Prelude (Char, Double, Integer, String)+-- > import qualified Prelude as C (Eq, Ord, Show, Read)+-- >+-- > import qualified Data.Text+-- >+-- > newtype Ident = Ident Data.Text.Text+-- > deriving (C.Eq, C.Ord, C.Show, C.Read)+-- >+-- > data Def = DFun Type Ident [Arg] [Stm]+-- > deriving (C.Eq, C.Ord, C.Show, C.Read)+-- >+-- > data Arg = ADecl Type Ident+-- > deriving (C.Eq, C.Ord, C.Show, C.Read)+-- >+-- > data Stm+-- > = SExp Exp+-- > | SInit Type Ident Exp+-- > | SBlock [Stm]+-- > | SIfElse Exp Stm Stm+-- > deriving (C.Eq, C.Ord, C.Show, C.Read)+-- >+-- > data Exp+-- >+-- > data Type = Type_bool | Type_int | Type_double | Type_void+-- > deriving (C.Eq, C.Ord, C.Show, C.Read)+--+-- This should be accompanied by the following Agda code:+--+-- > module CPP.AST where+-- >+-- > open import Agda.Builtin.Char using () renaming (Char to Char)+-- > open import Agda.Builtin.Float public using () renaming (Float to Double)+-- > open import Agda.Builtin.Int public using () renaming (Int to Integer)+-- > open import Agda.Builtin.List using () renaming (List to #List)+-- > open import Agda.Builtin.String using () renaming+-- > ( String to #String+-- > ; primStringFromList to #stringFromList+-- > )+-- >+-- > {-# FOREIGN GHC import Prelude (Char, Double, Integer, String) #-}+-- > {-# FOREIGN GHC import qualified Data.Text #-}+-- > {-# FOREIGN GHC import qualified CPP.Abs #-}+-- > {-# FOREIGN GHC import CPP.Print (printTree) #-}+-- >+-- > data Ident : Set where+-- > ident : #String → Ident+-- >+-- > {-# COMPILE GHC Ident = data CPP.Abs.Ident (CPP.Abs.Ident) #-}+-- >+-- > data Def : Set where+-- > dFun : (t : Type) (x : Ident) (as : List Arg) (ss : List Stm) → Def+-- >+-- > {-# COMPILE GHC Def = data CPP.Abs.Def (CPP.Abs.DFun) #-}+-- >+-- > data Arg : Set where+-- > aDecl : (t : Type) (x : Ident) → Arg+-- >+-- > {-# COMPILE GHC Arg = data CPP.Abs.Arg (CPP.Abs.ADecl) #-}+-- >+-- > data Stm : Set where+-- > sExp : (e : Exp) → Stm+-- > sInit : (t : Type) (x : Ident) (e : Exp) → Stm+-- > sBlock : (ss : List Stm) → Stm+-- > sIfElse : (e : Exp) (s s' : Stm) → Stm+-- >+-- > {-# COMPILE GHC Stm = data CPP.Abs.Stm+-- > ( CPP.Abs.SExp+-- > | CPP.Abs.SInit+-- > | CPP.Abs.SBlock+-- > | CPP.Abs.SIfElse+-- > ) #-}+-- >+-- > data Type : Set where+-- > typeBool typeInt typeDouble typeVoid : Type+-- >+-- > {-# COMPILE GHC Type = data CPP.Abs.Type+-- > ( CPP.Abs.Type_bool+-- > | CPP.Abs.Type_int+-- > | CPP.Abs.Type_double+-- > | CPP.Abs.Type_void+-- > ) #-}+-- >+-- > -- Binding the BNFC pretty printers.+-- >+-- > printIdent : Ident → String+-- > printIdent (ident s) = String.fromList s+-- >+-- > postulate+-- > printType : Type → String+-- > printExp : Exp → String+-- > printStm : Stm → String+-- > printArg : Arg → String+-- > printDef : Def → String+-- > printProgram : Program → String+-- >+-- > {-# COMPILE GHC printType = \ t -> Data.Text.pack (printTree (t :: CPP.Abs.Type)) #-}+-- > {-# COMPILE GHC printExp = \ e -> Data.Text.pack (printTree (e :: CPP.Abs.Exp)) #-}+-- > {-# COMPILE GHC printStm = \ s -> Data.Text.pack (printTree (s :: CPP.Abs.Stm)) #-}+-- > {-# COMPILE GHC printArg = \ a -> Data.Text.pack (printTree (a :: CPP.Abs.Arg)) #-}+-- > {-# COMPILE GHC printDef = \ d -> Data.Text.pack (printTree (d :: CPP.Abs.Def)) #-}+-- > {-# COMPILE GHC printProgram = \ p -> Data.Text.pack (printTree (p :: CPP.Abs.Program)) #-} {-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-}@@ -129,7 +127,7 @@ import Data.Function (on) import qualified Data.List as List import Data.List.NonEmpty (NonEmpty((:|)))-import qualified Data.List.NonEmpty as NEList+import qualified Data.List.NonEmpty as List1 import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe@@ -145,7 +143,7 @@ import BNFC.PrettyPrint import BNFC.Utils (ModuleName, replace, when, table) -type NEList = NEList.NonEmpty+type List1 = List1.NonEmpty -- | How to print the types of constructors in Agda? @@ -183,18 +181,12 @@ mkfile (agdaMainFile opts) $ agdaMainContents (agdaMainFileM opts) (agdaLibFileM opts) (agdaASTFileM opts) (agdaParserFileM opts) (hasLayout cf)- entryPoint+ (firstEntry cf) where -- | Generate parsers for the following non-terminals. -- This includes parsers for 'CoercCat' and 'ListCat'. parserCats :: [Cat]- parserCats = allEntryPoints cf- -- | Entrypoint for test parser:- entryPoint :: Cat- entryPoint = case parserCats of- (c:_) -> c- _ -> error $ "impossible: makeAgda.entryPoint: allEntryPoints cannot be empty"- -- cannot be empty+ parserCats = List1.toList $ allEntryPoints cf -- | In case the grammar makes use of layout, pass also the generated layout Haskell module. layoutMod :: Maybe String layoutMod = when (hasLayout cf) $ Just (layoutFileM opts)@@ -594,11 +586,11 @@ deltaSubscript = ord '₀' - ord '0' -- exploiting that '0' comes before '₀' in character table subscript (m, s) = maybe s (\ n -> s ++ map (chr . (deltaSubscript +) . ord) (show n)) m -- Aggregate consecutive arguments of the same type.- aggregateOn :: Eq c => ((a,b) -> c) -> [(a,b)] -> [(NEList a,b)]+ aggregateOn :: Eq c => ((a,b) -> c) -> [(a,b)] -> [(List1 a,b)] aggregateOn f- = map (\ p -> (NEList.map fst p, snd (NEList.head p)))- . NEList.groupBy ((==) `on` f)- -- . NEList.groupWith f -- Too recent, fails stack-7.8 install+ = map (\ p -> (List1.map fst p, snd (List1.head p)))+ . List1.groupBy ((==) `on` f)+ -- . List1.groupWith f -- Too recent, fails stack-7.8 install -- | Suggest the name of a bound variable of the given category. --
src/BNFC/Backend/Base.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}-{- Backend base function. Defines the type of the backend and some usefull- - functions -}++-- | Backend base module.+--+-- Defines the type of the backend and some useful functions.+ module BNFC.Backend.Base ( Backend , MkFiles@@ -28,8 +31,8 @@ -- output dir or providing a diff instead of overwritting the files on a -- highter level and 3) more purity. ----- The writer monad provide a more conveignent api to generate the list. Note--- that we still use the IO monad for now because some backend insist on+-- The writer monad provides a more convenient API to generate the list. Note+-- that we still use the `IO` monad for now because some backends insist on -- printing stuff to the screen while generating the files. type MkFiles a = WriterT [(FilePath, String)] IO a type Backend = MkFiles ()@@ -40,12 +43,12 @@ execBackend :: MkFiles () -> IO [(FilePath, String)] execBackend = execWriterT --- | A specialized version of tell that adds a file and its content to the--- list of generated files+-- | A specialized version of `tell` that adds a file and its content to the+-- list of generated files. mkfile :: (FileContent c) => FilePath -> c -> MkFiles () mkfile path content = tell [(path, fileContentToString content)] --- | While we are moving to generating Text.PrettyPrint.Doc instead of String,+-- | While we are moving to generating `Text.PrettyPrint.Doc` instead of `String`, -- it is nice to be able to use both as argument to 'mkfile'. -- So we do some typeclass magic. class FileContent a where@@ -63,15 +66,16 @@ -- | Write a set of files to disk. the first argument is the root directory -- inside which all the generated files will be written. This root directory -- and sub-directories will be created as needed (ex: if the files contains a--- a/b/file.txt, `writeFiles` will create the directories `$ROOT/a` and--- `$ROOT/a/b`)+-- @a\/b\/file.txt@, `writeFiles` will create the directories @$ROOT\/a@ and+-- @$ROOT\/a\/b@) writeFiles :: FilePath -> MkFiles () -> IO () writeFiles root fw = do -- First we check that the directory exists fb <- execBackend fw createDirectoryIfMissing True root mapM_ (uncurry writeFile') fb- where writeFile' :: FilePath -> String -> IO ()- writeFile' path content =- createDirectoryIfMissing True (root </> dropFileName path)- >> writeFileRep (root </> path) content+ where+ writeFile' :: FilePath -> String -> IO ()+ writeFile' path content = do+ createDirectoryIfMissing True (root </> dropFileName path)+ writeFileRep (root </> path) content
src/BNFC/Backend/C.hs view
@@ -3,24 +3,13 @@ {- BNF Converter: C Main file Copyright (C) 2004 Author: Michael Pellauer-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA+ Copyright (C) 2020 Andreas Abel -}-module BNFC.Backend.C (makeC) where+module BNFC.Backend.C (makeC, bufferC, bufferH) where import Prelude hiding ((<>))++import Data.Foldable (toList) import qualified Data.Map as Map import BNFC.Utils@@ -41,6 +30,8 @@ let (hfile, cfile) = cf2CAbs (linenumbers opts) prefix cf mkfile "Absyn.h" hfile mkfile "Absyn.c" cfile+ mkfile "Buffer.h" bufferH+ mkfile "Buffer.c" $ bufferC "Buffer.h" let (flex, env) = cf2flex prefix cf mkfile (name ++ ".l") flex let bison = cf2Bison (linenumbers opts) prefix cf env@@ -55,20 +46,26 @@ mkfile "Printer.c" prinC mkfile "Test.c" (ctest cf) Makefile.mkMakefile opts (makefile name prefix)- where prefix :: String -- The prefix is a string used by flex and bison- -- that is prepended to generated function names.- -- In most cases we want the grammar name as the prefix- -- but in a few specific cases, this can create clashes- -- with existing functions- prefix = if name `elem` ["m","c","re","std","str"]- then name ++ "_" else name- name = lang opts+ where+ name :: String+ name = lang opts+ -- The prefix is a string used by flex and bison+ -- that is prepended to generated function names.+ -- It should be a valid C identifier.+ prefix :: String+ prefix = snakeCase_ name ++ "_" makefile :: String -> String -> String -> Doc makefile name prefix basename = vcat [ "CC = gcc -g" , "CCFLAGS = --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration ${CC_OPTS}"+ -- The @#define _POSIX_C_SOURCE 200809L@ is now placed locally in+ -- the generated lexer.+ -- , "CCFLAGS = --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration -D_POSIX_C_SOURCE=200809L ${CC_OPTS}"+ -- , "# Setting _POSIX_C_SOURCE to 200809L activates strdup in string.h."+ -- , "# strdup was not in the ISO C standard before 6/2019 (C2x), yet in POSIX 1003.1."+ -- , "# See https://en.cppreference.com/w/c/experimental/dynamic/strdup" , "" , "FLEX = flex" , "FLEX_OPTS = -P" <> text prefix@@ -76,7 +73,7 @@ , "BISON = bison" , "BISON_OPTS = -t -p" <> text prefix , ""- , "OBJS = Absyn.o Lexer.o Parser.o Printer.o"+ , "OBJS = Absyn.o Buffer.o Lexer.o Parser.o Printer.o" , "" , Makefile.mkRule ".PHONY" ["clean", "distclean"] []@@ -88,9 +85,14 @@ [ name ++ e | e <- [".aux", ".log", ".pdf",".dvi", ".ps", ""]] ] , Makefile.mkRule "distclean" ["clean"] [ "rm -f " ++ unwords- [ "Absyn.h", "Absyn.c", "Test.c", "Parser.c", "Parser.h", "Lexer.c",- "Skeleton.c", "Skeleton.h", "Printer.c", "Printer.h", basename,- name ++ ".l", name ++ ".y", name ++ ".tex"+ [ "Absyn.h", "Absyn.c"+ , "Buffer.h", "Buffer.c"+ , name ++ ".l", "Lexer.c"+ , name ++ ".y", "Parser.h", "Parser.c"+ , "Printer.c", "Printer.h"+ , "Skeleton.c", "Skeleton.h"+ , "Test.c"+ , basename, name ++ ".tex" ] ] , Makefile.mkRule testName ["${OBJS}", "Test.o"]@@ -98,6 +100,8 @@ , "${CC} ${OBJS} Test.o -o " ++ testName ] , Makefile.mkRule "Absyn.o" [ "Absyn.c", "Absyn.h"] [ "${CC} ${CCFLAGS} -c Absyn.c" ]+ , Makefile.mkRule "Buffer.o" [ "Buffer.c", "Buffer.h"]+ [ "${CC} ${CCFLAGS} -c Buffer.c" ] , Makefile.mkRule "Lexer.c" [ name ++ ".l" ] [ "${FLEX} ${FLEX_OPTS} -oLexer.c " ++ name ++ ".l" ] , Makefile.mkRule "Parser.c" [ name ++ ".y" ]@@ -138,7 +142,7 @@ " printf(\"usage: Call with one of the following argument " ++ "combinations:\\n\");", " printf(\"\\t--help\\t\\tDisplay this help message.\\n\");",- " printf(\"\\t(no arguments)\tParse stdin verbosely.\\n\");",+ " printf(\"\\t(no arguments)\\tParse stdin verbosely.\\n\");", " printf(\"\\t(files)\\t\\tParse content of files verbosely.\\n\");", " printf(\"\\t-s (files)\\tSilent mode. Parse content of files " ++ "silently.\\n\");",@@ -191,7 +195,7 @@ ] where cat :: Cat- cat = head $ allEntryPoints cf+ cat = firstEntry cf def :: String def = identCat cat dat :: String@@ -227,7 +231,7 @@ , "extern YYSTYPE yylval;" , "" ]- , concatMap mkFunc $ allEntryPoints cf+ , concatMap mkFunc $ toList $ allEntryPoints cf , [ "" , "#endif" ]@@ -255,3 +259,191 @@ [ identCat (normCat c) ++ " p" ++ identCat c ++ "(FILE *inp);" , identCat (normCat c) ++ " ps" ++ identCat c ++ "(const char *str);" ]+++-- | A tiny buffer library for string buffers in the lexer.++bufferH :: String+bufferH = unlines+ [ "/* This utility file was automatically generated by BNFC. */"+ , ""+ , "/* A dynamically allocated character buffer that grows as it is appended. */"+ , ""+ , "#ifndef BUFFER_HEADER"+ , "#define BUFFER_HEADER"+ , ""+ , "typedef struct buffer {"+ , " char* chars; /* Pointer to start of the buffer. */"+ , " unsigned int size; /* Buffer size (>= 1). */"+ , " unsigned int current; /* Next free character position (< size). */"+ , "} * Buffer;"+ , ""+ , "/* External interface. */"+ , "/************************************************************************/"+ , ""+ , "/* Create a new buffer of the given size. */"+ , "Buffer newBuffer (const unsigned int size);"+ , ""+ , "/* Deallocate the buffer. */"+ , "void freeBuffer (Buffer buffer);"+ , ""+ , "/* Deallocate the buffer, but return its content as string. */"+ , "char* releaseBuffer (Buffer buffer);"+ , ""+ , "/* Clear contents of buffer. */"+ , "void resetBuffer (Buffer buffer);"+ , ""+ , "/* Append string at the end of the buffer. */"+ , "void bufferAppendString (Buffer buffer, const char *s);"+ , ""+ , "/* Append single character at the end of the buffer. */"+ , "void bufferAppendChar (Buffer buffer, const char c);"+ , ""+ , "/* Give read-only access to the buffer content. */"+ , "const char* bufferContent (Buffer buffer);"+ , ""+ , "#endif"+ ]++-- | A tiny buffer library for string buffers in the lexer.++bufferC :: String -> String+bufferC bufferH = unlines+ [ "/* This utility file was automatically generated by BNFC. */"+ , ""+ , "/* A dynamically allocated character buffer that grows as it is appended. */"+ , ""+ , "#include <assert.h> /* assert */"+ , "#include <stdlib.h> /* free, malloc */"+ , "#include <stdio.h> /* fprintf */"+ , "#include <string.h> /* size_t, strncpy */"+ , "#include \"" ++ bufferH ++ "\""+ , ""+ , "/* Internal functions. */"+ , "/************************************************************************/"+ , ""+ , "/* Make sure the buffer can hold `n` more characters. */"+ , "static void bufferAllocateChars (Buffer buffer, const unsigned int n);"+ , ""+ , "/* Increase the buffer size to the new `buffer->size`. */"+ , "static void resizeBuffer(Buffer buffer);"+ , ""+ , "/* External interface. */"+ , "/************************************************************************/"+ , ""+ , "/* Create a new buffer of the given size. */"+ , ""+ , "Buffer newBuffer (const unsigned int size) {"+ , ""+ , " /* The buffer cannot be of size 0. */"+ , " assert (size >= 1);"+ , ""+ , " /* Allocate and initialize a new Buffer structure. */"+ , " Buffer buffer = (Buffer) malloc(sizeof(struct buffer));"+ , " buffer->size = size;"+ , " buffer->current = 0;"+ , " buffer->chars = NULL;"+ , " resizeBuffer(buffer);"+ , " buffer->chars[0] = 0;"+ , " return buffer;"+ , "}"+ , ""+ , "/* Deallocate the buffer and its content. */"+ , ""+ , "void freeBuffer (Buffer buffer) {"+ , " free(buffer->chars);"+ , " free(buffer);"+ , "}"+ , ""+ , "/* Deallocate the buffer, but return its content as string. */"+ , ""+ , "char* releaseBuffer (Buffer buffer) {"+ , " char* content = (char*) realloc (buffer->chars, buffer->current + 1);"+ , " free(buffer);"+ , " return content;"+ , "}"+ , ""+ , "/* Clear contents of buffer. */"+ , ""+ , "void resetBuffer (Buffer buffer) {"+ , " buffer->current = 0;"+ , " buffer->chars[buffer->current] = 0;"+ , "}"+ , ""+ , "/* Append string at the end of the buffer. */"+ , ""+ , "void bufferAppendString (Buffer buffer, const char *s)"+ , "{"+ , " /* Nothing to do if s is the empty string. */"+ , " size_t len = strlen(s);"+ , " if (len) {"+ , ""+ , " /* Make sure the buffer can hold all of s. */"+ , " bufferAllocateChars(buffer, len);"+ , ""+ , " /* Append s at the end of the buffer. */"+ , " strncpy(buffer->chars + buffer->current, s, len);"+ , ""+ , " /* Terminate with 0. */"+ , " buffer->current += len;"+ , " buffer->chars[buffer->current] = 0;"+ , " }"+ , "}"+ , ""+ , "/* Append single character at the end of the buffer. */"+ , ""+ , "void bufferAppendChar (Buffer buffer, const char c)"+ , "{"+ , " /* Make sure the buffer can hold one more character and append it. */"+ , " bufferAllocateChars(buffer, 1);"+ , " buffer->chars[buffer->current] = c;"+ , ""+ , " /* Terminate with 0. */"+ , " buffer->current++;"+ , " buffer->chars[buffer->current] = 0;"+ , "}"+ , ""+ , "/* Give read-only access to the buffer content."+ , " Does not survive the destruction of the buffer object. */"+ , ""+ , "const char* bufferContent (Buffer buffer) {"+ , " return buffer->chars;"+ , "}"+ , ""+ , "/* Internal functions. */"+ , "/************************************************************************/"+ , ""+ , "/* Make sure the buffer can hold `n` more characters. */"+ , ""+ , "static void bufferAllocateChars (Buffer buffer, const unsigned int n) {"+ , " /* 1 extra char for terminating 0. */"+ , " unsigned int requiredSize = buffer->current + 1 + n;"+ , " if (buffer->size < requiredSize)"+ , " {"+ , " do buffer->size *= 2; /* Double the buffer size */"+ , " while (buffer->size < requiredSize);"+ , " resizeBuffer(buffer);"+ , " }"+ , "}"+ , ""+ , "/* Increase the buffer size to the new `size`. */"+ , ""+ , "static void resizeBuffer(Buffer buffer)"+ , "{"+ , " /* The new size needs to be strictly greater than the currently"+ , " * used part, otherwise writing to position buffer->current will"+ , " * be out of bounds."+ , " */"+ , " assert(buffer->size > buffer->current);"+ , ""+ , " /* Resize (or, the first time allocate) the buffer. */"+ , " buffer->chars = (char*) realloc(buffer->chars, buffer->size);"+ , ""+ , " /* Crash if out-of-memory. */"+ , " if (! buffer->chars)"+ , " {"+ , " fprintf(stderr, \"Buffer.c: Error: Out of memory while attempting to grow buffer!\\n\");"+ , " exit(1); /* This seems to be the right exit code for out-of-memory. 137 is only when the OS kills us. */"+ , " }"+ , "}"+ ]
src/BNFC/Backend/C/CFtoBisonC.hs view
@@ -2,44 +2,18 @@ BNF Converter: C Bison generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the Bison input file. Note that because of the way bison stores results the programmer can increase performance by limiting the number of entry points in their grammar. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 6 August, 2003-- Modified : 6 August, 2003--- ************************************************************** -} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE PatternGuards #-}+{-# LANGUAGE TupleSections #-} module BNFC.Backend.C.CFtoBisonC ( cf2Bison@@ -51,6 +25,7 @@ where import Data.Char (toLower)+import Data.Foldable (toList) import Data.List (intercalate, nub) import Data.Maybe (fromMaybe) import qualified Data.Map as Map@@ -70,27 +45,33 @@ --The environment comes from the CFtoFlex cf2Bison :: RecordPositions -> String -> CF -> SymMap -> String-cf2Bison rp name cf env- = unlines- [header name cf,- union (allParserCatsNorm cf),- "%token _ERROR_",- tokens user env,- declarations cf,- specialToks cf,- startSymbol cf,- "%%",- prRules (rulesForBison rp cf env),- errorHandler name+cf2Bison rp name cf env = unlines+ [ header name cf+ , union (allParserCatsNorm cf)+ , "%token _ERROR_"+ , tokens (map fst $ tokenPragmas cf) env+ , declarations cf+ , specialToks cf+ , startSymbol cf+ , ""+ , "%%"+ , ""+ , prRules (rulesForBison rp cf env)+ , "%%"+ , ""+ , errorHandler name ]- where- user = fst (unzip (tokenPragmas cf)) header :: String -> CF -> String header name cf = unlines [ "/* This Bison file was machine-generated by BNFC */"+ , ""+ , concat [ "/* Turn on line/column tracking in the ", name, "lloc structure: */" ] , "%locations"+ , "" , "%{"+ , "/* Begin C preamble code */"+ , "" , "#include <stdlib.h>" , "#include <stdio.h>" , "#include <string.h>"@@ -108,12 +89,14 @@ , "extern void yyerror(const char *str);" , "" , concatMap reverseList $ filter isList $ allParserCatsNorm cf+ , "/* Global variables holding parse results for entrypoints. */" , unlines $ map parseResult $ nub $ map normCat eps , unlines $ map (parseMethod cf name) eps+ , "/* End C preamble code */" , "%}" ] where- eps = allEntryPoints cf+ eps = toList (allEntryPoints cf) -- Andreas, 2019-04-29, #210: Generate also parsers for CoercCat. -- WAS: (allCatsNorm cf) -- Found old comment:@@ -133,8 +116,7 @@ errorHandler :: String -> String errorHandler name = unlines- [ "%%"- , "void yyerror(const char *str)"+ [ "void yyerror(const char *str)" , "{" , " extern char *" ++ name ++ "text;" , " fprintf(stderr,\"error: %d,%d: %s at %s\\n\","@@ -145,7 +127,8 @@ --This generates a parser method for each entry point. parseMethod :: CF -> String -> Cat -> String parseMethod cf name cat = unlines $- [ dat ++ " p" ++ parser ++ "(FILE *inp)"+ [ unwords [ "/* Entrypoint: parse", dat, "from file. */" ]+ , dat ++ " p" ++ parser ++ "(FILE *inp)" , "{" , " " ++ name ++ "_init_lexer(inp);" , " int result = yyparse();"@@ -158,6 +141,8 @@ , " return" +++ res ++ ";" , " }" , "}"+ , ""+ , unwords [ "/* Entrypoint: parse", dat, "from string. */" ] , dat ++ " ps" ++ parser ++ "(const char *str)" , "{" , " YY_BUFFER_STATE buf;"@@ -208,7 +193,8 @@ --For efficiency, we may want to only include used categories here. union :: [Cat] -> String union cats = unlines $ concat- [ [ "%union"+ [ [ "/* The type of a parse result (yylval). */" ]+ , [ "%union" , "{" ] , map (" " ++) unionBuiltinTokens@@ -269,6 +255,7 @@ where ifC cat s = if isUsedCat cf (TokenCat cat) then [s] else [] +-- | Bison only supports a single entrypoint. startSymbol :: CF -> String startSymbol cf = "%start" +++ identCat (firstEntry cf) @@ -279,18 +266,28 @@ mkOne (cat,rules) = constructRule rp cf env rules cat -- For every non-terminal, we construct a set of rules.-constructRule :: RecordPositions -> CF -> SymMap -> [Rule] -> NonTerminal -> (NonTerminal,[(Pattern,Action)])-constructRule rp cf env rules nt = (nt,[(p, generateAction rp (identCat (normCat nt)) (funRule r) b m +++ result) |- r0 <- rules,- let (b,r) = if isConsFun (funRule r0) && elem (valCat r0) revs- then (True,revSepListRule r0)- else (False,r0),- let (p,m) = generatePatterns cf env r])- where- revs = cfgReversibleCats cf- eps = allEntryPoints cf- isEntry nt = nt `elem` eps- result = if isEntry nt then resultName (identCat (normCat nt)) ++ "= $$;" else ""+constructRule+ :: RecordPositions -> CF -> SymMap+ -> [Rule] -- ^ List of alternatives for parsing ...+ -> NonTerminal -- ^ ... this non-terminal.+ -> (NonTerminal,[(Pattern,Action)])+constructRule rp cf env rules nt = (nt,) $+ [ (p,) $ addResult $ generateAction rp (identCat (normCat nt)) (funRule r) b m+ | r0 <- rules+ , let (b,r) = if isConsFun (funRule r0) && valCat r0 `elem` cfgReversibleCats cf+ then (True, revSepListRule r0)+ else (False, r0)+ , let (p,m) = generatePatterns cf env r+ ]+ where+ -- Add action if we parse an entrypoint non-terminal:+ -- Set field in result record to current parse.+ addResult a =+ if nt `elem` toList (allEntryPoints cf)+ -- Note: Bison has only a single entrypoint,+ -- but BNFC works around this by adding dedicated parse methods for all entrypoints.+ then a +++ resultName (identCat (normCat nt)) ++ "= $$;"+ else a -- | Generates a string containing the semantic action. -- >>> generateAction NoRecordPositions "Foo" "Bar" False ["$1"]
src/BNFC/Backend/C/CFtoCAbs.hs view
@@ -6,40 +6,13 @@ BNF Converter: C Abstract syntax Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C Abstract Syntax tree classes. It generates both a Header file and an Implementation file, and Appel's C method. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 15 September, 2003-- Modified : 15 September, 2003--- ************************************************************** -} module BNFC.Backend.C.CFtoCAbs (cf2CAbs) where
src/BNFC/Backend/C/CFtoCPrinter.hs view
@@ -5,41 +5,16 @@ BNF Converter: C Pretty Printer printer Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C Pretty Printer. It also generates the "show" method for printing an abstract syntax tree. The generated files use the Visitor design pattern. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 10 August, 2003- Modified : 3 September, 2003 * Added resizable buffers-- ************************************************************** -} module BNFC.Backend.C.CFtoCPrinter (cf2CPrinter) where@@ -49,6 +24,7 @@ import Data.Bifunctor ( second ) import Data.Char ( toLower ) import Data.Either ( lefts )+import Data.Foldable ( toList ) import Data.List ( nub ) import BNFC.CF@@ -68,7 +44,7 @@ {- **** Header (.h) File Methods **** -} --- | An extremely large function to make the Header File.+-- | Make the Header File. mkHFile :: CF -> [(Cat,[Rule])] -> String mkHFile cf groups = unlines@@ -81,7 +57,7 @@ footer ] where- eps = nub . map normCat $ allEntryPoints cf+ eps = nub . map normCat . toList $ allEntryPoints cf prPrints s | normCat s == s = "char *print" ++ s' ++ "(" ++ s' ++ " p);\n" where s' = identCat s@@ -98,7 +74,7 @@ "#include \"Absyn.h\"", "", "/* Certain applications may improve performance by changing the buffer size */",- "#define BUFFER_INITIAL 2000",+ "#define BUFFER_INITIAL 2048", "/* You may wish to change _L_PAREN or _R_PAREN */", "#define _L_PAREN '('", "#define _R_PAREN ')'",@@ -169,7 +145,7 @@ footer ] where- eps = nub . map normCat $ allEntryPoints cf+ eps = nub . map normCat . toList $ allEntryPoints cf header = unlines [ "/*** BNFC-Generated Pretty Printer and Abstract Syntax Viewer ***/",@@ -288,7 +264,7 @@ "{", " int len = strlen(s);", " int n;",- " while (cur_ + len > buf_size)",+ " while (cur_ + len >= buf_size)", " {", " buf_size *= 2; /* Double the buffer size */", " resizeBuffer();",@@ -302,7 +278,7 @@ "}", "void bufAppendC(const char c)", "{",- " if (cur_ == buf_size)",+ " if (cur_ + 1 >= buf_size)", " {", " buf_size *= 2; /* Double the buffer size */", " resizeBuffer();",
src/BNFC/Backend/C/CFtoCSkel.hs view
@@ -4,39 +4,12 @@ BNF Converter: C Skeleton generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C Skeleton functions. The generated files follow Appel's case method. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 9 August, 2003-- Modified : 12 August, 2003--- ************************************************************** -} module BNFC.Backend.C.CFtoCSkel (cf2CSkel) where
src/BNFC/Backend/C/CFtoFlexC.hs view
@@ -4,42 +4,25 @@ {- BNF Converter: C flex generator Copyright (C) 2004 Author: Michael Pellauer-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module+ Copyright (C) 2020 Andreas Abel Description : This module generates the Flex file. It is similar to JLex but with a few peculiarities. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 5 August, 2003-- Modified : 10 August, 2003--- ************************************************************** -}-module BNFC.Backend.C.CFtoFlexC (cf2flex, lexComments, cMacros, commentStates) where +module BNFC.Backend.C.CFtoFlexC+ ( cf2flex+ , preludeForBuffer -- C code defining a buffer for lexing string literals.+ , cMacros -- Lexer definitions.+ , commentStates -- Stream of names for lexer states for comments.+ , lexComments -- Lexing rules for comments.+ , lexStrings -- Lexing rules for string literals.+ , lexChars -- Lexing rules for character literals.+ ) where+ import Prelude hiding ((<>)) import Data.Bifunctor (first) import Data.List (isInfixOf)@@ -50,12 +33,12 @@ import BNFC.Backend.C.RegToFlex import BNFC.Backend.Common.NamedVariables import BNFC.PrettyPrint-import BNFC.Utils (cstring, unless)+import BNFC.Utils (cstring, unless, when) -- | Entrypoint. cf2flex :: String -> CF -> (String, SymMap) -- The environment is reused by the parser. cf2flex name cf = (, env) $ unlines- [ prelude name+ [ prelude stringLiterals name , cMacros cf , lexSymbols env0 , restOfFlex cf env@@ -65,57 +48,87 @@ env0 = makeSymEnv (cfgSymbols cf ++ reservedWords cf) [0 :: Int ..] env1 = map (first Keyword )env0 ++ makeSymEnv (map Tokentype $ tokenNames cf) [length env0 ..] makeSymEnv = zipWith $ \ s n -> (s, "_SYMB_" ++ show n)+ stringLiterals = isUsedCat cf (TokenCat catString) -prelude :: String -> String-prelude name = unlines- [- "/* -*- c -*- This FLex file was machine-generated by the BNF converter */",- -- noinput and nounput are most often unused- -- https://stackoverflow.com/questions/39075510/option-noinput-nounput-what-are-they-for- "%option noyywrap noinput nounput",- "%{",- "#define yylval " ++ name ++ "lval",- "#define yylloc " ++ name ++ "lloc",- "#define YY_BUFFER_APPEND " ++ name ++ "_BUFFER_APPEND",- "#define YY_BUFFER_RESET " ++ name ++ "_BUFFER_RESET",- "#define init_lexer " ++ name ++ "_init_lexer",- "#include <string.h>",- "#include \"Parser.h\"",- "#define YY_BUFFER_LENGTH 4096",- "char YY_PARSED_STRING[YY_BUFFER_LENGTH];",- "void YY_BUFFER_APPEND(char *s)",- "{",- " strcat(YY_PARSED_STRING, s); /* Do something better here! */",- "}",- "void YY_BUFFER_RESET(void)",- "{",- " int x;",- " for(x = 0; x < YY_BUFFER_LENGTH; x++)",- " YY_PARSED_STRING[x] = 0;",- "}",- -- https://www.gnu.org/software/bison/manual/html_node/Token-Locations.html- -- Flex is responsible for keeping tracking of the yylloc for Bison.- -- Flex also doesn't do this automatically so we need this function- -- https://stackoverflow.com/a/22125500/425756- "static void update_loc(YYLTYPE* loc, char* text)",- "{",- " loc->first_line = loc->last_line;",- " loc->first_column = loc->last_column;",- " int i = 0;", -- put this here as @for (int i...)@ is only allowed in C99- " for (; text[i] != '\\0'; ++i) {",- " if (text[i] == '\\n') {",- " ++loc->last_line;",- " loc->last_column = 0; ",- " } else {",- " ++loc->last_column; ",- " }",- " }",- "}",- "#define YY_USER_ACTION update_loc(&yylloc, yytext);",- "",- "%}"+prelude :: Bool -> String -> String+prelude stringLiterals name = unlines $ concat+ [ [ "/* -*- c -*- This FLex file was machine-generated by the BNF converter */"+ -- noinput and nounput are most often unused+ -- https://stackoverflow.com/questions/39075510/option-noinput-nounput-what-are-they-for+ , "%option noyywrap noinput nounput"+ , "%top{"+ , "/* strdup was not in the ISO C standard before 6/2019 (C2x), but in POSIX 1003.1."+ , " * See: https://en.cppreference.com/w/c/experimental/dynamic/strdup"+ , " * Setting _POSIX_C_SOURCE to 200809L activates strdup in string.h."+ , " */"+ -- The following #define needs to be at the top before the automatic #include <stdlib.h>+ , "#define _POSIX_C_SOURCE 200809L"+ , "}"+ , "%{"+ , "#define yylval " ++ name ++ "lval"+ , "#define yylloc " ++ name ++ "lloc"+ , "#define init_lexer " ++ name ++ "_init_lexer"+ , "#include \"Parser.h\""+ , ""+ ]+ , when stringLiterals $ preludeForBuffer "Buffer.h"+ -- https://www.gnu.org/software/bison/manual/html_node/Token-Locations.html+ -- Flex is responsible for keeping tracking of the yylloc for Bison.+ -- Flex also doesn't do this automatically so we need this function+ -- https://stackoverflow.com/a/22125500/425756+ , [ "static void update_loc(YYLTYPE* loc, char* text)"+ , "{"+ , " loc->first_line = loc->last_line;"+ , " loc->first_column = loc->last_column;"+ , " int i = 0;" -- put this here as @for (int i...)@ is only allowed in C99+ , " for (; text[i] != '\\0'; ++i) {"+ , " if (text[i] == '\\n') {"+ , " ++loc->last_line;"+ , " loc->last_column = 0; "+ , " } else {"+ , " ++loc->last_column; "+ , " }"+ , " }"+ , "}"+ , "#define YY_USER_ACTION update_loc(&yylloc, yytext);"+ , ""+ , "%}"+ ] ] +-- | Part of the lexer prelude needed when string literals are to be lexed.+-- Defines an interface to the Buffer.+preludeForBuffer :: String -> [String]+preludeForBuffer bufferH =+ [ "/* BEGIN extensible string buffer */"+ , ""+ , "#include \"" ++ bufferH ++ "\""+ , ""+ , "/* The initial size of the buffer to lex string literals. */"+ , "#define LITERAL_BUFFER_INITIAL_SIZE 1024"+ , ""+ , "/* The pointer to the literal buffer. */"+ , "static Buffer literal_buffer = NULL;"+ , ""+ , "/* Initialize the literal buffer. */"+ , "#define LITERAL_BUFFER_CREATE() literal_buffer = newBuffer(LITERAL_BUFFER_INITIAL_SIZE)"+ , ""+ , "/* Append characters at the end of the buffer. */"+ , "#define LITERAL_BUFFER_APPEND(s) bufferAppendString(literal_buffer, s)"+ , ""+ , "/* Append a character at the end of the buffer. */"+ , "#define LITERAL_BUFFER_APPEND_CHAR(c) bufferAppendChar(literal_buffer, c)"+ , ""+ , "/* Release the buffer, returning a pointer to its content. */"+ , "#define LITERAL_BUFFER_HARVEST() releaseBuffer(literal_buffer)"+ , ""+ , "/* In exceptional cases, e.g. when reaching EOF, we have to free the buffer. */"+ , "#define LITERAL_BUFFER_FREE() freeBuffer(literal_buffer)"+ , ""+ , "/* END extensible string buffer */"+ , ""+ ]+ -- For now all categories are included. -- Optimally only the ones that are used should be generated. cMacros :: CF -> String@@ -129,7 +142,8 @@ [ [ "%START YYINITIAL CHAR CHARESC CHAREND STRING ESCAPED" ] , take (numberOfBlockCommentForms cf) commentStates ]- , "%%"+ , ""+ , "%% /* Rules. */" ] lexSymbols :: KeywordEnv -> String@@ -146,14 +160,16 @@ , "" ] , userDefTokens- , ifC catString strStates- , ifC catChar chStates+ , ifC catString $ lexStrings "yylval" "_STRING_" "_ERROR_"+ , ifC catChar $ lexChars "yylval" "_CHAR_" , ifC catDouble [ "<YYINITIAL>{DIGIT}+\".\"{DIGIT}+(\"e\"(\\-)?{DIGIT}+)? \t yylval._double = atof(yytext); return _DOUBLE_;" ] , ifC catInteger [ "<YYINITIAL>{DIGIT}+ \t yylval._int = atoi(yytext); return _INTEGER_;" ] , ifC catIdent [ "<YYINITIAL>{LETTER}{IDENT}* \t yylval._string = strdup(yytext); return _IDENT_;" ] , [ "<YYINITIAL>[ \\t\\r\\n\\f] \t /* ignore white space. */;" , "<YYINITIAL>. \t return _ERROR_;"- , "%%"+ , ""+ , "%% /* Initialization code. */"+ , "" ] , footer ]@@ -165,26 +181,6 @@ | (name, exp) <- tokenPragmas cf ] where sName n = fromMaybe n $ Map.lookup (Tokentype n) env- strStates = --These handle escaped characters in Strings.- [ "<YYINITIAL>\"\\\"\" \t BEGIN STRING;"- , "<STRING>\\\\ \t BEGIN ESCAPED;"- , "<STRING>\\\" \t yylval._string = strdup(YY_PARSED_STRING); YY_BUFFER_RESET(); BEGIN YYINITIAL; return _STRING_;"- , "<STRING>. \t YY_BUFFER_APPEND(yytext);"- , "<ESCAPED>n \t YY_BUFFER_APPEND(\"\\n\"); BEGIN STRING;"- , "<ESCAPED>\\\" \t YY_BUFFER_APPEND(\"\\\"\"); BEGIN STRING ;"- , "<ESCAPED>\\\\ \t YY_BUFFER_APPEND(\"\\\\\"); BEGIN STRING;"- , "<ESCAPED>t \t YY_BUFFER_APPEND(\"\\t\"); BEGIN STRING;"- , "<ESCAPED>. \t YY_BUFFER_APPEND(yytext); BEGIN STRING;"- ]- chStates = --These handle escaped characters in Chars.- [ "<YYINITIAL>\"'\" \tBEGIN CHAR;"- , "<CHAR>\\\\ \t BEGIN CHARESC;"- , "<CHAR>[^'] \t BEGIN CHAREND; yylval._char = yytext[0]; return _CHAR_;"- , "<CHARESC>n \t BEGIN CHAREND; yylval._char = '\\n'; return _CHAR_;"- , "<CHARESC>t \t BEGIN CHAREND; yylval._char = '\\t'; return _CHAR_;"- , "<CHARESC>. \t BEGIN CHAREND; yylval._char = yytext[0]; return _CHAR_;"- , "<CHAREND>\"'\" \t BEGIN YYINITIAL;"- ] footer = [ "void init_lexer(FILE *inp)",@@ -196,6 +192,33 @@ " yylloc.last_column = 1;", " BEGIN YYINITIAL;", "}"+ ]++-- | Lexing of strings, converting escaped characters.+lexStrings :: String -> String -> String -> [String]+lexStrings yylval stringToken errorToken =+ [ "<YYINITIAL>\"\\\"\" \t LITERAL_BUFFER_CREATE(); BEGIN STRING;"+ , "<STRING>\\\\ \t BEGIN ESCAPED;"+ , "<STRING>\\\" \t " ++ yylval ++ "._string = LITERAL_BUFFER_HARVEST(); BEGIN YYINITIAL; return " ++ stringToken ++ ";"+ , "<STRING>. \t LITERAL_BUFFER_APPEND_CHAR(yytext[0]);"+ , "<ESCAPED>n \t LITERAL_BUFFER_APPEND_CHAR('\\n'); BEGIN STRING;"+ , "<ESCAPED>\\\" \t LITERAL_BUFFER_APPEND_CHAR('\"'); BEGIN STRING;"+ , "<ESCAPED>\\\\ \t LITERAL_BUFFER_APPEND_CHAR('\\\\'); BEGIN STRING;"+ , "<ESCAPED>t \t LITERAL_BUFFER_APPEND_CHAR('\\t'); BEGIN STRING;"+ , "<ESCAPED>. \t LITERAL_BUFFER_APPEND(yytext); BEGIN STRING;"+ , "<STRING,ESCAPED><<EOF>>\t LITERAL_BUFFER_FREE(); return " ++ errorToken ++ ";"+ ]++-- | Lexing of characters, converting escaped characters.+lexChars :: String -> String -> [String]+lexChars yylval charToken =+ [ "<YYINITIAL>\"'\" \tBEGIN CHAR;"+ , "<CHAR>\\\\ \t BEGIN CHARESC;"+ , "<CHAR>[^'] \t BEGIN CHAREND; " ++ yylval ++ "._char = yytext[0]; return " ++ charToken ++ ";"+ , "<CHARESC>n \t BEGIN CHAREND; " ++ yylval ++ "._char = '\\n'; return " ++ charToken ++ ";"+ , "<CHARESC>t \t BEGIN CHAREND; " ++ yylval ++ "._char = '\\t'; return " ++ charToken ++ ";"+ , "<CHARESC>. \t BEGIN CHAREND; " ++ yylval ++ "._char = yytext[0]; return " ++ charToken ++ ";"+ , "<CHAREND>\"'\" \t BEGIN YYINITIAL;" ] -- ---------------------------------------------------------------------------
src/BNFC/Backend/C/RegToFlex.hs view
@@ -1,9 +1,13 @@+{-# LANGUAGE LambdaCase #-}+ module BNFC.Backend.C.RegToFlex (printRegFlex) where -- modified from pretty-printer generated by the BNF converter -import Data.Char (showLitChar)-import AbsBNF+import Data.Char (ord, showLitChar)+import qualified Data.List as List++import BNFC.Abs import BNFC.Backend.Common (flexEps) -- the top-level printing method@@ -31,16 +35,7 @@ -- the printer class does the job class Print a where prt :: Int -> a -> [String]- prtList :: [a] -> [String]- prtList = concat . map (prt 0) -instance Print a => Print [a] where- prt _ = prtList--instance Print Char where- prt _ c = [[c]]- prtList s = map (concat . prt 0) s- prPrec :: Int -> Int -> [String] -> [String] prPrec i j = if j<i then parenth else id @@ -48,7 +43,7 @@ prt _ (Identifier (_, i)) = [i] instance Print Reg where- prt i e = case e of+ prt i = \case RSeq reg0 reg -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg]) RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg]) @@ -56,28 +51,34 @@ -- https://westes.github.io/flex/manual/Patterns.html#Patterns -- RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg]) RMinus reg0 REps -> prt i reg0 -- REps is identity for set difference- RMinus RAny reg@(RChar _) -> prPrec i 3 (concat [["[^"],prt 0 reg,["]"]])- RMinus RAny (RAlts str) -> prPrec i 3 (concat [["[^"],prt 0 $ mkEsc str,["]"]])+ RMinus RAny (RChar c) -> [ concat [ "[^", escapeChar c, "]" ] ]+ RMinus RAny (RAlts str) -> [ concat [ "[^", concatMap escapeChar str, "]" ] ]+ -- FIXME: unicode inside brackets [...] is not accepted by flex -- FIXME: maybe we could add cases for char - RDigit, RLetter etc. RMinus _ _ -> error "Flex does not support general set difference" - RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]])- RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]])- ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]])- REps -> prPrec i 3 [ flexEps ]- RChar c -> prPrec i 3 (prt 0 [mkEsc [c]])- RAlts str -> prPrec i 3 (concat [["["], prt 0 $ mkEsc str, ["]"]])- RSeqs str -> prPrec i 2 (concat (map (prt 0) $ mkEsc str))- RDigit -> prPrec i 3 (concat [["{DIGIT}"]])- RLetter -> prPrec i 3 (concat [["{LETTER}"]])- RUpper -> prPrec i 3 (concat [["{CAPITAL}"]])- RLower -> prPrec i 3 (concat [["{SMALL}"]])- RAny -> prPrec i 3 (concat [["."]])+ RStar reg -> concat [ prt 3 reg , ["*"] ]+ RPlus reg -> concat [ prt 3 reg , ["+"] ]+ ROpt reg -> concat [ prt 3 reg , ["?"] ]+ REps -> [ flexEps ]+ RChar c -> [ escapeChar c ]+ -- Unicode characters cannot be inside [...] so we use | instead.+ RAlts str -> prPrec i 1 $ List.intersperse "|" $ map escapeChar str+ -- RAlts str -> concat [["["], prt 0 $ concatMap escapeChar str, ["]"]]+ RSeqs str -> prPrec i 2 $ map escapeChar str+ RDigit -> [ "{DIGIT}" ]+ RLetter -> [ "{LETTER}" ]+ RUpper -> [ "{CAPITAL}" ]+ RLower -> [ "{SMALL}" ]+ RAny -> [ "." ] --- Handle special characters in regular expressions.-mkEsc :: String -> String-mkEsc = concatMap escChar+-- | Handle special characters in regular expressions.++escapeChar :: Char -> String+escapeChar c+ | c `elem` reserved = '\\':[c]+ | let x = ord c, x >= 256 = [c] -- keep unicode characters -- "\x" ++ showHex x ""+ | otherwise = showLitChar c "" where- escChar c- | c `elem` ("$+-*=<>[](){}!?.,;:^~|&%#/\\$_@\"" :: String) = '\\':[c]- | otherwise = showLitChar c ""+ reserved :: String+ reserved = "$+-*=<>[](){}!?.,;:^~|&%#/\\$_@\""
src/BNFC/Backend/CPP/Makefile.hs view
@@ -14,7 +14,7 @@ , mkVar "BISON" "bison" , mkVar "BISON_OPTS" ("-t -p" ++ name) , ""- , mkVar "OBJS" "Absyn.o Lexer.o Parser.o Printer.o"+ , mkVar "OBJS" "Absyn.o Buffer.o Lexer.o Parser.o Printer.o" , "" , mkRule ".PHONY" ["clean", "distclean"] []@@ -26,9 +26,15 @@ [ name ++ e | e <- [".aux", ".log", ".pdf",".dvi", ".ps", ""]] ] , mkRule "distclean" ["clean"] [ "rm -f " ++ unwords- [ "Absyn.C", "Absyn.H", "Test.C", "Parser.C", "Parser.H", "ParserError.H", "Lexer.C",- "Skeleton.C", "Skeleton.H", "Printer.C", "Printer.H", basename,- name ++ ".l", name ++ ".y", name ++ ".tex"+ [ "Absyn.C", "Absyn.H"+ , "Buffer.C", "Buffer.H"+ , "Test.C"+ , "Parser.C", "Parser.H", "ParserError.H", name ++ ".y"+ , "Lexer.C", name ++ ".l"+ , "Skeleton.C", "Skeleton.H"+ , "Printer.C", "Printer.H"+ , basename+ , name ++ ".tex" ] ] , mkRule testName [ "${OBJS}", "Test.o" ]@@ -36,6 +42,8 @@ , "${CC} ${OBJS} Test.o -o " ++ testName ] , mkRule "Absyn.o" [ "Absyn.C", "Absyn.H" ] [ "${CC} ${CCFLAGS} -c Absyn.C" ]+ , mkRule "Buffer.o" [ "Buffer.C", "Buffer.H" ]+ [ "${CC} ${CCFLAGS} -c Buffer.C " ] , mkRule "Lexer.C" [ name ++ ".l" ] [ "${FLEX} -oLexer.C " ++ name ++ ".l" ] , mkRule "Parser.C" [ name ++ ".y" ]
src/BNFC/Backend/CPP/NoSTL.hs view
@@ -1,25 +1,12 @@ {- BNF Converter: C++ Main file Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.CPP.NoSTL (makeCppNoStl) where import Data.Char+import Data.Foldable (toList) import Data.List (nub) import qualified Data.Map as Map @@ -27,6 +14,7 @@ import BNFC.CF import BNFC.Options import BNFC.Backend.Base+import BNFC.Backend.C (bufferH, bufferC) import BNFC.Backend.C.CFtoBisonC (unionBuiltinTokens) import BNFC.Backend.CPP.Makefile import BNFC.Backend.CPP.NoSTL.CFtoCPPAbs@@ -41,11 +29,13 @@ let (hfile, cfile) = cf2CPPAbs name cf mkfile "Absyn.H" hfile mkfile "Absyn.C" cfile+ mkfile "Buffer.H" bufferH+ mkfile "Buffer.C" $ bufferC "Buffer.H" let (flex, env) = cf2flex Nothing name cf mkfile (name ++ ".l") flex let bison = cf2Bison name cf env mkfile (name ++ ".y") bison- let header = mkHeaderFile cf (allParserCats cf) (allEntryPoints cf) (Map.elems env)+ let header = mkHeaderFile cf (allParserCats cf) (toList $ allEntryPoints cf) (Map.elems env) mkfile "Parser.H" header let (skelH, skelC) = cf2CVisitSkel False Nothing cf mkfile "Skeleton.H" skelH@@ -78,7 +68,7 @@ " printf(\"usage: Call with one of the following argument " ++ "combinations:\\n\");", " printf(\"\\t--help\\t\\tDisplay this help message.\\n\");",- " printf(\"\\t(no arguments)\tParse stdin verbosely.\\n\");",+ " printf(\"\\t(no arguments)\\tParse stdin verbosely.\\n\");", " printf(\"\\t(files)\\t\\tParse content of files verbosely.\\n\");", " printf(\"\\t-s (files)\\tSilent mode. Parse content of files " ++ "silently.\\n\");",@@ -130,7 +120,7 @@ "" ] where- cat = head (allEntryPoints cf)+ cat = firstEntry cf dat = identCat $ normCat cat def = identCat cat
src/BNFC/Backend/CPP/NoSTL/CFtoBison.hs view
@@ -4,47 +4,19 @@ BNF Converter: Bison generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---{-- **************************************************************- BNF Converter Module- Description : This module generates the Bison input file. Note that because of the way bison stores results the programmer can increase performance by limiting the number of entry points in their grammar. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 6 August, 2003-- Modified : 6 August, 2003--- ************************************************************** -} - module BNFC.Backend.CPP.NoSTL.CFtoBison (cf2Bison) where import Data.Char ( toLower )+import Data.Foldable ( toList ) import Data.List ( intersperse, nub ) import Data.Maybe ( fromMaybe ) import qualified Data.Map as Map@@ -115,7 +87,7 @@ , "%}" ] where- eps = allEntryPoints cf+ eps = toList $ allEntryPoints cf dats = nub $ map normCat eps
src/BNFC/Backend/CPP/NoSTL/CFtoCPPAbs.hs view
@@ -1,42 +1,17 @@ {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-}+ {- BNF Converter: C++ abstract syntax generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C++ Abstract Syntax tree classes. It generates both a Header file and an Implementation file, and uses the Visitor design pattern. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 4 August, 2003- Modified : 22 May, 2004 / Antti-Juhani Kaijanaho--- ************************************************************** -} module BNFC.Backend.CPP.NoSTL.CFtoCPPAbs (cf2CPPAbs) where
src/BNFC/Backend/CPP/NoSTL/CFtoFlex.hs view
@@ -4,40 +4,16 @@ {- BNF Converter: Flex generator Copyright (C) 2004 Author: Michael Pellauer-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module+ Copyright (C) 2020 Andreas Abel Description : This module generates the Flex file. It is similar to JLex but with a few peculiarities. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 5 August, 2003- Modified : 22 August, 2006 by Aarne Ranta--- ************************************************************** -}+ module BNFC.Backend.CPP.NoSTL.CFtoFlex (cf2flex) where import Prelude hiding ((<>))@@ -46,17 +22,17 @@ import qualified Data.Map as Map import BNFC.CF-import BNFC.Backend.C.CFtoFlexC (cMacros, commentStates)+import BNFC.Backend.C.CFtoFlexC (preludeForBuffer, cMacros, commentStates, lexChars, lexStrings) import BNFC.Backend.C.RegToFlex import BNFC.Backend.Common.NamedVariables import BNFC.Backend.CPP.STL.STLUtils import BNFC.PrettyPrint-import BNFC.Utils (cstring)+import BNFC.Utils (cstring, when) --The environment must be returned for the parser to use. cf2flex :: Maybe String -> String -> CF -> (String, SymMap) cf2flex inPackage _name cf = (, env) $ unlines- [ prelude inPackage+ [ prelude stringLiterals inPackage , cMacros cf , lexSymbols env0 , restOfFlex inPackage cf env@@ -66,28 +42,20 @@ env0 = makeSymEnv (cfgSymbols cf ++ reservedWords cf) [0 :: Int ..] env1 = map (first Keyword) env0 ++ makeSymEnv (map Tokentype $ tokenNames cf) [length env0 ..] makeSymEnv = zipWith $ \ s n -> (s, "_SYMB_" ++ show n)+ stringLiterals = isUsedCat cf (TokenCat catString) -prelude :: Maybe String -> String-prelude inPackage = unlines- [- maybe "" (\ns -> "%option prefix=\"" ++ ns ++ "yy\"") inPackage,- "/* This FLex file was machine-generated by the BNF converter */",- "%{",- "#include <string.h>",- "#include \"Parser.H\"",- "#define YY_BUFFER_LENGTH 4096",- "extern int " ++ nsString inPackage ++ "yy_mylinenumber ;", --- hack to get line number. AR 2006- "static char YY_PARSED_STRING[YY_BUFFER_LENGTH];",- "static void YY_BUFFER_APPEND(const char *s)",- "{",- " strcat(YY_PARSED_STRING, s); //Do something better here!",- "}",- "static void YY_BUFFER_RESET(void)",- "{",- " memset(YY_PARSED_STRING, 0, YY_BUFFER_LENGTH);",- "}",- "",- "%}"+prelude :: Bool -> Maybe String -> String+prelude stringLiterals inPackage = unlines $ concat+ [ [ "/* This FLex file was machine-generated by the BNF converter */" ]+ , maybe [] (\ ns -> [ "%option prefix=\"" ++ ns ++ "yy\"" ]) inPackage+ , [ "%{"+ , "#include <string.h>"+ , "#include \"Parser.H\""+ , "extern int " ++ nsString inPackage ++ "yy_mylinenumber ;" --- hack to get line number. AR 2006+ , ""+ ]+ , when stringLiterals $ preludeForBuffer "Buffer.H"+ , [ "%}" ] ] lexSymbols :: SymEnv -> String@@ -104,8 +72,8 @@ , "" ] , userDefTokens- , ifC catString strStates- , ifC catChar chStates+ , ifC catString $ lexStrings (ns ++ "yylval") (nsDefine inPackage "_STRING_") (nsDefine inPackage "_ERROR_")+ , ifC catChar $ lexChars (ns ++ "yylval") (nsDefine inPackage "_CHAR_") , ifC catDouble [ "<YYINITIAL>{DIGIT}+\".\"{DIGIT}+(\"e\"(\\-)?{DIGIT}+)? \t " ++ ns ++ "yylval._double = atof(yytext); return " ++ nsDefine inPackage "_DOUBLE_" ++ ";" ] , ifC catInteger [ "<YYINITIAL>{DIGIT}+ \t " ++ ns ++ "yylval._int = atoi(yytext); return " ++ nsDefine inPackage "_INTEGER_" ++ ";" ] , ifC catIdent [ "<YYINITIAL>{LETTER}{IDENT}* \t " ++ ns ++ "yylval._string = strdup(yytext); return " ++ nsDefine inPackage "_IDENT_" ++ ";" ]@@ -125,26 +93,6 @@ | (name, exp) <- tokenPragmas cf ] where sName n = fromMaybe n $ Map.lookup (Tokentype n) env- strStates = --These handle escaped characters in Strings.- [ "<YYINITIAL>\"\\\"\" \t BEGIN STRING;"- , "<STRING>\\\\ \t BEGIN ESCAPED;"- , "<STRING>\\\" \t " ++ ns ++ "yylval._string = strdup(YY_PARSED_STRING); YY_BUFFER_RESET(); BEGIN YYINITIAL; return " ++ nsDefine inPackage "_STRING_" ++ ";"- , "<STRING>. \t YY_BUFFER_APPEND(yytext);"- , "<ESCAPED>n \t YY_BUFFER_APPEND(\"\\n\"); BEGIN STRING;"- , "<ESCAPED>\\\" \t YY_BUFFER_APPEND(\"\\\"\"); BEGIN STRING ;"- , "<ESCAPED>\\\\ \t YY_BUFFER_APPEND(\"\\\\\"); BEGIN STRING;"- , "<ESCAPED>t \t YY_BUFFER_APPEND(\"\\t\"); BEGIN STRING;"- , "<ESCAPED>. \t YY_BUFFER_APPEND(yytext); BEGIN STRING;"- ]- chStates = --These handle escaped characters in Chars.- [ "<YYINITIAL>\"'\" \tBEGIN CHAR;"- , "<CHAR>\\\\ \t BEGIN CHARESC;"- , "<CHAR>[^'] \t BEGIN CHAREND; " ++ ns ++ "yylval._char = yytext[0]; return " ++ nsDefine inPackage "_CHAR_" ++ ";"- , "<CHARESC>n \t BEGIN CHAREND; " ++ ns ++ "yylval._char = '\\n'; return " ++ nsDefine inPackage "_CHAR_" ++ ";"- , "<CHARESC>t \t BEGIN CHAREND; " ++ ns ++ "yylval._char = '\\t'; return " ++ nsDefine inPackage "_CHAR_" ++ ";"- , "<CHARESC>. \t BEGIN CHAREND; " ++ ns ++ "yylval._char = yytext[0]; return " ++ nsDefine inPackage "_CHAR_" ++ ";"- , "<CHAREND>\"'\" \t BEGIN YYINITIAL;"- ] footer = [ "void " ++ ns ++ "initialize_lexer(FILE *inp) { yyrestart(inp); BEGIN YYINITIAL; }" , "int yywrap(void) { return 1; }"
src/BNFC/Backend/CPP/PrettyPrinter.hs view
@@ -11,12 +11,8 @@ The generated files use the Visitor design pattern. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 10 August, 2003- Modified : 3 September, 2003 * Added resizable buffers
src/BNFC/Backend/CPP/STL.hs view
@@ -1,34 +1,24 @@ {- BNF Converter: C++ Main file Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer+ Copyright (C) 2020 Andreas Abel Modified from CPPTop to BNFC.Backend.CPP.STL 2006 by Aarne Ranta. - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.CPP.STL (makeCppStl,) where import Data.Char-import Data.List (nub)+import Data.Foldable (toList)+import qualified Data.List as List import qualified Data.Map as Map import BNFC.Utils import BNFC.CF import BNFC.Options import BNFC.Backend.Base+import BNFC.Backend.C (bufferH, bufferC) import BNFC.Backend.C.CFtoBisonC (unionBuiltinTokens) import BNFC.Backend.CPP.Makefile import BNFC.Backend.CPP.STL.CFtoSTLAbs@@ -44,11 +34,13 @@ let (hfile, cfile) = cf2CPPAbs (linenumbers opts) (inPackage opts) name cf mkfile "Absyn.H" hfile mkfile "Absyn.C" cfile+ mkfile "Buffer.H" bufferH+ mkfile "Buffer.C" $ bufferC "Buffer.H" let (flex, env) = cf2flex (inPackage opts) name cf mkfile (name ++ ".l") flex let bison = cf2Bison (linenumbers opts) (inPackage opts) name cf env mkfile (name ++ ".y") bison- let header = mkHeaderFile (inPackage opts) cf (allParserCats cf) (allEntryPoints cf) (Map.elems env)+ let header = mkHeaderFile (inPackage opts) cf (allParserCats cf) (toList $ allEntryPoints cf) (Map.elems env) mkfile "Parser.H" header mkfile "ParserError.H" $ printParseErrHeader (inPackage opts) let (skelH, skelC) = cf2CVisitSkel True (inPackage opts) cf@@ -107,7 +99,7 @@ " printf(\"usage: Call with one of the following argument " ++ "combinations:\\n\");", " printf(\"\\t--help\\t\\tDisplay this help message.\\n\");",- " printf(\"\\t(no arguments)\tParse stdin verbosely.\\n\");",+ " printf(\"\\t(no arguments)\\tParse stdin verbosely.\\n\");", " printf(\"\\t(files)\\t\\tParse content of files verbosely.\\n\");", " printf(\"\\t-s (files)\\tSilent mode. Parse content of files " ++ "silently.\\n\");",@@ -140,11 +132,11 @@ " }", " } else input = stdin;", " /* The default entry point is used. For other options see Parser.H */",- " " ++ scope ++ dat ++ " *parse_tree = nullptr;",+ " " ++ scope ++ dat ++ " *parse_tree = NULL;", " try { ", " parse_tree = " ++ scope ++ "p" ++ def ++ "(input);", " } catch( " ++ scope ++ "parse_error &e) {",- " std::cout << \"Parse error on line \" << e.getLine(); ",+ " std::cerr << \"Parse error on line \" << e.getLine() << \"\\n\"; ", " }", " if (parse_tree)", " {",@@ -164,7 +156,7 @@ "" ] where- cat = head $ allEntryPoints cf+ cat = firstEntry cf dat = identCat $ normCat cat def = identCat cat scope = nsScope inPackage@@ -178,7 +170,7 @@ , "" , nsStart inPackage ]- , map mkForwardDec $ nub $ map normCat cats+ , map mkForwardDec $ List.nub $ map normCat cats , [ "typedef union" , "{" ]
src/BNFC/Backend/CPP/STL/CFtoBisonSTL.hs view
@@ -7,25 +7,6 @@ BNF Converter: C++ Bison generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the Bison input file using STL. The main difference to CFtoBison is in handling lists: by using std::vector and push_back, our rules@@ -34,19 +15,12 @@ the programmer can increase performance by limiting the number of entry points in their grammar. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 6 August, 2003- Modified : 19 August, 2006, by Aarne Ranta (aarne@cs.chalmers.se) -- ************************************************************** -} - module BNFC.Backend.CPP.STL.CFtoBisonSTL ( cf2Bison , tokens, union@@ -56,6 +30,7 @@ import Prelude hiding ((<>)) import Data.Char ( isUpper )+import Data.Foldable (toList) import Data.List ( nub, intercalate ) import Data.Maybe ( fromMaybe ) import qualified Data.Map as Map@@ -125,7 +100,6 @@ , "}" , "void " ++ ns ++ "yyerror(const char *str)" , "{"- , " extern char *"++ns++"yytext;" , " throw "++ns++"::parse_error("++ ns ++ "yy_mylinenumber,str);" , "}" , ""@@ -138,7 +112,7 @@ ] where ns = nsString inPackage- eps = allEntryPoints cf ++ map TokenCat (positionCats cf)+ eps = toList (allEntryPoints cf) ++ map TokenCat (positionCats cf) dats = nub $ map normCat eps definedRules :: CF -> String@@ -338,7 +312,7 @@ ---- "(:[])" -> identCat nt z -> z revs = cfgReversibleCats cf- eps = allEntryPoints cf+ eps = toList $ allEntryPoints cf isEntry nt = nt `elem` eps result = if isEntry nt then (nsScope inPackage ++ resultName (identCat (normCat nt))) ++ "= $$;" else ""
src/BNFC/Backend/CPP/STL/CFtoCVisitSkelSTL.hs view
@@ -2,39 +2,14 @@ BNF Converter: C++ Skeleton generation Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C++ Skeleton functions. The generated files use the Visitor design pattern. - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 9 August, 2003- Modified : 29 August, 2006 Aarne Ranta -- ************************************************************** -} module BNFC.Backend.CPP.STL.CFtoCVisitSkelSTL (cf2CVisitSkel) where
src/BNFC/Backend/CPP/STL/CFtoSTLAbs.hs view
@@ -2,40 +2,16 @@ BNF Converter: C++ abstract syntax generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the C++ Abstract Syntax tree classes. It generates both a Header file and an Implementation file, and uses the Visitor design pattern. It uses STL (Standard Template Library). - Author : Michael Pellauer (pellauer@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer Created : 4 August, 2003- Modified : 22 May, 2004 / Antti-Juhani Kaijanaho 29 August, 2006 / Aarne Ranta - ************************************************************** -} module BNFC.Backend.CPP.STL.CFtoSTLAbs (cf2CPPAbs) where
src/BNFC/Backend/CPP/STL/STLUtils.hs view
@@ -2,19 +2,6 @@ BNF Converter: C++ common functions Copyright (C) 2008 Author: Martin Ejdestig - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.CPP.STL.STLUtils where
− src/BNFC/Backend/CSharp.hs
@@ -1,338 +0,0 @@-{-- BNF Converter: C# Main file- Copyright (C) 2006-2007 Author: Johan Broberg-- Modified from STLTop 2006.-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}-{-- **************************************************************- BNF Converter Module-- Description : C# Main file-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 20 November, 2006-- Modified : 8 January, 2007 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp (makeCSharp) where--import BNFC.CF-import BNFC.Options-import BNFC.Backend.Common.OOAbstract-import BNFC.Backend.Common.Makefile-import BNFC.Backend.Base-import BNFC.Backend.CSharp.CAbstoCSharpAbs-import BNFC.Backend.CSharp.CFtoGPLEX-import BNFC.Backend.CSharp.CFtoGPPG-import BNFC.Backend.CSharp.CAbstoCSharpVisitSkeleton-import BNFC.Backend.CSharp.CAbstoCSharpAbstractVisitSkeleton-import BNFC.Backend.CSharp.CFtoCSharpPrinter-import BNFC.Backend.CSharp.CSharpUtils-import BNFC.PrettyPrint hiding ((<.>), (<>))-import System.Environment (getEnv)-import System.FilePath ((<.>))-import System.Directory-import System.IO-import System.IO.Error (catchIOError)-import System.Process-import Data.Maybe-import Control.Monad (when)-import qualified BNFC.Backend.Common.Makefile as Makefile--- Control.Monad.State--makeCSharp :: SharedOptions -> CF -> MkFiles ()-makeCSharp opts cf = do- let namespace = fromMaybe (lang opts) maybenamespace- cabs = cf2cabs cf- absyn = cabs2csharpabs namespace cabs wcfSupport- (gplex, env) = cf2gplex namespace cf- gppg = cf2gppg namespace cf env- skeleton = cabs2csharpvisitskeleton namespace cabs- absSkeleton = cabs2csharpAbstractVisitSkeleton namespace cabs- printer = cf2csharpprinter namespace cf- mkfile "Absyn.cs" absyn- mkfile (namespace ++ ".l") gplex- liftIO $ putStrLn " (Tested with GPLEX RC1)"- mkfile (namespace ++ ".y") gppg- liftIO $ putStrLn " (Tested with GPPG 1.0)"- mkfile "AbstractVisitSkeleton.cs" absSkeleton- mkfile "VisitSkeleton.cs" skeleton- mkfile "Printer.cs" printer- mkfile "Test.cs" (csharptest namespace cf)- when vsfiles (writeVisualStudioFiles namespace)- when makefile (writeMakefile opts namespace)- where makefile = isJust $ make opts- vsfiles = visualStudio opts- wcfSupport = wcf opts- maybenamespace = inPackage opts--writeMakefile :: SharedOptions -> Namespace -> MkFiles ()-writeMakefile opts namespace = do- mkMakefile opts makefile- liftIO $ putStrLn ""- liftIO $ putStrLn "-----------------------------------------------------------------------------"- liftIO $ putStrLn "Generated Makefile, which uses mono. You may want to modify the paths to"- liftIO $ putStrLn "GPLEX and GPPG - unless you are sure that they are globally accessible (the"- liftIO $ putStrLn "default commands are \"mono gplex.exe\" and \"mono gppg.exe\", respectively."- liftIO $ putStrLn "The Makefile assumes that ShiftReduceParser.dll is located in ./bin and that"- liftIO $ putStrLn "is also where test.exe will be generated."- liftIO $ putStrLn "-----------------------------------------------------------------------------"- liftIO $ putStrLn ""- where- makefile basename = vcat- ["MONO = mono", "MONOC = gmcs"- , "MONOCFLAGS = -optimize -reference:${PARSERREF}"- , "GPLEX = ${MONO} gplex.exe", "GPPG = ${MONO} gppg.exe"- , "PARSERREF = bin/ShiftReduceParser.dll"- , "CSFILES = Absyn.cs Parser.cs Printer.cs Scanner.cs Test.cs VisitSkeleton.cs AbstractVisitSkeleton.cs"- , Makefile.mkRule "all" [ "test" ]- []- , Makefile.mkRule "clean" []- -- peteg: don't nuke what we generated - move that to the "vclean" target.- [ "rm -f " ++ namespace ++ ".pdf test" ]- , Makefile.mkRule "distclean" [ "clean" ]- [ "rm -f ${CSFILES}"- , "rm -f " ++ unwords [namespace <.> ext | ext <- [ "l","y","tex" ]]- , "rm -f " ++ basename ]- , Makefile.mkRule "test" [ "Parser.cs", "Scanner.cs" ]- [ "@echo \"Compiling test...\""- , "${MONOC} ${MONOCFLAGS} -out:bin/test.exe ${CSFILES}" ]- , Makefile.mkRule "Scanner.cs" [ namespace <.> "l" ]- [ "${GPLEX} /out:$@ " ++ namespace <.> "l" ]- , Makefile.mkRule "Parser.cs" [ namespace <.> "y" ]- [ "${GPPG} /gplex " ++ namespace <.> "y > $@" ]- ]--writeVisualStudioFiles :: Namespace -> MkFiles ()-writeVisualStudioFiles namespace = do- guid <- projectguid- mkfile (namespace ++ ".csproj") (csproj guid)- mkfile (namespace ++ ".sln") (sln guid)- mkfile "run-gp.bat" batchfile- liftIO $ putStrLn ""- liftIO $ putStrLn "-----------------------------------------------------------------------------"- liftIO $ putStrLn "Visual Studio solution (.sln) and project (.csproj) files were written."- liftIO $ putStrLn "The project file has a reference to GPLEX/GPPG's ShiftReduceParser. You will"- liftIO $ putStrLn "have to either copy this file to bin\\ShiftReduceParser.dll or change the"- liftIO $ putStrLn "reference so that it points to the right location (you can do this from"- liftIO $ putStrLn "within Visual Studio)."- liftIO $ putStrLn "Additionally, the project includes Parser.cs and Scanner.cs. These have not"- liftIO $ putStrLn "been generated yet. You can use the run-gp.bat file to generate them, but"- liftIO $ putStrLn "note that it requires gppg and gplex to be in your PATH."- liftIO $ putStrLn "-----------------------------------------------------------------------------"- liftIO $ putStrLn ""- where- batchfile = unlines [- "@echo off",- "gppg /gplex " ++ namespace ++ ".y > Parser.cs",- "gplex /verbose /out:Scanner.cs " ++ namespace ++ ".l"- ]- sln guid = unlines [- "Microsoft Visual Studio Solution File, Format Version 9.00",- "# Visual Studio 2005",- "Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"" ++ namespace ++ "\", \"" ++ namespace ++ ".csproj\", \"" ++ guid ++ "\"",- "EndProject",- "Global",- " GlobalSection(SolutionConfigurationPlatforms) = preSolution",- " Debug|Any CPU = Debug|Any CPU",- " Release|Any CPU = Release|Any CPU",- " EndGlobalSection",- " GlobalSection(ProjectConfigurationPlatforms) = postSolution",- " " ++ guid ++ ".Debug|Any CPU.ActiveCfg = Debug|Any CPU",- " " ++ guid ++ ".Debug|Any CPU.Build.0 = Debug|Any CPU",- " " ++ guid ++ ".Release|Any CPU.ActiveCfg = Release|Any CPU",- " " ++ guid ++ ".Release|Any CPU.Build.0 = Release|Any CPU",- " EndGlobalSection",- " GlobalSection(SolutionProperties) = preSolution",- " HideSolutionNode = FALSE",- " EndGlobalSection",- "EndGlobal"- ]- csproj guid = unlines [- "<?xml version=\"1.0\" encoding=\"utf-8\"?>",- "<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">",- " <PropertyGroup>",- " <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>",- " <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>",- " <ProductVersion>8.0.50727</ProductVersion>",- " <SchemaVersion>2.0</SchemaVersion>",- " <ProjectGuid>" ++ guid ++ "</ProjectGuid>",- " <OutputType>Library</OutputType>",- " <AppDesignerFolder>Properties</AppDesignerFolder>",- " <RootNamespace>" ++ namespace ++ "</RootNamespace>",- " <AssemblyName>" ++ namespace ++ "</AssemblyName>",- " <StartupObject>",- " </StartupObject>",- " </PropertyGroup>",- " <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">",- " <DebugSymbols>true</DebugSymbols>",- " <DebugType>full</DebugType>",- " <Optimize>false</Optimize>",- " <OutputPath>bin\\Debug\\</OutputPath>",- " <DefineConstants>DEBUG;TRACE</DefineConstants>",- " <ErrorReport>prompt</ErrorReport>",- " <WarningLevel>4</WarningLevel>",- " </PropertyGroup>",- " <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">",- " <DebugType>pdbonly</DebugType>",- " <Optimize>true</Optimize>",- " <OutputPath>bin\\Release\\</OutputPath>",- " <DefineConstants>TRACE</DefineConstants>",- " <ErrorReport>prompt</ErrorReport>",- " <WarningLevel>4</WarningLevel>",- " </PropertyGroup>",- " <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />",- " <!-- To modify your build process, add your task inside one of the targets below and uncomment it. ",- " Other similar extension points exist, see Microsoft.Common.targets.",- " <Target Name=\"BeforeBuild\">",- " </Target>",- " <Target Name=\"AfterBuild\">",- " </Target>",- " -->",- " <ItemGroup>",- " <Compile Include=\"AbstractVisitSkeleton.cs\" />",- " <Compile Include=\"Absyn.cs\" />",- " <Compile Include=\"Parser.cs\" />",- " <Compile Include=\"Printer.cs\" />",- " <Compile Include=\"Scanner.cs\" />",- " <Compile Include=\"Test.cs\" />",- " <Compile Include=\"VisitSkeleton.cs\" />",- " </ItemGroup>",- " <ItemGroup>",- " <Reference Include=\"ShiftReduceParser, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL\">",- " <SpecificVersion>False</SpecificVersion>",- " <HintPath>bin\\ShiftReduceParser.dll</HintPath>",- " </Reference>",- " </ItemGroup>",- " <ItemGroup>",- " <None Include=\"" ++ namespace ++ ".cf\" />",- " <None Include=\"" ++ namespace ++ ".l\" />",- " <None Include=\"" ++ namespace ++ ".y\" />",- " <None Include=\"" ++ namespace ++ ".tex\" />",- " <None Include=\"run-gp.bat\" />",- " </ItemGroup>",- " <PropertyGroup>",- " <PreBuildEvent>",- " </PreBuildEvent>",- " </PropertyGroup>",- "</Project>"- ]--csharptest :: Namespace -> CF -> String-csharptest namespace cf = unlines [- "/*** Compiler Front-End Test automatically generated by the BNF Converter ***/",- "/* */",- "/* This test will parse a file, print the abstract syntax tree, and then */",- "/* pretty-print the result. */",- "/* */",- "/****************************************************************************/",- "using System;",- "using System.IO;",- "using " ++ namespace ++ ".Absyn;",- "",- "namespace " ++ namespace,- "{",- " public class Test",- " {",- " public static void Main(string[] args)",- " {",- " if (args.Length > 0)",- " {",- " Stream stream = File.OpenRead(args[0]);",- " /* The default entry point is used. For other options see class Parser */",- " Parser parser = new Parser();",- " Scanner scanner = Scanner.CreateScanner(stream);",- " // Uncomment to enable trace information:",- " // parser.Trace shows what the parser is doing",- " // parser.Trace = true;",- " // scanner.Trace prints the tokens as they are parsed, one token per line",- " // scanner.Trace = true;",- " parser.scanner = scanner;",- " try",- " {",- " " ++ def ++ " parse_tree = parser.Parse" ++ def ++ "();",- " if (parse_tree != null)",- " {",- " Console.Out.WriteLine(\"Parse Successful!\");",- " Console.Out.WriteLine(\"\");",- " Console.Out.WriteLine(\"[Abstract Syntax]\");",- " Console.Out.WriteLine(\"{0}\", PrettyPrinter.Show(parse_tree));",- " Console.Out.WriteLine(\"\");",- " Console.Out.WriteLine(\"[Linearized Tree]\");",- " Console.Out.WriteLine(\"{0}\", PrettyPrinter.Print(parse_tree));",- " }",- " else",- " {",- " Console.Out.WriteLine(\"Parse NOT Successful!\");",- " }",- " }",- " catch(Exception e)",- " {",- " Console.Out.WriteLine(\"Parse NOT Successful:\");",- " Console.Out.WriteLine(e.Message);",- " Console.Out.WriteLine(\"\");",- " Console.Out.WriteLine(\"Stack Trace:\");",- " Console.Out.WriteLine(e.StackTrace);",- " }",- " }",- " else",- " {",- " Console.Out.WriteLine(\"You must specify a filename!\");",- " }",- " }",- " }",- "}"- ]- where- def = identCat (head (allEntryPoints cf))--projectguid :: MkFiles String-projectguid = do- maybeFilePath <- findDirectory- maybe getBadGUID getGoodGUID maybeFilePath- where- getBadGUID :: MkFiles String- getBadGUID = do- liftIO $ putStrLn "-----------------------------------------------------------------------------"- liftIO $ putStrLn "Could not find Visual Studio tool uuidgen.exe to generate project GUID!"- liftIO $ putStrLn "You might want to put this tool in your PATH."- liftIO $ putStrLn "-----------------------------------------------------------------------------"- return "{00000000-0000-0000-0000-000000000000}"- getGoodGUID :: FilePath -> MkFiles String- getGoodGUID filepath = liftIO $ do- let filepath' = "\"" ++ filepath ++ "\""- (_, hOut, _, _) <- runInteractiveCommand filepath'- guid <- hGetLine hOut- return ('{' : init guid ++ "}")- findDirectory :: MkFiles (Maybe FilePath)- findDirectory = liftIO $ do- -- This works with Visual Studio 2005.- -- We will probably have to be modify this to include another environment variable name for Orcas.- -- I doubt there is any need to support VS2003? (I doubt they have patched it up to have 2.0 support?)- toolpath <- catchIOError (getEnv "VS80COMNTOOLS") (\_ -> return "C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools")- exists <- doesDirectoryExist toolpath- if exists- then return (Just (toolpath ++ "\\uuidgen.exe"))- -- this handles the case when the user was clever enough to add the directory to his/her PATH- else findExecutable "uuidgen.exe"
− src/BNFC/Backend/CSharp/CAbstoCSharpAbs.hs
@@ -1,274 +0,0 @@-{-- BNF Converter: C# Abstract Syntax Generator- Copyright (C) 2006-2007 Author: Johan Broberg-- Modified from CFtoSTLAbs-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates the C# Abstract Syntax- tree classes. It uses the Visitor design- pattern.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 22 November, 2006-- Modified : 21 January, 2007 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp.CAbstoCSharpAbs (cabs2csharpabs) where--import BNFC.Backend.Common.OOAbstract-import BNFC.CF-import BNFC.Utils((+++))-import Data.List-import Data.Maybe-import BNFC.Backend.CSharp.CSharpUtils----The result is one file (.cs)--cabs2csharpabs :: Namespace -> CAbs -> Bool -> String-cabs2csharpabs namespace cabs useWCF = unlinesInline [- "//C# Abstract Syntax Interface generated by the BNF Converter.",- -- imports- "using System;",- if useWCF then "using System.Runtime.Serialization;" else "",- "using System.Collections.Generic;",- "namespace " ++ namespace ++ ".Absyn",- "{",- " #region Token Classes",- prTokenBaseType useWCF,- unlinesInlineMap (prToken namespace useWCF) (tokentypes cabs),- " #endregion",- " ",- " #region Abstract Syntax Classes",- unlinesInlineMap (prAbs namespace useWCF) abstractclasses,- " ",- unlinesInlineMap (prCon namespace useWCF) (flattenSignatures cabs),- " ",- " #region Lists",- unlinesInlineMap (prList namespace) (listtypes cabs),- " #endregion",- " #endregion",- "}"- ]- where- -- an abstract class is a category which does not contain rules- abstractclasses = [ (cat, map fst cabsrules) | (cat, cabsrules) <- signatures cabs, cat `notElem` map fst cabsrules ]---- auxiliaries--prDataContract :: Bool -> [String] -> String-prDataContract False _ = ""-prDataContract True [] = " [DataContract]"-prDataContract True funs = unlinesInline [- prDataContract True [],- unlinesInline $ map prDataContract' funs- ]- where- prDataContract' :: String -> String- prDataContract' fun = " [KnownType(typeof(" ++ fun ++ "))]"--prDataMember :: Bool -> String-prDataMember False = ""-prDataMember True = " [DataMember]"--prTokenBaseType :: Bool -> String-prTokenBaseType useWCF = unlinesInline [- prDataContract useWCF [],- " public class TokenBaseType",- " {",- prDataMember useWCF,- " private string str;",- " ",- " public TokenBaseType(string str)",- " {",- " this.str = str;",- " }",- " ",- " public override string ToString()",- " {",- " return this.str;",- " }",- " }",- " "- ]--prToken :: Namespace -> Bool -> String -> String-prToken namespace useWCF name = unlinesInline [- prDataContract useWCF [],- " public class " ++ name ++ " : " ++ identifier namespace ("TokenBaseType" :: String),- " {",- " public " ++ name ++ "(string str) : base(str)",- " {",- " }",- prAccept namespace name Nothing,- prVisitor namespace [name],- prEquals namespace name ["ToString()"],- prHashCode namespace name ["ToString()"],- " }"- ]--prAbs :: Namespace -> Bool -> (String, [String]) -> String-prAbs namespace useWCF (cat, funs) = unlinesInline [- prDataContract useWCF funs,- " public abstract class " ++ cat,- " {",- " public abstract R Accept<R,A>(" ++ identifier namespace cat ++ ".Visitor<R,A> v, A arg);",- prVisitor namespace funs,- " }"- ]--prVisitor :: Namespace -> [String] -> String-prVisitor namespace funs = unlinesInline- [ " "- , " public interface Visitor<R,A>"- , " {"- , unlinesInline (map prVisitFun funs)- , " }"- ]- where- prVisitFun f = " R Visit(" ++ identifier namespace f ++ " p, A arg);"--prCon :: Namespace -> Bool -> (String,CSharpAbsRule) -> String-prCon namespace useWCF (c,(f,cs)) = unlinesInline [- prDataContract useWCF [],- " public class " ++ f ++ ext,- " {",- -- Instance variables- unlines [prInstVar typ var | (typ,_,var,_) <- cs],- prConstructor namespace (f,cs),- unlinesInline [prProperty typ var prop | (typ,_,var,prop) <- cs],- prEquals namespace f propnames,- prHashCode namespace f propnames,- -- print Accept method, override keyword needed for classes inheriting an abstract class- prAccept namespace c (if isAlsoCategory f c then Nothing else Just " override"),- -- if this label is also a category, we need to print the Visitor interface- -- (if not, it was already printed in the abstract class)- if isAlsoCategory f c then prVisitor namespace [c] else "",- " }"- ]- where- -- This handles the case where a LBNF label is the same as the category.- ext = if isAlsoCategory f c then "" else " : " ++ identifier namespace (identCat $ strToCat c)- propnames = [prop | (_, _, _, prop) <- cs]- prInstVar typ var = unlinesInline [- " private " ++ identifier namespace (typename typ) +++ var ++ ";"- ]- prProperty typ var prop = unlinesInline [- " ",- prDataMember useWCF,- " public " ++ identifier namespace (typename typ) +++ prop,- " {",- " get",- " {",- " return this." ++ var ++ ";",- " }",- " set",- " {",- " this." ++ var ++ " = value;",- " }",- " }"- ]---- Creates the Equals() methods-prEquals :: Namespace -> Fun -> [String] -> String-prEquals namespace c vars = unlinesInline [- " ",- " public override bool Equals(Object obj)",- " {",- " if(this == obj)",- " {",- " return true;",- " }",- " if(obj is " ++ identifier namespace c ++ ")",- " {",- " return this.Equals((" ++ identifier namespace c ++ ")obj);",- " }",- " return base.Equals(obj);",- " }",- " ",- " public bool Equals(" ++ identifier namespace c ++ " obj)",- " {",- " if(this == obj)",- " {",- " return true;",- " }",- " return " ++ prEqualsVars vars ++ ";",- " }"- ]- where- prEqualsVars [] = "true"- prEqualsVars vs = intercalate " && " $ map equalVar vs- equalVar v = "this." ++ v ++ ".Equals(obj." ++ v ++ ")"---- Creates the GetHashCode() method.-prHashCode :: Namespace -> Fun -> [String] -> String-prHashCode _ _ vars = unlinesInline [- " ",- " public override int GetHashCode()",- " {",- " return " ++ prHashVars vars ++ ";",- " }"- ]- where- aPrime = 37- prHashVars [] = show aPrime- prHashVars (v:vs) =- foldl (\ r v -> show aPrime ++ "*" ++ "(" ++ r ++ ")+" ++ hashVar v) v vs- hashVar var = "this." ++ var ++ ".GetHashCode()"--prList :: Namespace -> (String,Bool) -> String-prList namespace (c,_) = unlinesInline [- " public class " ++ c ++ " : List<" ++ identifier namespace (typename bas) ++ ">",- " {",- " }"- ]- where- bas = drop 4 c -- drop List---- The standard Accept method for the Visitor pattern-prAccept :: Namespace -> String -> Maybe String -> String-prAccept namespace cat maybeOverride = unlinesInline [- " ",- " public" ++ fromMaybe "" maybeOverride ++ " R Accept<R,A>(" ++ identifier namespace cat ++ ".Visitor<R,A> visitor, A arg)",- " {",- " return visitor.Visit(this, arg);",- " }"- ]---- The constructor assigns the parameters to the corresponding instance variables.-prConstructor :: Namespace -> CSharpAbsRule -> String-prConstructor namespace (f,cs) = unlinesInline [- " public " ++ f ++ "(" ++ conargs ++ ")",- " {",- unlinesInline [" " ++ c ++ " = " ++ p ++ ";" | (c,p) <- zip cvs pvs],- " }"- ]- where- cvs = [c | (_,_,c,_) <- cs]- pvs = ["p" ++ show i | ((_,_,_,_),i) <- zip cs [1..]]- conargs = intercalate ", "- [identifier namespace (typename x) +++ v | ((x,_,_,_),v) <- zip cs pvs]
− src/BNFC/Backend/CSharp/CAbstoCSharpAbstractVisitSkeleton.hs
@@ -1,94 +0,0 @@-{-- BNF Converter: C# Abstract Visit Skeleton Generator-- Copyright (C) 2006 Author: Johan Broberg-- Modified from BNFC.Backend.CSharp.CAbstoCSharpVisitSkeleton-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates an Abstract Visit Skeleton for C#.- This can be useful if you often make changes to your- grammar and want to keep your own changes (not having to- merge with the new visit skeleton each time), while still- getting compile errors if your code is no longer correct.- The generated file uses the Visitor design pattern.-- This could have been generated from within- CAbstoVisitSkeleton, but that would have made it more- difficult to actually use it (and the visit skeleton).-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 19 December, 2006-- Modified : 19 December, 2006 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp.CAbstoCSharpAbstractVisitSkeleton (cabs2csharpAbstractVisitSkeleton) where--import BNFC.CF-import BNFC.Utils ((+++))-import BNFC.Backend.Common.OOAbstract hiding (basetypes)-import BNFC.Backend.CSharp.CSharpUtils----Produces .cs file-cabs2csharpAbstractVisitSkeleton :: Namespace -> CAbs -> String-cabs2csharpAbstractVisitSkeleton namespace cabs = unlines [- "/*** BNFC-Generated Abstract Visitor Design Pattern Skeleton. ***/",- "/* This implements the common visitor design pattern.",- " Replace the R and A parameters with the desired return",- " and context types.*/",- "",- "namespace " ++ namespace ++ ".VisitSkeleton",- "{",- " #region Classes",- unlinesInlineMap (prCon namespace) (signatures cabs),- " #endregion",- " ",- " #region Token types",- unlinesInlineMap (prBasic namespace) (tokentypes cabs),- " #endregion",- "}"- ]--prBasic namespace c = unlinesInline [- " public abstract class Abstract" ++ c ++ "Visitor<R,A> : " ++ identifier namespace c ++ ".Visitor<R,A>",- " {",- " public abstract R Visit(" ++ identifier namespace (typename c) +++ varname c ++ ", A arg);",- " }"- ]--prCon :: Namespace -> (String, [CAbsRule]) -> String-prCon namespace (c,fs) = unlinesInline [- " public abstract class Abstract" ++ c ++ "Visitor<R,A> : " ++ identifier namespace c ++ ".Visitor<R,A>",- " {",- unlinesInlineMap (prVisit namespace) fs,- " }"- ]--prVisit :: Namespace -> (Fun, [(String, Bool, String)]) -> String-prVisit namespace (f,_) = unlinesInline [- " public abstract R Visit(" ++ identifier namespace f +++ varname f ++ ", A arg);"- ]
− src/BNFC/Backend/CSharp/CAbstoCSharpVisitSkeleton.hs
@@ -1,115 +0,0 @@-{-- BNF Converter: C# Visit Skeleton Generator-- Copyright (C) 2006 Author: Johan Broberg-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates the C# Visit Skeleton.- The generated file uses the Visitor design pattern.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 30 November, 2006-- Modified : 21 January, 2007 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp.CAbstoCSharpVisitSkeleton (cabs2csharpvisitskeleton) where--import BNFC.Utils ((+++))-import Data.List-import BNFC.Backend.Common.OOAbstract hiding (basetypes)-import BNFC.Backend.CSharp.CSharpUtils----Produces .cs file-cabs2csharpvisitskeleton :: Namespace -> CAbs -> String-cabs2csharpvisitskeleton namespace cabs = unlines [- "/*** BNFC-Generated Visitor Design Pattern Skeleton. ***/",- "/* This implements the common visitor design pattern. To make sure that",- " compile errors occur when code in the Visitor don't match the abstract",- " syntaxt, the \"abstract visit skeleton\" is used.",- " ",- " Replace the R and A parameters with the desired return",- " and context types.*/",- "",- "namespace " ++ namespace ++ ".VisitSkeleton",- "{",- " #region Classes",- unlinesInlineMap (prCon namespace) (signatures cabs),- " #endregion",- " ",- " #region Token types",- unlinesInlineMap (prBasic namespace) (tokentypes cabs),- " #endregion",- "}"- ]--prBasic namespace c = unlinesInline [- " public class " ++ c ++ "Visitor<R,A> : Abstract" ++ c ++ "Visitor<R,A>",- " {",- " public override R Visit(" ++ identifier namespace (typename c) +++ varname c ++ ", A arg)",- " {",- " /* Code for " ++ c ++ " Goes Here */",- " return default(R);",- " }",- " }"- ]--prCon :: Namespace -> (String, [CAbsRule]) -> String-prCon namespace (c,fs) = unlinesInline [- " public class " ++ c ++ "Visitor<R,A> : Abstract" ++ c ++ "Visitor<R,A>",- " {",- unlinesInlineMap (prVisit namespace) (map cabsrule2csharpabsrule fs),- " }"- ]---prVisit :: Namespace -> CSharpAbsRule -> String-prVisit namespace (f,cs) = unlinesInline [- " public override R Visit(" ++ identifier namespace f +++ varname f ++ ", A arg)",- " {",- " /* Code For " ++ f ++ " Goes Here */",- unlinesInline $ map (prVisitArg namespace (varname f)) cs,- " return default(R);",- " }"- ]--prVisitArg :: Namespace -> String -> (String, Bool, VariableName, PropertyName) -> String-prVisitArg namespace vname (cat, _, var, prop)- | cat `elem` (map fst basetypes) = " // " ++ vname ++ "." ++ prop- -- var /= "list_" is a dummy fix to make sure that a category named "List" doesn't get interpreted as a List.- -- this isn't very good though, and should be fixed somehow.- | "list" `isPrefixOf` var && var /= "list_" = listAccept- | otherwise = " " ++ vname ++ "." ++ prop ++ ".Accept(new " ++ cat ++ "Visitor<R,A>(), arg);"- where- listtype = typename (drop 4 cat)- listAccept = unlinesInline [- " foreach(" ++ identifier namespace listtype ++ " x in " ++ vname ++ "." ++ prop ++ ")",- " {",- if listtype `notElem` (map snd basetypes)- then " x.Accept(new " ++ listtype ++ "Visitor<R,A>(), arg);"- else " // x",- " }"- ]
− src/BNFC/Backend/CSharp/CFtoCSharpPrinter.hs
@@ -1,452 +0,0 @@-{-- BNF Converter: C# Pretty Printer Generator- Copyright (C) 2006 Author: Johan Broberg-- Modified from CFtoSTLPrinter-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates the C# Pretty Printer.- It also generates the "show" method for- printing an abstract syntax tree.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 26 November, 2006-- Modified : 21 January, 2007 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp.CFtoCSharpPrinter (cf2csharpprinter) where--import BNFC.CF-import BNFC.Utils ((+++))-import BNFC.Backend.Common.NamedVariables-import Data.List-import Data.Char(toLower)-import Data.Maybe-import BNFC.Backend.CSharp.CSharpUtils----Produces .cs file-cf2csharpprinter :: Namespace -> CF -> String-cf2csharpprinter namespace cf = unlinesInline [- header namespace cf,- " ",- entrypoints namespace cf,- " ",- " #region (Internal) Print Methods",- unlinesInlineMap (prData namespace user) groups,- " #endregion",- " ",- " #region (Internal) Show Methods",- unlinesInlineMap (shData namespace user) groups,- " #endregion",- " }",- " #endregion",- "}"- ]- where- groups = fixCoercions (ruleGroupsInternals cf)- user = [n | (n,_) <- tokenPragmas cf]--header :: Namespace -> CF -> String-header namespace cf = unlinesInline [- "/*** BNFC-Generated Pretty Printer and Abstract Syntax Viewer ***/",- " ",- -- imports- "using System;",- "using System.Text; // for StringBuilder",- "using " ++ namespace ++ ".Absyn;",- " ",- "namespace " ++ namespace,- "{",- " #region Pretty-printer class",- " public class PrettyPrinter",- " {",- " #region Misc rendering functions",- " // You may wish to change these:",- " private const int BUFFER_INITIAL_CAPACITY = 2000;",- " private const int INDENT_WIDTH = 2;",- " private const string LEFT_PARENTHESIS = \"(\";",- " private const string RIGHT_PARENTHESIS = \")\";",- " private static System.Globalization.NumberFormatInfo InvariantFormatInfo = System.Globalization.NumberFormatInfo.InvariantInfo;",- " ",- " private static int _n_ = 0;",- " private static StringBuilder buffer = new StringBuilder(BUFFER_INITIAL_CAPACITY);",- " ",- " //You may wish to change render",- " private static void Render(String s)",- " {",- " if(s == \"{\")",- " {",- " buffer.Append(\"\\n\");",- " Indent();",- " buffer.Append(s);",- " _n_ = _n_ + INDENT_WIDTH;",- " buffer.Append(\"\\n\");",- " Indent();",- " }",- " else if(s == \"(\" || s == \"[\")",- " buffer.Append(s);",- " else if(s == \")\" || s == \"]\")",- " {",- " Backup();",- " buffer.Append(s);",- " buffer.Append(\" \");",- " }",- " else if(s == \"}\")",- " {",- " int t;",- " _n_ = _n_ - INDENT_WIDTH;",- " for(t=0; t<INDENT_WIDTH; t++) {",- " Backup();",- " }",- " buffer.Append(s);",- " buffer.Append(\"\\n\");",- " Indent();",- " }",- " else if(s == \",\")",- " {",- " Backup();",- " buffer.Append(s);",- " buffer.Append(\" \");",- " }",- " else if(s == \";\")",- " {",- " Backup();",- " buffer.Append(s);",- " buffer.Append(\"\\n\");",- " Indent();",- " }",- " else if(s == \"\") return;",- " else",- " {",- " // Make sure escaped characters are printed properly!",- " if(s.StartsWith(\"\\\"\") && s.EndsWith(\"\\\"\"))",- " {",- " buffer.Append('\"');",- " StringBuilder sb = new StringBuilder(s);",- " // Remove enclosing citation marks",- " sb.Remove(0,1);",- " sb.Remove(sb.Length-1,1);",- " // Note: we have to replace backslashes first! (otherwise it will \"double-escape\" the other escapes)",- " sb.Replace(\"\\\\\", \"\\\\\\\\\");",- " sb.Replace(\"\\n\", \"\\\\n\");",- " sb.Replace(\"\\t\", \"\\\\t\");",- " sb.Replace(\"\\\"\", \"\\\\\\\"\");",- " buffer.Append(sb.ToString());",- " buffer.Append('\"');",- " }",- " else",- " {",- " buffer.Append(s);",- " }",- " buffer.Append(\" \");",- " }",- " }",- " ",- " private static void PrintInternal(int n, int _i_)",- " {",- " buffer.Append(n.ToString(InvariantFormatInfo));",- " buffer.Append(' ');",- " }",- " ",- " private static void PrintInternal(double d, int _i_)",- " {",- " buffer.Append(d.ToString(InvariantFormatInfo));",- " buffer.Append(' ');",- " }",- " ",- " private static void PrintInternal(string s, int _i_)",- " {",- " Render(s);",- " }",- " ",- " private static void PrintInternal(char c, int _i_)",- " {",- " PrintQuoted(c);",- " }",- " ",- unlinesInlineMap (prToken namespace) (tokenNames cf),- " ",- " private static void ShowInternal(int n)",- " {",- " Render(n.ToString(InvariantFormatInfo));",- " }",- " ",- " private static void ShowInternal(double d)",- " {",- " Render(d.ToString(InvariantFormatInfo));",- " }",- " ",- " private static void ShowInternal(char c)",- " {",- " PrintQuoted(c);",- " }",- " ",- " private static void ShowInternal(string s)",- " {",- " PrintQuoted(s);",- " }",- " ",- unlinesInlineMap (shToken namespace) (tokenNames cf),- " ",- " private static void PrintQuoted(string s)",- " {",- " Render(\"\\\"\" + s + \"\\\"\");",- " }",- " ",- " private static void PrintQuoted(char c)",- " {",- " // Makes sure the character is escaped properly before printing it.",- " string str = c.ToString();",- " if(c == '\\n') str = \"\\\\n\";",- " if(c == '\\t') str = \"\\\\t\";",- " Render(\"'\" + str + \"'\");",- " }",- " ",- " private static void Indent()",- " {",- " int n = _n_;",- " while (n > 0)",- " {",- " buffer.Append(' ');",- " n--;",- " }",- " }",- " ",- " private static void Backup()",- " {",- " if(buffer[buffer.Length - 1] == ' ')",- " {",- " buffer.Length = buffer.Length - 1;",- " }",- " }",- " ",- " private static void Trim()",- " {",- " while(buffer.Length > 0 && buffer[0] == ' ')",- " buffer.Remove(0, 1); ",- " while(buffer.Length > 0 && buffer[buffer.Length-1] == ' ')",- " buffer.Remove(buffer.Length-1, 1);",- " }",- " ",- " private static string GetAndReset()",- " {",- " Trim();",- " string strReturn = buffer.ToString();",- " Reset();",- " return strReturn;",- " }",- " ",- " private static void Reset()",- " {",- " buffer.Remove(0, buffer.Length);",- " }",- " #endregion"- ]--prToken :: Namespace -> String -> String-prToken namespace token = unlinesInline [- " private static void PrintInternal(" ++ identifier namespace token ++ " token, int _i_)",- " {",- " buffer.Append('\\\"');",- " buffer.Append(token.ToString());",- " buffer.Append('\\\"');",- " }"- ]--shToken :: Namespace -> String -> String-shToken namespace token = unlinesInline [- " private static void ShowInternal(" ++ identifier namespace token ++ " token)",- " {",- " Render(token.ToString());",- " }"- ]--entrypoints :: Namespace -> CF -> String-entrypoints namespace cf = unlinesInline [- " #region Print Entry Points",- unlinesInlineMap prEntryPoint (reallyAllCats cf),- " #endregion",- " ",- " #region Show Entry Points",- unlinesInlineMap shEntryPoint (reallyAllCats cf),- " #endregion"- ]- where- prEntryPoint cat | (normCat cat) == cat = unlinesInline [- " public static string Print(" ++ identifier namespace (identCat cat) ++ " cat)",- " {",- " PrintInternal(cat, 0);",- " return GetAndReset();",- " }"- ]- prEntryPoint _ = ""- shEntryPoint cat | (normCat cat) == cat = unlinesInline [- " public static String Show(" ++ identifier namespace (identCat cat) ++ " cat)",- " {",- " ShowInternal(cat);",- " return GetAndReset();",- " }"- ]- shEntryPoint _ = ""--prData :: Namespace -> [UserDef] -> (Cat, [Rule]) -> String-prData namespace user (cat, rules)- -- list- | isList cat = unlinesInline [- " private static void PrintInternal(" ++ identifier namespace (identCat (normCat cat)) ++ " p, int _i_)",- " {",- (prList user cat rules),- " }"- ]- -- not a list- | otherwise = unlinesInline [- " private static void PrintInternal(" ++ identifier namespace (identCat (normCat cat)) ++ " p, int _i_)",- " {",- -- first rule starts with "if", the rest of them start with "else if".- -- this isn't very pretty, but does the job and produces nice code.- prRule namespace Nothing firstRule,- unlinesInline $ map (prRule namespace (Just "else ")) otherRules,- " }"- ]- where- -- Removes the rules at the beginning of the list which won't be used by the prRule function.- rules' = dropWhile (\r -> isCoercion (funRule r) || isDefinedRule (funRule r)) rules- firstRule = head rules'- otherRules = tail rules'--prRule :: Namespace -> Maybe String -> Rule -> String-prRule namespace maybeElse r@(Rule fun _c cats _)- | not (isCoercion fun || isDefinedRule fun) = unlinesInline [- " " ++ fromMaybe "" maybeElse ++ "if(p is " ++ identifier namespace fun ++ ")",- " {",- " " ++ identifier namespace fun +++ fnm ++ " = (" ++ identifier namespace fun ++ ")p;",- " if(_i_ > " ++ (show p) ++ ") Render(LEFT_PARENTHESIS);",- cats',- " if(_i_ > " ++ (show p) ++ ") Render(RIGHT_PARENTHESIS);",- " }"- ]- where- p = precRule r- cats' = case cats of- [] -> ""- _ -> unlinesInline $ map (prCat fnm) (zip (fixOnes (numProps [] cats)) (map getPrec cats))- fnm = '_' : map toLower (funName fun)-- getPrec (Right {}) = 0- getPrec (Left c) = precCat c-prRule _nm _ _ = ""--prList :: [UserDef] -> Cat -> [Rule] -> String-prList _ _ rules = unlinesInline [- " for(int i=0; i < p.Count; i++)",- " {",- " PrintInternal(p[i], 0);",- " if(i < p.Count - 1)",- " {",- " Render(\"" ++ escapeChars sep ++ "\");",- " }",- " else",- " {",- " Render(\"" ++ optsep ++ "\");",- " }",- " }"- ]- where- sep = getCons rules- optsep = if hasOneFunc rules then "" else escapeChars sep--prCat fnm (c, p) =- case c of- Right t -> " Render(\"" ++ escapeChars t ++ "\");"- Left nt- | "string" `isPrefixOf` nt -> " PrintQuoted(" ++ fnm ++ "." ++ nt ++ ");"- | otherwise -> " PrintInternal(" ++ fnm ++ "." ++ nt ++ ", " ++ show p ++ ");"-----The following methods generate the Show function.--shData :: Namespace -> [UserDef] -> (Cat, [Rule]) -> String-shData namespace user (cat, rules)- | isList cat = unlinesInline [- " private static void ShowInternal(" ++ identifier namespace (identCat (normCat cat)) ++ " p)",- " {",- (shList user cat rules),- " }"- ]- | otherwise = unlinesInline [- " private static void ShowInternal(" ++ identifier namespace (identCat (normCat cat)) ++ " p)",- " {",- unlinesInline $ map (shRule namespace) rules,- " }"- ]--shRule :: Namespace -> Rule -> String-shRule namespace (Rule f _c cats _)- | not (isCoercion fun || isDefinedRule fun) = unlinesInline [- " if(p is " ++ identifier namespace fun ++ ")",- " {",- " " ++ identifier namespace fun +++ fnm ++ " = (" ++ identifier namespace fun ++ ")p;",- lparen,- " Render(\"" ++ (escapeChars fun) ++ "\");",- cats',- rparen,- " }"- ]- where- fun = funName f- cats' | allTerms cats = ""- | otherwise = unlinesInline $ map (shCat fnm) (fixOnes (numProps [] cats))- lparen | allTerms cats = ""- | otherwise = " Render(\"(\");"- rparen | allTerms cats = ""- | otherwise = " Render(\")\");"- allTerms [] = True- allTerms ((Left {}):_) = False- allTerms (_:zs) = allTerms zs- fnm = '_' : map toLower (funName fun)-shRule _nm _ = ""--shList :: [UserDef] -> Cat -> [Rule] -> String-shList _ _ _rules = unlinesInline [- " for(int i=0; i < p.Count; i++)",- " {",- " ShowInternal(p[i]);",- " if(i < p.Count - 1)",- " Render(\",\");",- " }"- ]--shCat fnm c =- case c of- Right {} -> ""- Left nt- | "list" `isPrefixOf` nt -> unlinesInline [- " Render(\"[\");",- " ShowInternal(" ++ fnm ++ "." ++ nt ++ ");",- " Render(\"]\");"- ]- | otherwise -> " ShowInternal(" ++ fnm ++ "." ++ nt ++ ");"
− src/BNFC/Backend/CSharp/CFtoGPLEX.hs
@@ -1,225 +0,0 @@-{-- BNF Converter: C# GPLEX Generator- Copyright (C) 2006 Author: Johan Broberg-- Modified from CFtoFlex-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates the GPLEX file.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 23 November, 2006-- Modified : 17 December, 2006 by Johan Broberg-- **************************************************************--}--{-# LANGUAGE TupleSections #-}--module BNFC.Backend.CSharp.CFtoGPLEX (cf2gplex) where--import Data.Bifunctor (first)-import Data.List-import Data.Maybe-import qualified Data.Map as Map--import BNFC.CF-import BNFC.Backend.CSharp.RegToGPLEX-import BNFC.Backend.Common.NamedVariables-import BNFC.Backend.CSharp.CSharpUtils----The environment must be returned for the parser to use.-cf2gplex :: Namespace -> CF -> (String, SymMap)-cf2gplex namespace cf = (,env) $ unlines [- prelude namespace,- cMacros,- prettyprinter $ (lexSymbols env0) ++ (gplex namespace cf env),- "%%"- ]- where- env = Map.fromList env1- env0 = makeSymMap (cfgSymbols cf ++ reservedWords cf) (0 :: Int)- env1 = map (first Keyword) env0 ++ makeSymMap (map Tokentype $ tokenNames cf) (length env0)- -- GPPG doesn't seem to like tokens beginning with an underscore, so they (the underscores, nothing else) have been removed.- makeSymMap [] _ = []- makeSymMap (s:symbs) n = (s, "SYMB_" ++ (show n)) : (makeSymMap symbs (n+1))--prelude :: Namespace -> String-prelude namespace = unlines [- "/* This GPLex file was machine-generated by the BNF converter */",- "",- "%namespace " ++ namespace,- "",- "%{",- " /// <summary>",- " /// Buffer for escaped characters in strings.",- " /// </summary>",- " private System.Text.StringBuilder strBuffer = new System.Text.StringBuilder();",- "",- " /// <summary>",- " /// Change to enable output - useful for debugging purposes",- " /// </summary>",- " public bool Trace = false;",- "",- " /// <summary>",- " /// Culture-independent IFormatProvider for numbers. ",- " /// This is just a \"wrapper\" for System.Globalization.NumberFormatInfo.InvariantInfo.",- " /// </summary>",- " /// <remarks>",- " /// This should be used when parsing numbers. Otherwise the parser might fail: ",- " /// culture en-US uses a dot as decimal separator, while for example sv-SE uses a comma. ",- " /// BNFC uses dot as decimal separator for Double values, so if your culture is sv-SE ",- " /// the parse will fail if this InvariantInfo isn't used.",- " /// </remarks>",- " private static System.Globalization.NumberFormatInfo InvariantFormatInfo = System.Globalization.NumberFormatInfo.InvariantInfo;",- "",- " /// <summary>",- " /// Convenience method to create scanner AND initialize it correctly.",- " /// As long as you don't want to enable trace output, this is all you ",- " /// need to call and give to the parser to be able to parse.",- " /// </summary>",- " public static Scanner CreateScanner(Stream stream)",- " {",- " Scanner scanner = new Scanner(stream);",- " scanner.Begin();",- " return scanner;",- " }",- "",- " /// <summary>",- " /// Sets the scanner to the correct initial state (YYINITIAL). ",- " /// You should call this method prior to calling parser.Parse().",- " /// </summary>",- " public void Begin()",- " {",- " BEGIN(YYINITIAL);",- " }",- "",- " /// <summary>",- " /// Convenience method to \"reset\" the buffer for escaped characters in strings.",- " /// </summary>",- " private void BufferReset()",- " {",- " this.strBuffer = new System.Text.StringBuilder();",- " }",- "",- "%}",- ""- ]----For now all categories are included.---Optimally only the ones that are used should be generated.-cMacros :: String-cMacros = unlines- [- "alpha [a-zA-Z]",- "alphaCapital [A-Z]",- "alphaSmall [a-z]",- "digit [0-9]",- "ident [a-zA-Z0-9'_]",- -- start states, must be defined one at a time- "%s YYINITIAL",- "%s COMMENT",- "%s CHAR",- "%s CHARESC",- "%s CHAREND",- "%s STRING",- "%s ESCAPED",- "%%"- ]--lexSymbols :: SymEnv -> [(String, String)]-lexSymbols ss = map transSym ss- where- transSym (s,r) =- ("<YYINITIAL>\"" ++ s' ++ "\"" , "if(Trace) System.Console.Error.WriteLine(yytext); return (int)Tokens." ++ r ++ ";")- where- s' = escapeChars s--gplex :: Namespace -> CF -> SymMap -> [(String, String)]-gplex namespace cf env = concat [- lexComments (comments cf),- userDefTokens,- ifC catString strStates,- ifC catChar charStates,- ifC catDouble [("<YYINITIAL>{digit}+\".\"{digit}+(\"e\"(\\-)?{digit}+)?" , "if(Trace) System.Console.Error.WriteLine(yytext); yylval.double_ = Double.Parse(yytext, InvariantFormatInfo); return (int)Tokens.DOUBLE_;")],- ifC catInteger [("<YYINITIAL>{digit}+" , "if(Trace) System.Console.Error.WriteLine(yytext); yylval.int_ = Int32.Parse(yytext, InvariantFormatInfo); return (int)Tokens.INTEGER_;")],- ifC catIdent [("<YYINITIAL>{alpha}{ident}*" , "if(Trace) System.Console.Error.WriteLine(yytext); yylval.string_ = yytext; return (int)Tokens.IDENT_;")],- [("<YYINITIAL>[ \\t\\r\\n\\f]" , "/* ignore white space. */;")],- [("<YYINITIAL>." , "return (int)Tokens.error;")]- ]- where- ifC cat s = if isUsedCat cf (TokenCat cat) then s else []- userDefTokens = map tokenline (tokenPragmas cf)- where- tokenline (name, exp) = ("<YYINITIAL>" ++ printRegGPLEX exp , action name)- action n = "if(Trace) System.Console.Error.WriteLine(yytext); yylval." ++ varName n ++ " = new " ++ identifier namespace n ++ "(yytext); return (int)Tokens." ++ sName n ++ ";"- sName n = fromMaybe n $ Map.lookup (Tokentype n) env- -- These handle escaped characters in Strings.- strStates = [- ("<YYINITIAL>\"\\\"\"" , "BEGIN(STRING);"),- ("<STRING>\\\\" , "BEGIN(ESCAPED);"),- ("<STRING>\\\"" , "yylval.string_ = this.strBuffer.ToString(); BufferReset(); BEGIN(YYINITIAL); return (int)Tokens.STRING_;"),- ("<STRING>." , "this.strBuffer.Append(yytext);"),- ("<ESCAPED>n" , "this.strBuffer.Append(\"\\n\"); BEGIN(STRING);"),- ("<ESCAPED>\\\"" , "this.strBuffer.Append(\"\\\"\"); BEGIN(STRING);"),- ("<ESCAPED>\\\\" , "this.strBuffer.Append(\"\\\\\"); BEGIN(STRING);"),- ("<ESCAPED>t" , "this.strBuffer.Append(\"\\t\"); BEGIN(STRING);"),- ("<ESCAPED>." , "this.strBuffer.Append(yytext); BEGIN(STRING);")- ]- -- These handle escaped characters in Chars.- charStates = [- ("<YYINITIAL>\"'\"" , "BEGIN(CHAR);"),- ("<CHAR>\\\\" , "BEGIN(CHARESC);"),- ("<CHAR>[^']" , "BEGIN(CHAREND); yylval.char_ = yytext[0]; return (int)Tokens.CHAR_;"),- ("<CHARESC>n" , "BEGIN(CHAREND); yylval.char_ = '\\n'; return (int)Tokens.CHAR_;"),- ("<CHARESC>t" , "BEGIN(CHAREND); yylval.char_ = '\\t'; return (int)Tokens.CHAR_;"),- ("<CHARESC>." , "BEGIN(CHAREND); yylval.char_ = yytext[0]; return (int)Tokens.CHAR_;"),- ("<CHAREND>\"'\"" , "BEGIN(YYINITIAL);")- ]--lexComments :: ([(String, String)], [String]) -> [(String, String)]-lexComments (m,s) = (map lexSingleComment s) ++ (concatMap lexMultiComment m)--lexSingleComment :: String -> (String, String)-lexSingleComment c =- ("<YYINITIAL>\"" ++ c ++ "\"[^\\n]*\\n" , "/* BNFC single-line comment */;")----There might be a possible bug here if a language includes 2 multi-line comments.---They could possibly start a comment with one character and end it with another.---However this seems rare.-lexMultiComment :: (String, String) -> [(String, String)]-lexMultiComment (b,e) = [- ("<YYINITIAL>\"" ++ b ++ "\"" , "BEGIN(COMMENT);"),- ("<COMMENT>\"" ++ e ++ "\"" , "BEGIN(YYINITIAL);"),- ("<COMMENT>." , "/* BNFC multi-line comment */;"),- ("<COMMENT>[\\n]" , "/* BNFC multi-line comment */;")- ]---- Used to print the lexer rules; makes sure that all rules are equally indented, to make the GPLEX file a little more readable.-prettyprinter :: [(String, String)] -> String-prettyprinter xs = unlines $ map prettyprinter' xs- where- padlength = 1 + (last $ sort $ map length $ map fst xs)- prettyprinter' (x, y) = x ++ replicate (padlength - length x) ' ' ++ y
− src/BNFC/Backend/CSharp/CFtoGPPG.hs
@@ -1,285 +0,0 @@-{-- BNF Converter: C# GPPG Generator- Copyright (C) 2006 Author: Johan Broberg-- Modified from CFtoBisonSTL.-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module generates the GPPG input file.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 24 November, 2006-- Modified : 17 December, 2006 by Johan Broberg-- **************************************************************--}--{-# LANGUAGE PatternGuards #-}--module BNFC.Backend.CSharp.CFtoGPPG (cf2gppg) where--import Data.Char (toLower)-import Data.List (intersperse)-import Data.Maybe (fromMaybe)-import qualified Data.Map as Map--import BNFC.CF-import BNFC.Backend.Common.NamedVariables hiding (varName)-import BNFC.Backend.Common.OOAbstract hiding (basetypes)-import BNFC.Backend.CSharp.CSharpUtils-import BNFC.TypeChecker-import BNFC.Utils ((+++))----This follows the basic structure of CFtoHappy.---- Type declarations-type Rules = [OneRule]-type OneRule = (NonTerminal, [(Pattern, Action)])-type Pattern = String-type Action = String-type MetaVar = String----The environment comes from the CFtoGPLEX-cf2gppg :: Namespace -> CF -> SymMap -> String-cf2gppg namespace cf env = unlines $- [ header namespace cf- , union namespace $ concat $- [ positionCats cf- , allParserCats cf- , map strToCat $ tokentypes $ cf2cabs cf- ]- , tokens (map fst $ tokenPragmas cf) env- , declarations cf- , ""- , specialToks cf- , ""- , "%%"- , prRules $ rulesForGPPG namespace cf env- ]--positionCats :: CF -> [Cat]-positionCats cf = map TokenCat $ filter (isPositionCat cf) $ map fst $ tokenPragmas cf--header :: Namespace -> CF -> String-header namespace cf = unlines [- "/* This GPPG file was machine-generated by BNFC */",- "",- "%namespace " ++ namespace,- "%{",- definedRules namespace cf,- unlinesInline $ map (parseMethod namespace) (allParserCatsNorm cf ++ positionCats cf),- "%}"- ]--definedRules :: Namespace -> CF -> String-definedRules _ cf = unlinesInline [- if null [ rule f xs e | FunDef f xs e <- cfgPragmas cf ]- then ""- else error "Defined rules are not yet available in C# mode!"- ]- where- ctx = buildContext cf-- list = LC (const "[]") (\ t -> "List" ++ unBase t)- where- unBase (ListT t) = unBase t- unBase (BaseT x) = show$normCat$strToCat x-- rule f xs e =- case runTypeChecker $ checkDefinition' list ctx f xs e of- Left err -> error $ "Panic! This should have been caught already:\n" ++ err- Right (_,(_,_)) -> unlinesInline [- "Defined Rule goes here"- ]----This generates a parser method for each entry point.-parseMethod :: Namespace -> Cat -> String-parseMethod namespace cat = unlinesInline [- " " ++ returntype +++ returnvar ++ " = null;",- " public " ++ returntype ++ " Parse" ++ cat' ++ "()",- " {",- " if(this.Parse())",- " {",- " return " ++ returnvar ++ ";",- " }",- " else",- " {",- " throw new Exception(\"Could not parse input stream!\");",- " }",- " }",- " "- ]- where- cat' = identCat (normCat cat)- returntype = identifier namespace cat'- returnvar = resultName cat'----The union declaration is special to GPPG/GPLEX and gives the type of yylval.---For efficiency, we may want to only include used categories here.-union :: Namespace -> [Cat] -> String-union namespace cats = unlines $ filter (\x -> x /= "\n") [- "%union",- "{",- " public int int_;",- " public char char_;",- " public double double_;",- " public string string_;",- unlinesInline $ map catline cats,- "}"- ]- where --This is a little weird because people can make [Exp2] etc.- catline cat | (identCat cat /= show cat) || ((normCat cat) == cat) =- " public " ++ identifier namespace (identCat (normCat cat)) +++ (varName (show$normCat cat)) ++ ";"- catline _ = ""---- | Declares non-terminal types.-declarations :: CF -> String-declarations cf = unlinesInline $ map typeNT $- positionCats cf ++- filter (not . null . rulesForCat cf) (allParserCats cf) -- don't define internal rules- where- typeNT nt = "%type <" ++ varName x ++ "> " ++ x- where x = show $ normCat nt----declares terminal types.-tokens :: [UserDef] -> SymMap -> String-tokens user env = unlines $ map declTok $ Map.toList env- where- declTok (Keyword s, r) = tok "" s r- declTok (Tokentype s, r) = tok (if s `elem` user then "<" ++ varName (show $ normCat $ strToCat s) ++ ">" else "") s r- tok t s r = "%token" ++ t ++ " " ++ r ++ " // " ++ s ++ "\n"--specialToks :: CF -> String-specialToks cf = unlinesInline [- ifC catString "%token<string_> STRING_",- ifC catChar "%token<char_> CHAR_",- ifC catInteger "%token<int_> INTEGER_",- ifC catDouble "%token<double_> DOUBLE_",- ifC catIdent "%token<string_> IDENT_"- ]- where- ifC cat s = if isUsedCat cf (TokenCat cat) then s else ""----The following functions are a (relatively) straightforward translation---of the ones in CFtoHappy.hs-rulesForGPPG :: Namespace -> CF -> SymMap -> Rules-rulesForGPPG namespace cf env = (map mkOne $ ruleGroups cf) ++ posRules where- mkOne (cat,rules) = constructRule namespace cf env rules cat- posRules = map mkPos $ positionCats cf- mkPos :: Cat -> OneRule- mkPos cat = (cat, [(fromMaybe s $ Map.lookup (Tokentype s) env, "$$ = new " ++ s ++ "($1);")])- where s = show cat---- | For every non-terminal, we construct a set of rules.-constructRule :: Namespace ->- CF -> SymMap -> [Rule] -> NonTerminal -> (NonTerminal,[(Pattern,Action)])-constructRule namespace cf env rules nt =- (nt,[(p,(generateAction namespace nt (ruleName r) b m) +++ result) |- r0 <- rules,- let (b,r) = if isConsFun (funRule r0) && elem (valCat r0) revs- then (True,revSepListRule r0)- else (False,r0),- let (p,m) = generatePatterns cf env r b])- where- ruleName r = case funName $ funRule r of- ---- "(:)" -> identCat nt- ---- "(:[])" -> identCat nt- z -> z- revs = cfgReversibleCats cf- eps = allEntryPoints cf- isEntry nt = if elem nt eps then True else False- result = if isEntry nt then (resultName (identCat (normCat nt))) ++ "= $$;" else ""---- Generates a string containing the semantic action.--- This was copied from CFtoCup15, with only a few small modifications-generateAction :: Namespace -> NonTerminal -> Fun -> Bool -> [(MetaVar, Bool)]- -> Action-generateAction namespace nt f rev mbs- | isNilFun f = "$$ = new " ++ identifier namespace c ++ "();"- | isOneFun f = "$$ = new " ++ identifier namespace c ++ "(); $$.Add(" ++ p_1 ++ ");"- | isConsFun f && not rev = "$$ = " ++ p_2 ++ "; " ++ p_2 ++ ".Insert(0, " ++ p_1 ++ ");"- | isConsFun f && rev = "$$ = " ++ p_1 ++ "; " ++ p_1 ++ ".Add(" ++ p_2 ++ ");"- | isCoercion f = "$$ = " ++ p_1 ++ ";"- | isDefinedRule f = "$$ = " ++ f ++ "_" ++ "(" ++ concat (intersperse "," ms) ++ ");"- | otherwise = "$$ = new " ++ identifier namespace c ++ "(" ++ concat (intersperse "," ms) ++ ");"- where- c = if isNilFun f || isOneFun f || isConsFun f- then identCat (normCat nt) else f- ms = map fst mbs- p_1 = ms!!0- p_2 = ms!!1----- Generate patterns and a set of metavariables indicating--- where in the pattern the non-terminal-generatePatterns :: CF -> SymMap -> Rule -> Bool -> (Pattern,[(MetaVar,Bool)])-generatePatterns cf env r _ = case rhsRule r of- [] -> ("/* empty */",[])- its -> (unwords (map mkIt its), metas its)- where- mkIt = \case- Left c- | TokenCat tok <- c, isPositionCat cf tok -> fallback- | show c `elem` map fst basetypes -> fallback- | otherwise -> fromMaybe fallback $ Map.lookup (Tokentype $ show c) env- -- This used to be x, but that didn't work if we had a symbol "String" in env, and tried to use a normal String - it would use the symbol... _ -> fallback- where fallback = typeName (identCat c)- Right s -> fromMaybe s $ Map.lookup (Keyword s) env- metas its = [('$': show i,revert c) | (i,Left c) <- zip [1 :: Int ..] its]-- -- notice: reversibility with push_back vectors is the opposite- -- of right-recursive lists!- revert c = (isList c) &&- not (isConsFun (funRule r)) && notElem c revs- revs = cfgReversibleCats cf---- We have now constructed the patterns and actions,--- so the only thing left is to merge them into one string.--prRules :: Rules -> String-prRules [] = []-prRules ((_, []):rs) = prRules rs --internal rule-prRules ((nt,(p,a):ls):rs) =- (unwords [nt', ":" , p, "{ ", a, "}", "\n" ++ pr ls]) ++ ";\n" ++ prRules rs- where- nt' = identCat nt- pr [] = []- pr ((p,a):ls) = (unlines [(concat $ intersperse " " [" |", p, "{ ", a , "}"])]) ++ pr ls----Some helper functions.-resultName :: String -> String-resultName s = "YY_RESULT_" ++ s ++ "_"----slightly stronger than the NamedVariable version.-varName :: String -> String-varName s = (map toLower (identCat $ strToCat s)) ++ "_"--typeName :: String -> String-typeName "Ident" = "IDENT_"-typeName "String" = "STRING_"-typeName "Char" = "CHAR_"-typeName "Integer" = "INTEGER_"-typeName "Double" = "DOUBLE_"-typeName x = x
− src/BNFC/Backend/CSharp/CSharpUtils.hs
@@ -1,152 +0,0 @@-{-- BNF Converter: Utility Functions for C#- Copyright (C) 2006 Author: Johan Broberg-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module-- Description : This module provides utility functions for the- C# format.-- Author : Johan Broberg (johan@pontemonti.com)-- License : GPL (GNU General Public License)-- Created : 23 November, 2006-- Modified : 21 January, 2007 by Johan Broberg-- **************************************************************--}--module BNFC.Backend.CSharp.CSharpUtils where--import BNFC.CF-import Data.Char (toLower)-import Data.List-import BNFC.Backend.Common.OOAbstract hiding (basetypes)--type Namespace = String----The visit-function name of a basic type-visitFunName :: String -> String-visitFunName v =- if "integer_" `isPrefixOf` v then "Integer"- else if "char_" `isPrefixOf` v then "Char"- else if "string_" `isPrefixOf` v then "String"- else if "double_" `isPrefixOf` v then "Double"- else if "ident_" `isPrefixOf` v then "Ident"- else "Ident" --User-defined type--isUserDefined :: String -> Bool-isUserDefined v = v `notElem` (map classVar (map fst basetypes))--basetypes = [- ("Integer","int"),- ("Char", "char"),- ("Double", "double"),- ("String", "string"),- ("Ident", "string")- ]--typename :: String -> String-typename name- | name == "Char" = "char"- | name == "Double" = "double"- | name == "Ident" = "string"- | name == "Integer" = "int"- | name == "String" = "string"- | otherwise = name---- Creates a variable name.--- To make sure that no reserved keyword is generated, an underscore is added at the end. Not very pretty, but effective.-varname :: String -> String-varname name = (map toLower name) ++ "_"---- Given a variable name (in an abstract syntax class), returns ".ToString()" if the name doesn't match one of the basetypes.-toString :: String -> String-toString v = if isUserDefined v then ".ToString()" else ""---- Prepends namespace ".Absyn." to typ unless it is one of the basetypes-identifier :: IsFun a => Namespace -> a -> String-identifier namespace f- | typ `elem` (map snd basetypes) = typ- | otherwise = namespace ++ ".Absyn." ++ typ- where- typ = funName f---- Removes empty lines, and removes the line-break at the end.--- This can be useful if you want to use unlines "inside" unlines and don't want a whole lot of "useless" line-breaks.-unlinesInline :: [String] -> String-unlinesInline xs = concat $ intersperse "\n" $ filter (\x -> x /= "") xs--unlinesInlineMap :: (a -> String) -> [a] -> String-unlinesInlineMap fun xs = unlinesInline $ intersperse " " $ filter (\x -> x /= "") $ map fun xs----Helper function that escapes characters in strings-escapeChars :: String -> String-escapeChars [] = []-escapeChars ('\\':xs) = '\\' : ('\\' : (escapeChars xs))-escapeChars ('\"':xs) = '\\' : ('\"' : (escapeChars xs))-escapeChars (x:xs) = x : (escapeChars xs)--isAlsoCategory :: Fun -> String -> Bool-isAlsoCategory f c = f == c--flattenSignatures :: CAbs -> [(String, CSharpAbsRule)]-flattenSignatures cabs = [(c,r) | (c,rs) <- signatures cabs, r <- map cabsrule2csharpabsrule rs]--type VariableName = String-type PropertyName = String---- Just like CAbsRule in OOAbstract, except this also has PropertyName.--- (valcat,(constr,args)), True = is class (not basic), class variable stored-type CSharpAbsRule = (Fun,[(String,Bool,VariableName,PropertyName)])--cabsrule2csharpabsrule :: CAbsRule -> CSharpAbsRule-cabsrule2csharpabsrule (f, cabsrule) = (f, addPropertyNames cabsrule)---- This generates names for properties. It's done the same way as generation of variable names in OOAbstract->cf2cabs--- A property name uses the same casing as its category, but has an underscore at the end-addPropertyNames :: [(String, Bool, String)] -> [(String, Bool, VariableName, PropertyName)]-addPropertyNames cs = [(c,b,v,p) | ((c,b,v),p) <- zip cs (properties [] (map propertyName [c | (c,_,_) <- cs]))]- --- creating new names is quadratic, but parameter lists are short- --- this should conform with Michael's naming- where- properties seen vv = case vv of- [] -> vv- v:vs -> case length (filter (==v) seen) of- 0 | elem v vs -> (v ++ "1"): properties (v:seen) vs- 0 -> v : properties (v:seen) vs- n -> (v ++ show (n+1)) : properties (v:seen) vs--propertyName :: String -> PropertyName-propertyName c = c ++ "_"---- Given a rule's definition, it goes through and nicely the properties by type.--- Does the same thing as numVars in NamedVariables, except the varName part-numProps :: [(String, Int)] -> [Either Cat b] -> [Either String b]-numProps _env [] = []-numProps env ((Right f) : fs) = (Right f) : (numProps env fs)-numProps env ((Left f) : fs) =- case lookup f' env of- Nothing -> (Left f') : (numProps ((f',1):env) fs)- Just n -> (Left $ f' ++ (show $ n + 1)) : (numProps ((f',n+1):env) fs)- where- f' = propertyName (identCat (normCat f))
− src/BNFC/Backend/CSharp/RegToGPLEX.hs
@@ -1,73 +0,0 @@-module BNFC.Backend.CSharp.RegToGPLEX (printRegGPLEX) where---- modified from RegToFlex--import AbsBNF-import BNFC.Backend.Common (flexEps)---- the top-level printing method-printRegGPLEX :: Reg -> String-printRegGPLEX = render . prt 0---- you may want to change render and parenth--render :: [String] -> String-render = rend (0::Int) where- rend i ss = case ss of- "[" :ts -> cons "[" $ rend i ts- "(" :ts -> cons "(" $ rend i ts- t : "," :ts -> cons t $ space "," $ rend i ts- t : ")" :ts -> cons t $ cons ")" $ rend i ts- t : "]" :ts -> cons t $ cons "]" $ rend i ts- t :ts -> space t $ rend i ts- _ -> ""- cons s t = s ++ t- space t s = if null s then t else t ++ s--parenth :: [String] -> [String]-parenth ss = ["("] ++ ss ++ [")"]---- the printer class does the job-class Print a where- prt :: Int -> a -> [String]- prtList :: [a] -> [String]- prtList = concat . map (prt 0)--instance Print a => Print [a] where- prt _ = prtList--instance Print Char where- prt _ c = [[c]]- prtList s = map (concat . prt 0) s--prPrec :: Int -> Int -> [String] -> [String]-prPrec i j = if j<i then parenth else id--instance Print Identifier where- prt _ (Identifier (_, i)) = [i]--instance Print Reg where- prt i e = case e of- RSeq reg0 reg -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg])- RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg])- RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg])- RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]])- RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]])- ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]])- REps -> prPrec i 3 [ flexEps ]- RChar c -> prPrec i 3 (prt 0 [mkEsc [c]])- RAlts str -> prPrec i 3 (concat [["["], prt 0 $ mkEsc str, ["]"]])- RSeqs str -> prPrec i 2 (concat (map (prt 0) $ mkEsc str))- RDigit -> prPrec i 3 (concat [["{digit}"]])- RLetter -> prPrec i 3 (concat [["{alpha}"]])- RUpper -> prPrec i 3 (concat [["{alphaCapital}"]])- RLower -> prPrec i 3 (concat [["{alphaSmall}"]])- RAny -> prPrec i 3 (concat [["."]])---- Handle special characters in regular expressions.-mkEsc :: String -> String-mkEsc = concatMap escChar- where- escChar c- | c `elem` ("$+-*=<>[](){}!?.,;:^~|&%#/\\$_@\"" :: String) = '\\':[c]- | otherwise = [c]
src/BNFC/Backend/Common/Makefile.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-} module BNFC.Backend.Common.Makefile where
src/BNFC/Backend/Common/NamedVariables.hs view
@@ -2,19 +2,6 @@ BNF Converter: Named instance variables Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} @@ -61,7 +48,6 @@ @ This is what this module does.- -} module BNFC.Backend.Common.NamedVariables where@@ -142,17 +128,6 @@ vname = P.text n P.<> if i > 1 || thereIsMore then P.int i else P.empty in Left (c, vname) : f' ((n,i):env) xs ---This makes numbers a little nicer.---If there's only one variable of a type we drop the redundant _1 label.---(Actually here we add _1 labels to variables that need it, but the effect--- is the same.)-fixOnes :: Eq b => [Either String b] -> [Either String b]-fixOnes [] = []-fixOnes (Right f : fs) = Right f : fixOnes fs-fixOnes (Left f : fs) =- if Left (f ++ "2") `elem` fs- then Left (f ++ "1") : fixOnes fs- else Left f : fixOnes fs --This fixes the problem with coercions. fixCoercions :: [(Cat, [Rule])] -> [(Cat, [Rule])]
src/BNFC/Backend/Common/OOAbstract.hs view
@@ -2,25 +2,6 @@ BNF Converter: Datastructure for object-oriented abstract syntax generators Copyright (C) 2006 Author: Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module defines a data structure that is used for generating abstract syntax in cpp_stl. It should be used in other STL modules as well,@@ -28,15 +9,8 @@ in general, to avoid duplicated work. Author : Aarne Ranta (aarne@cs.chalmers.se)-- License : GPL (GNU General Public License)- Created : 29 August, 2006 - Modified : 29 August, 2006 / Aarne Ranta--- ************************************************************** -} module BNFC.Backend.Common.OOAbstract where
src/BNFC/Backend/Haskell.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: Haskell main file- Copyright (C) 2004 Author: Markus Forberg, Peter Gammie, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg, Peter Gammie, Aarne Ranta - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Haskell (makeHaskell, AlexVersion(..), makefile, testfile) where@@ -27,8 +14,6 @@ import BNFC.Backend.Agda import BNFC.Backend.Base import BNFC.Backend.Haskell.CFtoHappy-import BNFC.Backend.Haskell.CFtoAlex-import BNFC.Backend.Haskell.CFtoAlex2 import BNFC.Backend.Haskell.CFtoAlex3 import BNFC.Backend.Haskell.CFtoAbstract import BNFC.Backend.Haskell.CFtoTemplate@@ -36,8 +21,6 @@ import BNFC.Backend.Haskell.CFtoLayout import BNFC.Backend.Haskell.HsOpts import BNFC.Backend.Haskell.MkErrM-import BNFC.Backend.Haskell.MkSharedString-import BNFC.Backend.Haskell.ToCNF as ToCNF import BNFC.Backend.Haskell.Utils import BNFC.Backend.Txt2Tag import BNFC.Backend.XML@@ -61,7 +44,6 @@ prMod = printerFileM opts layMod = layoutFileM opts errMod = errFileM opts- shareMod = shareFileM opts do -- Generate abstract syntax and pretty printer. mkfile (absFile opts) $ cf2Abstract (tokenText opts) (generic opts) (functor opts) absMod cf@@ -69,22 +51,15 @@ -- Generate Alex lexer. Layout is resolved after lexing. case alexMode opts of- Alex1 -> do- mkfile (alexFile opts) $ cf2alex lexMod cf- liftIO $ printf "Use Alex 1.1 to compile %s.\n" (alexFile opts)- Alex2 -> do- mkfile (alexFile opts) $ cf2alex2 lexMod shareMod (shareStrings opts) (tokenText opts) cf- liftIO $ printf "Use Alex 2 to compile %s.\n" (alexFile opts) Alex3 -> do- mkfile (alexFile opts) $ cf2alex3 lexMod shareMod (shareStrings opts) (tokenText opts) cf+ mkfile (alexFile opts) $ cf2alex3 lexMod (tokenText opts) cf liftIO $ printf "Use Alex 3 to compile %s.\n" (alexFile opts) - Ctrl.when (shareStrings opts) $ mkfile (shareFile opts) $ sharedString shareMod (tokenText opts) cf Ctrl.when (hasLayout cf) $ mkfile (layoutFile opts) $- cf2Layout (tokenText opts) (alex1 opts) layMod lexMod cf+ cf2Layout (tokenText opts) layMod lexMod cf - -- Generate Happy parser and matching test program unless --cnf.- Ctrl.unless (cnf opts) $ do+ -- Generate Happy parser and matching test program.+ do mkfile (happyFile opts) $ cf2Happy parMod absMod lexMod (glr opts) (tokenText opts) (functor opts) cf -- liftIO $ printf "%s Tested with Happy 1.15\n" (happyFile opts)@@ -103,12 +78,6 @@ 1 -> makeXML opts False cf _ -> return () - -- CNF backend. Currently does not make use of layout.- Ctrl.when (cnf opts) $ do- mkfile (cnfTablesFile opts) $ ToCNF.generate opts cf- mkfile (cnfTestFile opts) $ ToCNF.genTestFile opts cf- mkfile (cnfBenchFile opts) $ ToCNF.genBenchmark opts- -- Generate Agda bindings for AST, Printer and Parser. Ctrl.when (agda opts) $ makeAgda time opts cf @@ -123,12 +92,8 @@ -> Doc -- ^ Content of the makefile. _oldMakefile opts makeFile = vcat [ Makefile.mkRule "all" [] $ concat $- [ [ unwords $ [ "happy -gca" ] ++ glrParams ++ [ happyFile opts ] | not (cnf opts) ]+ [ [ unwords $ [ "happy -gca" ] ++ glrParams ++ [ happyFile opts ] ] , [ "alex -g " ++ alexFile opts ]- , [ if cnf opts- then unwords [ "ghc --make", cnfTestFile opts, "-o", cnfTestFileExe opts ]- else unwords [ "ghc --make", tFile opts, "-o", tFileExe opts ]- ] ] , cleanRule opts , distCleanRule opts makeFile@@ -168,7 +133,6 @@ , alexFile -- Lex.x , happyFile -- Par.y , printerFile -- Print.hs- , shareFile -- SharedString.hs -- only if: shareStrings opt , templateFile -- Skel.hs , tFile -- Test.hs , xmlFile -- XML.hs@@ -177,7 +141,7 @@ , agdaLibFile -- IOLib.agda , agdaMainFile -- Main.agda , (\ opts -> dir ++ lang opts ++ ".dtd")- ] -- TODO: clean up cnf files+ ] -- Files that have no .bak variant , map (\ (file, ext) -> mkFile withLang file ext opts) [ ("Test" , "")@@ -218,9 +182,9 @@ -- from the Makefile. Thus, we have to drop the rule for -- reinvokation of bnfc. , when (isDefault outDir opts) $ bnfcRule- , unless (cnf opts) $ happyRule+ , happyRule , alexRule- , if cnf opts then testCNFRule else testParserRule+ , testParserRule , when (agda opts) $ agdaRule , vcat [ "# Rules for cleaning generated files." , "" ] , cleanRule opts@@ -243,8 +207,7 @@ , Makefile.mkRule "all" tgts [] ] where- tgts | cnf opts = [ cnfTestFileExe opts ]- | otherwise = concat $+ tgts = concat $ [ [ tFileExe opts ] , [ "Main" | agda opts ] ]@@ -257,7 +220,7 @@ recipe = unwords [ "bnfc", printOptions opts{ make = Nothing } ] tgts = unwords . concat $ [ alexEtc- , if cnf opts then [ cnfTestFile opts ] else [ happyFile opts, tFile opts ]+ , [ happyFile opts, tFile opts ] , when (agda opts) agdaFiles ] alexEtc = map ($ opts) [ errFile, alexFile, printerFile ]@@ -291,12 +254,6 @@ , happyFileHs , printerFile ]-- -- | Rule to build CNF test parser.- testCNFRule :: Doc- testCNFRule = Makefile.mkRule (cnfTestFileExe opts) deps [ "ghc --make $< -o $@" ]- where- deps = [ cnfTestFile opts {- must be first! -} , alexFileHs opts ] -- | Rule to build Agda parser. agdaRule :: Doc
src/BNFC/Backend/Haskell/CFtoAbstract.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: Abstract syntax Generator- Copyright (C) 2004 Author: Markus Forberg-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE LambdaCase #-}
− src/BNFC/Backend/Haskell/CFtoAlex.hs
@@ -1,199 +0,0 @@-{-- BNF Converter: Alex 1.1 Generator- Copyright (C) 2004 Author: Markus Forberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---module BNFC.Backend.Haskell.CFtoAlex (cf2alex) where--import BNFC.CF-import BNFC.Backend.Haskell.RegToAlex-import Data.List--cf2alex :: String -> CF -> String-cf2alex name cf = unlines $ intercalate [""] [- prelude name,- cMacros,- rMacros cf,- restOfAlex cf- ]--prelude :: String -> [String]-prelude name = [- "-- This Alex file was machine-generated by the BNF converter",- "%{",- "module " ++ name ++ " where",- "",- "import Alex",- "%}"- ]--cMacros :: [String]-cMacros = [- "{ ^l = [a-zA-Z^192-^255] # [^215 ^247]} -- isolatin1 letter",- "{ ^c = [A-Z^192-^221] # [^215]} -- capital isolatin1 letter",- "{ ^s = [a-z^222-^255] # [^247]} -- small isolatin1 letter",- "{ ^d = [0-9] } -- digit",- "{ ^i = [^l^d^'^_] } -- identifier character",- "{ ^u = [^0-^255] } -- universal: any character"- ]--rMacros :: CF -> [String]-rMacros cf =- let symbs = cfgSymbols cf- in- (if null symbs then [] else [- "{ %s = -- reserved words consisting of special symbols",- " " ++ unwords (intersperse "|" (map mkEsc symbs)),- "}"- ])- where- mkEsc = unwords . map ( f . (:[]))- f s = if all isSpec s then '^':s else s- isSpec = flip elem ("$+-*=<>[](){}!?.,;:^~|&%#/\\$_@\"" :: String)--restOfAlex :: CF -> [String]-restOfAlex cf = [- "\"tokens_lx\"/\"tokens_acts\":-",- lexComments (comments cf),- "<> ::= ^w+",- pTSpec (cfgSymbols cf,[]), -- modif Markus 12/02 - 2002-- userDefTokenTypes,- identAndRes,-- ifC catString "<string> ::= ^\" ([^u # [^\"^\\^n]] | (^\\ (^\" | ^\\ | ^' | n | t)))* ^\"" ++- "%{ string p = PT p . TL . unescapeInitTail %}",- ifC catChar "<char> ::= ^\' (^u # [^\'^\\] | ^\\ [^\\ ^\' n t]) ^' %{ char p = PT p . TC %}",- ifC catInteger "<int> ::= ^d+ %{ int p = PT p . TI %}",- ifC catDouble- "<double> ::= ^d+ ^. ^d+ (e (^-)? ^d+)? %{ double p = PT p . TD %}",- "",- "%{ ",- "",- "data Tok =",- " TS String -- reserved words",- " | TL String -- string literals",- " | TI String -- integer literals",- " | TV String -- identifiers",- " | TD String -- double precision float literals",- " | TC String -- character literals",- userDefTokenConstrs,- " deriving (Eq,Show)",- "",- "data Token = ",- " PT Posn Tok",- " | Err Posn",- " deriving Show",- "",- "tokenPos (PT (Pn _ l _) _ :_) = \"line \" ++ show l",- "tokenPos (Err (Pn _ l _) :_) = \"line \" ++ show l",- "tokenPos _ = \"end of file\"",- "",- "posLineCol (Pn _ l c) = (l,c)",- "mkPosToken t@(PT p _) = (posLineCol p, prToken t)",- "",- "prToken t = case t of",- " PT _ (TS s) -> s",- " PT _ (TI s) -> s",- " PT _ (TV s) -> s",- " PT _ (TD s) -> s",- " PT _ (TC s) -> s",- userDefTokenPrint,- " _ -> show t",- "",- "tokens:: String -> [Token]",- "tokens inp = scan tokens_scan inp",- "",- "tokens_scan:: Scan Token",- "tokens_scan = load_scan (tokens_acts,stop_act) tokens_lx",- " where",- " stop_act p \"\" = []",- " stop_act p inp = [Err p]",- "",- "eitherResIdent :: (String -> Tok) -> String -> Tok",- "eitherResIdent tv s = if isResWord s then (TS s) else (tv s) where",- " isResWord s = isInTree s $",- " " ++ show (sorted2tree $ sort resws),- "",- "data BTree = N | B String BTree BTree deriving (Show)",- "",- "isInTree :: String -> BTree -> Bool",- "isInTree x tree = case tree of",- " N -> False",- " B a left right",- " | x < a -> isInTree x left",- " | x > a -> isInTree x right",- " | x == a -> True",- "",- "unescapeInitTail :: String -> String",- "unescapeInitTail = unesc . tail where",- " unesc s = case s of",- " '\\\\':c:cs | elem c ['\\\"', '\\\\', '\\\''] -> c : unesc cs",- " '\\\\':'n':cs -> '\\n' : unesc cs",- " '\\\\':'t':cs -> '\\t' : unesc cs",- " '\"':[] -> []",- " c:cs -> c : unesc cs",- " _ -> []",- "%}"- ]- where- ifC :: TokenCat -> String -> String- ifC cat s = if isUsedCat cf (TokenCat cat) then s else ""- lexComments ([],[]) = []- lexComments (xs,s1:ys) = "<> ::= " ++ ('^':intersperse '^' s1) ++ " [.]* ^n\n" ++ lexComments (xs,ys)- lexComments (([l1,l2],[r1,r2]):xs,[]) = concat- [- "<> ::= ",- '^':l1:' ':'^':l2:" ([^u # ^",- l2:"] | ^",- r1:" [^u # ^",- r2:"])* (^",- r1:")+ ^",- r2:"\n",- lexComments (xs,[])- ]- lexComments (_ : xs, []) = lexComments (xs,[])---- lexComments (xs,(_:ys)) = lexComments (xs,ys)- pTSpec ([],[]) = ""- pTSpec xp =- "<pTSpec> ::= " ++ aux xp ++ "%{ pTSpec p = PT p . TS %}"- aux (_,[]) = " %s "- aux ([],_) = " %r "- aux (_,_) = " %s | %r "-- userDefTokenTypes = unlines- ["<mk_" ++ name ++ "> ::= " ++ printRegAlex exp ++- "%{ mk_" ++ name ++ " p = PT p . eitherResIdent T_" ++ name ++ " %}"- | (name,exp) <- tokenPragmas cf]- userDefTokenConstrs = unlines- [" | T_" ++ name ++ " String" | name <- tokenNames cf]- userDefTokenPrint = unlines- [" PT _ (T_" ++ name ++ " s) -> s" | name <- tokenNames cf]-- identAndRes = --This has to be there for Reserved Words. Michael- "<ident> ::= ^l ^i* %{ ident p = PT p . eitherResIdent TV %}"- --ifC "Ident" "<ident> ::= ^l ^i* %{ ident p = PT p . eitherResIdent TV %}"-- resws = reservedWords cf--data BTree = N | B String BTree BTree deriving (Show)--sorted2tree :: [String] -> BTree-sorted2tree [] = N-sorted2tree xs = B x (sorted2tree t1) (sorted2tree t2) where- (t1, x : t2) = splitAt (length xs `div` 2) xs
− src/BNFC/Backend/Haskell/CFtoAlex2.hs
@@ -1,343 +0,0 @@-{-- BNF Converter: Alex 2.0 Generator- Copyright (C) 2004 Author: Peter Gammie-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}------------------------------------------------------------------------ |--- Module : BNFC.Backend.Haskell.CFtoAlex2--- Copyright : (C)opyright 2003, {aarne,markus,peteg} at cs dot chalmers dot se--- License : GPL (see COPYING for details)------ Maintainer : {markus,aarne} at cs dot chalmers dot se--- Stability : alpha--- Portability : Haskell98------ Hacked version of @BNFC.Backend.Haskell.CFtoAlex@ to cope with Alex2.------------------------------------------------------------------------module BNFC.Backend.Haskell.CFtoAlex2 (cf2alex2) where--import Data.Char-import Data.List (intercalate, intersperse, sort)--import AbsBNF-import BNFC.CF-import BNFC.Options (TokenText(..))-import BNFC.Backend.Haskell.Utils---cf2alex2 :: String -> String -> Bool -> TokenText -> CF -> String-cf2alex2 name shareMod shareStrings tokenText cf =- unlines $ intercalate [""] [- prelude name shareMod shareStrings tokenText,- cMacros,- rMacros cf,- restOfAlex shareMod shareStrings tokenText cf- ]--prelude :: String -> String -> Bool -> TokenText -> [String]-prelude name shareMod shareStrings tokenText = concat- [ [ "-- -*- haskell -*-"- , "-- This Alex file was machine-generated by the BNF converter"- , "{"- , "{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}"- , "module " ++ name ++ " where"- , ""- ]- , [ "import " ++ shareMod | shareStrings ]- , tokenTextImport tokenText- , [ "}"- , ""- ]- ]--cMacros :: [String]-cMacros = [- "$l = [a-zA-Z\\192 - \\255] # [\\215 \\247] -- isolatin1 letter FIXME",- "$c = [A-Z\\192-\\221] # [\\215] -- capital isolatin1 letter FIXME",- "$s = [a-z\\222-\\255] # [\\247] -- small isolatin1 letter FIXME",- "$d = [0-9] -- digit",- "$i = [$l $d _ '] -- identifier character",- "$u = [\\0-\\255] -- universal: any character"- ]--rMacros :: CF -> [String]-rMacros cf =- let symbs = cfgSymbols cf- in- (if null symbs then [] else [- "@rsyms = -- symbols and non-identifier-like reserved words",- " " ++ unwords (intersperse "|" (map mkEsc symbs))- ])- where- mkEsc = unwords . esc- esc s = if null a then rest else show a : rest- where (a,r) = span isAlphaNum s- rest = case r of- [] -> []- (c:xs) -> s : esc xs- where s = if isPrint c then ['\\',c]- else '\\':show (ord c)--restOfAlex :: String -> Bool -> TokenText -> CF -> [String]-restOfAlex _ shareStrings tokenText cf = [- ":-",- lexComments (comments cf),- "$white+ ;",- pTSpec (cfgSymbols cf),-- userDefTokenTypes,- ident,-- ifC catString ("\\\" ([$u # [\\\" \\\\ \\n]] | (\\\\ (\\\" | \\\\ | \\' | n | t)))* \\\"" ++- "{ tok (\\p s -> PT p (TL $ share $ unescapeInitTail s)) }"),- ifC catChar "\\\' ($u # [\\\' \\\\] | \\\\ [\\\\ \\\' n t]) \\' { tok (\\p s -> PT p (TC $ share s)) }",- ifC catInteger "$d+ { tok (\\p s -> PT p (TI $ share s)) }",- ifC catDouble "$d+ \\. $d+ (e (\\-)? $d+)? { tok (\\p s -> PT p (TD $ share s)) }",- "",- "{",- "",- "tok f p s = f p s",- "",- "share :: "++stringType++" -> "++stringType,- "share = " ++ if shareStrings then "shareString" else "id",- "",- "data Tok =",- " TS !"++stringType++" !Int -- reserved words and symbols",- " | TL !"++stringType++" -- string literals",- " | TI !"++stringType++" -- integer literals",- " | TV !"++stringType++" -- identifiers",- " | TD !"++stringType++" -- double precision float literals",- " | TC !"++stringType++" -- character literals",- userDefTokenConstrs,- " deriving (Eq,Show,Ord)",- "",- "data Token = ",- " PT Posn Tok",- " | Err Posn",- " deriving (Eq,Show,Ord)",- "",- "tokenPos (PT (Pn _ l _) _ :_) = \"line \" ++ show l",- "tokenPos (Err (Pn _ l _) :_) = \"line \" ++ show l",- "tokenPos _ = \"end of file\"",- "",- "posLineCol (Pn _ l c) = (l,c)",- "mkPosToken t@(PT p _) = (posLineCol p, prToken t)",- "",- "prToken t = case t of",- " PT _ (TS s _) -> s",- " PT _ (TL s) -> show s",- " PT _ (TI s) -> s",- " PT _ (TV s) -> s",- " PT _ (TD s) -> s",- " PT _ (TC s) -> s",- userDefTokenPrint,- "",- "data BTree = N | B "++stringType++" Tok BTree BTree deriving (Show)",- "",- "eitherResIdent :: ("++stringType++" -> Tok) -> "++stringType++" -> Tok",- "eitherResIdent tv s = treeFind resWords",- " where",- " treeFind N = tv s",- " treeFind (B a t left right) | s < a = treeFind left",- " | s > a = treeFind right",- " | s == a = t",- "",- "resWords = " ++ show (sorted2tree $ zip (sort resws) [1..]),- " where b s n = let bs = "++stringPack++" s",- " in B bs (TS bs n)",- "",- "unescapeInitTail :: "++stringType++" -> "++stringType++"",- "unescapeInitTail = "++stringPack++" . unesc . tail . "++stringUnpack++" where",- " unesc s = case s of",- " '\\\\':c:cs | elem c ['\\\"', '\\\\', '\\\''] -> c : unesc cs",- " '\\\\':'n':cs -> '\\n' : unesc cs",- " '\\\\':'t':cs -> '\\t' : unesc cs",- " '\"':[] -> []",- " c:cs -> c : unesc cs",- " _ -> []",- "",- "-------------------------------------------------------------------",- "-- Alex wrapper code.",- "-- A modified \"posn\" wrapper.",- "-------------------------------------------------------------------",- "",- "data Posn = Pn !Int !Int !Int",- " deriving (Eq, Show,Ord)",- "",- "alexStartPos :: Posn",- "alexStartPos = Pn 0 1 1",- "",- "alexMove :: Posn -> Char -> Posn",- "alexMove (Pn a l c) '\\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)",- "alexMove (Pn a l c) '\\n' = Pn (a+1) (l+1) 1",- "alexMove (Pn a l c) _ = Pn (a+1) l (c+1)",- "",- "type AlexInput = (Posn, -- current position,",- " Char, -- previous char",- " "++stringType++") -- current input string",- "",- "tokens :: "++stringType++" -> [Token]",- "tokens str = go (alexStartPos, '\\n', str)",- " where",- " go :: AlexInput -> [Token]",- " go inp@(pos, _, str) =",- " case alexScan inp 0 of",- " AlexEOF -> []",- " AlexError (pos, _, _) -> [Err pos]",- " AlexSkip inp' len -> go inp'",- " AlexToken inp' len act -> act pos ("++stringTake++" len str) : (go inp')",- "",- "alexGetChar :: AlexInput -> Maybe (Char,AlexInput)",- "alexGetChar (p, _, s) =",- " case "++stringUncons++" s of",- " "++stringNilP++" -> Nothing",- " "++stringConsP++" ->",- " let p' = alexMove p c",- " in p' `seq` Just (c, (p', c, s))",- "",- "alexInputPrevChar :: AlexInput -> Char",- "alexInputPrevChar (p, c, s) = c",- "}"- ]- where- (stringType,stringTake,stringUncons,stringPack,stringUnpack,stringNilP,stringConsP) = case tokenText of- StringToken -> ("String", "take", "", "id", "id", "[]", "(c:s)" )- ByteStringToken -> ("BS.ByteString", "BS.take", "BS.uncons", "BS.pack", "BS.unpack", "Nothing", "Just (c,s)")- TextToken -> ("Data.Text.Text", "Data.Text.take", "Data.Text.uncons", "Data.Text.pack", "Data.Text.unpack", "Nothing", "Just (c,s)")-- ifC :: TokenCat -> String -> String- ifC cat s = if isUsedCat cf (TokenCat cat) then s else ""- lexComments ([],[]) = []- lexComments (xs,s1:ys) = '\"' : s1 ++ "\"" ++ " [.]* ; -- Toss single line comments\n" ++ lexComments (xs, ys)- lexComments (([l1,l2],[r1,r2]):xs,[]) = concat- [- '\"':l1:l2:"\" ([$u # \\", -- FIXME quotes or escape?- r1:"] | \\",- r1:"+ [$u # [\\",- r1:" \\",- r2:"]])* (\"",- r1:"\")+ \"",- r2:"\" ; \n",- lexComments (xs, [])- ]- lexComments (_:xs,[]) = lexComments (xs,[])---- lexComments (xs,(_:ys)) = lexComments (xs,ys)-- -- tokens consisting of special symbols- pTSpec [] = ""- pTSpec _ = "@rsyms { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }"-- userDefTokenTypes = unlines- [printRegAlex exp ++- " { tok (\\p s -> PT p (eitherResIdent (T_" ++ name ++ " . share) s)) }"- | (name,exp) <- tokenPragmas cf]- userDefTokenConstrs = unlines- [" | T_" ++ name ++ " !"++stringType | name <- tokenNames cf]- userDefTokenPrint = unlines- [" PT _ (T_" ++ name ++ " s) -> s" | name <- tokenNames cf]-- ident =- "$l $i* { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }"- --ifC "Ident" "<ident> ::= ^l ^i* { ident p = PT p . eitherResIdent TV }"-- resws = reservedWords cf ++ cfgSymbols cf---data BTree = N | B String Int BTree BTree--instance Show BTree where- showsPrec _ N = showString "N"- showsPrec n (B s k l r) = wrap (showString "b " . shows s . showChar ' '. shows k . showChar ' '- . showsPrec 1 l . showChar ' '- . showsPrec 1 r)- where wrap f = if n > 0 then showChar '(' . f . showChar ')' else f--sorted2tree :: [(String,Int)] -> BTree-sorted2tree [] = N-sorted2tree xs = B x n (sorted2tree t1) (sorted2tree t2) where- (t1,(x,n):t2) = splitAt (length xs `div` 2) xs------------------------------------------------------------------------- Inlined version of @BNFC.Backend.Haskell.RegToAlex@.--- Syntax has changed...------------------------------------------------------------------------ modified from pretty-printer generated by the BNF converter---- the top-level printing method-printRegAlex :: Reg -> String-printRegAlex = render . prt 0---- you may want to change render and parenth--render :: [String] -> String-render = rend 0- where rend :: Int -> [String] -> String- rend i ss = case ss of- "[" :ts -> cons "[" $ rend i ts- "(" :ts -> cons "(" $ rend i ts- t : "," :ts -> cons t $ space "," $ rend i ts- t : ")" :ts -> cons t $ cons ")" $ rend i ts- t : "]" :ts -> cons t $ cons "]" $ rend i ts- t :ts -> space t $ rend i ts- _ -> ""-- cons s t = s ++ t- space t s = if null s then t else t ++ " " ++ s--parenth :: [String] -> [String]-parenth ss = ["("] ++ ss ++ [")"]---- the printer class does the job-class Print a where- prt :: Int -> a -> [String]- prtList :: [a] -> [String]- prtList = concatMap (prt 0)--instance Print a => Print [a] where- prt _ = prtList--instance Print Char where- prt _ c = if isAlphaNum c then [[c]] else ['\\':[c]]- prtList = map (concat . prt 0)--prPrec :: Int -> Int -> [String] -> [String]-prPrec i j = if j<i then parenth else id--instance Print Identifier where- prt _ (Identifier (_, i)) = [i]--instance Print Reg where- prt i e = case e of- RSeq reg0 reg -> prPrec i 2 (prt 2 reg0 ++ prt 3 reg)- RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg])- RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg])- RStar reg -> prPrec i 3 (prt 3 reg ++ ["*"])- RPlus reg -> prPrec i 3 (prt 3 reg ++ ["+"])- ROpt reg -> prPrec i 3 (prt 3 reg ++ ["?"])- REps -> prPrec i 3 ["()"]- RChar c -> prPrec i 3 (prt 0 c)- RAlts str -> prPrec i 3 (concat [["["],prt 0 str,["]"]])- RSeqs str -> prPrec i 2 (concatMap (prt 0) str)- RDigit -> prPrec i 3 ["$d"]- RLetter -> prPrec i 3 ["$l"]- RUpper -> prPrec i 3 ["$c"]- RLower -> prPrec i 3 ["$s"]- RAny -> prPrec i 3 ["$u"]
src/BNFC/Backend/Haskell/CFtoAlex3.hs view
@@ -4,19 +4,6 @@ Copyright (C) 2004 Author: Peter Gammie (C)opyright 2003, {aarne,markus,peteg} at cs dot chalmers dot se - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Haskell.CFtoAlex3 (cf2alex3) where@@ -24,7 +11,7 @@ import Data.Char import qualified Data.List as List -import AbsBNF+import BNFC.Abs import BNFC.CF import BNFC.Lexing (mkRegMultilineComment) import BNFC.Options (TokenText(..))@@ -33,17 +20,17 @@ import BNFC.Backend.Common (unicodeAndSymbols) import BNFC.Backend.Haskell.Utils -cf2alex3 :: String -> String -> Bool -> TokenText -> CF -> String-cf2alex3 name shareMod shareStrings tokenText cf =- unlines $ concat $- [ prelude name shareMod shareStrings tokenText+cf2alex3 :: String -> TokenText -> CF -> String+cf2alex3 name tokenText cf =+ unlines $ List.intercalate [""] $ -- equivalent to vsep: intersperse empty lines+ [ prelude name tokenText , cMacros , rMacros cf- , restOfAlex shareMod shareStrings tokenText cf+ , restOfAlex tokenText cf ] -prelude :: String -> String -> Bool -> TokenText -> [String]-prelude name shareMod shareStrings tokenText = concat+prelude :: String -> TokenText -> [String]+prelude name tokenText = concat [ [ "-- -*- haskell -*-" , "-- This Alex file was machine-generated by the BNF converter" , "{"@@ -52,7 +39,6 @@ , "module " ++ name ++ " where" , "" ]- , [ "import " ++ shareMod | shareStrings ] , tokenTextImport tokenText , [ "import qualified Data.Bits" , "import Data.Word (Word8)"@@ -88,8 +74,8 @@ where s = if isPrint c then ['\\',c] else '\\':show (ord c) -restOfAlex :: String -> Bool -> TokenText -> CF -> [String]-restOfAlex _ shareStrings tokenText cf = [+restOfAlex :: TokenText -> CF -> [String]+restOfAlex tokenText cf = [ ":-", "", lexComments (comments cf),@@ -100,19 +86,16 @@ ident, ifC catString ("\\\" ([$u # [\\\" \\\\ \\n]] | (\\\\ (\\\" | \\\\ | \\' | n | t | r | f)))* \\\"" ++- "\n { tok (\\p s -> PT p (TL $ share $ unescapeInitTail s)) }"),- ifC catChar "\\\' ($u # [\\\' \\\\] | \\\\ [\\\\ \\\' n t r f]) \\'\n { tok (\\p s -> PT p (TC $ share s)) }",- ifC catInteger "$d+\n { tok (\\p s -> PT p (TI $ share s)) }",- ifC catDouble "$d+ \\. $d+ (e (\\-)? $d+)?\n { tok (\\p s -> PT p (TD $ share s)) }",+ "\n { tok (\\p s -> PT p (TL $ unescapeInitTail s)) }"),+ ifC catChar "\\\' ($u # [\\\' \\\\] | \\\\ [\\\\ \\\' n t r f]) \\'\n { tok (\\p s -> PT p (TC s)) }",+ ifC catInteger "$d+\n { tok (\\p s -> PT p (TI s)) }",+ ifC catDouble "$d+ \\. $d+ (e (\\-)? $d+)?\n { tok (\\p s -> PT p (TD s)) }", "", "{", "", "tok :: (Posn -> " ++ stringType ++ " -> Token) -> (Posn -> " ++ stringType ++ " -> Token)", "tok f p s = f p s", "",- "share :: "++stringType++" -> "++stringType,- "share = " ++ if shareStrings then "shareString" else "id",- "", "data Tok =", " TS !"++stringType++" !Int -- reserved words and symbols", " | TL !"++stringType++" -- string literals",@@ -302,11 +285,11 @@ -- tokens consisting of special symbols pTSpec [] = ""- pTSpec _ = "@rsyms\n { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }"+ pTSpec _ = "@rsyms\n { tok (\\p s -> PT p (eitherResIdent TV s)) }" userDefTokenTypes = unlines [ printRegAlex exp ++- "\n { tok (\\p s -> PT p (eitherResIdent (T_" ++ name ++ " . share) s)) }"+ "\n { tok (\\p s -> PT p (eitherResIdent T_" ++ name ++ " s)) }" | (name,exp) <- tokenPragmas cf ] @@ -321,7 +304,7 @@ ] ident =- "$l $i*\n { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }"+ "$l $i*\n { tok (\\p s -> PT p (eitherResIdent TV s)) }" --ifC "Ident" "<ident> ::= ^l ^i* { ident p = PT p . eitherResIdent TV }" @@ -345,7 +328,7 @@ ---------------------------------------------------------------------- Inlined version of @BNFC.Backend.Haskell.RegToAlex@.+-- Inlined version of former @BNFC.Backend.Haskell.RegToAlex@. -- Syntax has changed... -------------------------------------------------------------------
src/BNFC/Backend/Haskell/CFtoHappy.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: Happy Generator- Copyright (C) 2004 Author: Markus Forberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg, Aarne Ranta - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE LambdaCase #-}@@ -24,6 +11,7 @@ import Prelude hiding ((<>)) +import Data.Foldable (toList) import Data.List (intersperse) import BNFC.CF@@ -56,22 +44,29 @@ -> CF -- ^ Grammar. -> String -- ^ Generated code. cf2Happy name absName lexName mode tokenText functor cf = unlines- [ header name absName lexName tokenText- , render $ declarations mode (allEntryPoints cf)+ [ header name absName lexName tokenText eps+ , render $ declarations mode eps , render $ tokens cf , delimiter , specialRules absName tokenText cf , render $ prRules absName functor (rulesForHappy absName functor cf) , footer ]+ where+ eps = toList $ allEntryPoints cf -- | Construct the header.-header :: ModuleName -> ModuleName -> ModuleName -> TokenText -> String-header modName absName lexName tokenText = unlines $ concat+header :: ModuleName -> ModuleName -> ModuleName -> TokenText -> [Cat] -> String+header modName absName lexName tokenText eps = unlines $ concat [ [ "-- This Happy file was machine-generated by the BNF converter" , "{" , "{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}"- , "module " ++ modName ++ " where"+ , "module " ++ modName+ , " ( happyError"+ , " , myLexer"+ ]+ , map ((" , " ++) . render . parserName) eps+ , [ " ) where" , "import qualified " ++ absName , "import " ++ lexName ]
src/BNFC/Backend/Haskell/CFtoLayout.hs view
@@ -3,19 +3,6 @@ Copyright (C) 2004 Author: Aarne Ranta Copyright (C) 2005 Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Haskell.CFtoLayout where@@ -29,12 +16,11 @@ layoutClose = "}" layoutSep = ";" -cf2Layout :: TokenText -> Bool -> String -> String -> CF -> String-cf2Layout tokenText alex1 layName lexName cf = unlines $ [+cf2Layout :: TokenText -> String -> String -> CF -> String+cf2Layout tokenText layName lexName cf = unlines $ [ "module " ++ layName ++ " where", "", "import " ++ lexName,- if alex1 then "import Alex" else "", "", if tokenText == TextToken then "import qualified Data.Text" else "", "import Data.Maybe (isNothing, fromJust)",
src/BNFC/Backend/Haskell/CFtoPrinter.hs view
@@ -2,19 +2,6 @@ BNF Converter: Pretty-printer generator Copyright (C) 2004 Author: Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE LambdaCase #-}
src/BNFC/Backend/Haskell/CFtoTemplate.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: Template Generator- Copyright (C) 2004 Author: Markus Forberg-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE OverloadedStrings #-}
src/BNFC/Backend/Haskell/HsOpts.hs view
@@ -8,12 +8,9 @@ type Options = SharedOptions -alex1 opts = alexMode opts == Alex1- absFile, absFileM, alexFile, alexFileHs, alexFileM, composOpFile, composOpFileM,- gfAbs, happyFile, happyFileHs, happyFileM, errFile, errFileM, templateFile, templateFileM,@@ -33,13 +30,10 @@ templateFileM = mkMod withLang "Skel" printerFile = mkFile withLang "Print" "hs" printerFileM = mkMod withLang "Print"-gfAbs = mkFile withLang "" "Abs.gf" tFile = mkFile withLang "Test" "hs" tFileExe = mkFile withLang "Test" "" errFile = mkFile noLang "ErrM" "hs" errFileM = mkMod noLang "ErrM"-shareFile = mkFile noLang "SharedString" "hs"-shareFileM = mkMod noLang "SharedString" layoutFileM = mkMod withLang "Layout" layoutFile = mkFile withLang "Layout" "hs" xmlFile = mkFile withLang "XML" "hs"@@ -47,18 +41,6 @@ composOpFile = mkFile noLang "ComposOp" "hs" composOpFileM = mkMod noLang "ComposOp" --- Files created by the CNF variant--cnfTablesFile, cnfTablesFileM- , cnfTestFile, cnfTestFileExe- , cnfBenchFile- :: Options -> String-cnfTablesFile = mkFile withLang "CnfTables" "hs"-cnfTablesFileM = mkMod withLang "CnfTables"-cnfTestFile = mkFile withLang "Test" "hs" -- WAS: TestCNF, but just naming it Test is easier for testsuite-cnfTestFileExe = mkFile withLang "Test" ""-cnfBenchFile = mkFile withLang "BenchCNF" "hs"- -- Files created by the Agda backend agdaASTFile@@ -123,9 +105,6 @@ -- "A/B/C/Abc/Abstract.hs" mkFile :: (Options -> String -> String) -> String -> String -> Options -> FilePath mkFile addLang name ext opts = pkgToDir (mkMod addLang name opts) <.> ext--mkFileName :: String -> String -> FilePath-mkFileName module' ext = pkgToDir module' <.> ext -- | Determine the modules' namespace
src/BNFC/Backend/Haskell/MkErrM.hs view
@@ -1,23 +1,12 @@ {- BNF Converter: Haskell error monad- Copyright (C) 2004-2007 Author: Markus Forberg, Peter Gammie,+ Copyright (C) 2004-2007 Author: Markus Forsberg, Peter Gammie, Aarne Ranta, Björn Bringert Copyright (C) 2019 Author: Andreas Abel - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -}++{-# LANGUAGE OverloadedStrings #-} module BNFC.Backend.Haskell.MkErrM where
@@ -1,92 +0,0 @@-{-- BNF Converter: Haskell string sharing- Copyright (C) 2004-2007 Author: Björn Bringert-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}-module BNFC.Backend.Haskell.MkSharedString where--import BNFC.Options (TokenText(..))--sharedString :: String -> TokenText -> b -> String-sharedString shareMod tokenText _ = unlines $- case tokenText of- ByteStringToken ->- [- "module " ++ shareMod ++ " (shareString) where",- "",- "import Data.Map as M",- "import Data.IORef",- "import qualified Data.ByteString.Char8 as BS",- "import System.IO.Unsafe (unsafePerformIO)",- "",- "{-# NOINLINE stringPoolRef #-}",- "stringPoolRef :: IORef (M.Map BS.ByteString BS.ByteString)",- "stringPoolRef = unsafePerformIO $ newIORef M.empty",- "",- "{-# NOINLINE shareString #-}",- "shareString :: BS.ByteString -> BS.ByteString",- "shareString s = unsafePerformIO $ do",- " stringPool <- readIORef stringPoolRef",- " case M.lookup s stringPool of",- " Just s' -> return s'",- " Nothing -> do let s' = BS.copy s",- " writeIORef stringPoolRef $! M.insert s' s' stringPool",- " return s'"- ]- StringToken ->- [- "module " ++ shareMod ++ " (shareString) where",- "",- "import Data.HashTable as H",- "import System.IO.Unsafe (unsafePerformIO)",- "",- "{-# NOINLINE stringPool #-}",- "stringPool :: HashTable String String",- "stringPool = unsafePerformIO $ new (==) hashString",- "",- "{-# NOINLINE shareString #-}",- "shareString :: String -> String",- "shareString s = unsafePerformIO $ do",- " mv <- H.lookup stringPool s",- " case mv of",- " Just s' -> return s'",- " Nothing -> do",- " H.insert stringPool s s",- " return s"- ]- TextToken ->- [- "module " ++ shareMod ++ " (shareString) where",- "",- "import Data.Text (Text)",- "import qualified Data.Text",- "import Data.HashTable as H",- "import System.IO.Unsafe (unsafePerformIO)",- "",- "{-# NOINLINE stringPool #-}",- "stringPool :: HashTable Text Text",- "stringPool = unsafePerformIO $ new (==) (hashString . Data.Text.unpack)",- "",- "{-# NOINLINE shareString #-}",- "shareString :: Text -> Text",- "shareString s = unsafePerformIO $ do",- " mv <- H.lookup stringPool s",- " case mv of",- " Just s' -> return s'",- " Nothing -> do",- " H.insert stringPool s s",- " return s"- ]
− src/BNFC/Backend/Haskell/RegToAlex.hs
@@ -1,84 +0,0 @@-{-- BNF Converter: Regular expression pretty printer- Copyright (C) 2004 Author: BNF Converter, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--module BNFC.Backend.Haskell.RegToAlex (printRegAlex) where---- modified from pretty-printer generated by the BNF converter--import AbsBNF-import Data.Char---- the top-level printing method-printRegAlex :: Reg -> String-printRegAlex = render . prt 0---- you may want to change render and parenth--render :: [String] -> String-render = rend (0::Int) where- rend i ss = case ss of- "[" :ts -> cons "[" $ rend i ts- "(" :ts -> cons "(" $ rend i ts- t : "," :ts -> cons t $ space "," $ rend i ts- t : ")" :ts -> cons t $ cons ")" $ rend i ts- t : "]" :ts -> cons t $ cons "]" $ rend i ts- t :ts -> space t $ rend i ts- _ -> ""- cons s t = s ++ t- space t s = if null s then t else t ++ " " ++ s--parenth :: [String] -> [String]-parenth ss = ["("] ++ ss ++ [")"]---- the printer class does the job-class Print a where- prt :: Int -> a -> [String]- prtList :: [a] -> [String]- prtList = concat . map (prt 0)--instance Print a => Print [a] where- prt _ = prtList--instance Print Char where- prt _ c = if isAlphaNum c then [[c]] else ['^':[c]]- prtList s = map (concat . prt 0) s--prPrec :: Int -> Int -> [String] -> [String]-prPrec i j = if j<i then parenth else id--instance Print Identifier where- prt _ (Identifier (_, i)) = [i]--instance Print Reg where- prt i e = case e of- RSeq reg0 reg -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg])- RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg])- RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg])- RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]])- RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]])- ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]])- REps -> prPrec i 3 (["$"])- RChar c -> prPrec i 3 (concat [prt 0 c])- RAlts str -> prPrec i 3 (concat [["["],prt 0 str,["]"]])- RSeqs str -> prPrec i 2 (concat (map (prt 0) str))- RDigit -> prPrec i 3 (concat [["^d"]])- RLetter -> prPrec i 3 (concat [["^l"]])- RUpper -> prPrec i 3 (concat [["^c"]])- RLower -> prPrec i 3 (concat [["^s"]])- RAny -> prPrec i 3 (concat [["^u"]])
− src/BNFC/Backend/Haskell/ToCNF.hs
@@ -1,280 +0,0 @@-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, CPP #-}-{-- Copyright (C) 2012 Authors:- Jean-Philippe Bernardy.-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-# LANGUAGE OverloadedStrings #-}--module BNFC.Backend.Haskell.ToCNF (generate, genTestFile, genBenchmark) where--{---Construction of CYK tables. The algorithm follows:--Lange, Martin; Leiß, Hans (2009), "To CNF or not to CNF? An Efficient-Yet Presentable Version of the CYK Algorithm", Informatica Didactica---}-import BNFC.ToCNFCore-import BNFC.CF hiding (App,Exp)-import BNFC.Backend.Haskell.HsOpts-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative hiding (Const)-#endif-import qualified Data.Map as Map-#if !(MIN_VERSION_base(4,11,0))-import Data.Monoid-#endif-import Data.Pair-import Text.PrettyPrint.HughesPJ hiding (first,(<>))---- Code generation--incomment x = "{-" <> x <> "-}"--generate :: Options -> CF -> Doc-generate opts cf0 = vcat $- [ header opts- , genShowFunction cf0- , genCatTags cf1- , genDesc cf1 descriptions- , genNeighborSet neighbors- , genCombTable units $ onRules (filter (not . isUnitRule)) cf- , genTokTable units cf- , incomment $ vcat $- [ "Normalised grammar:"- , text $ show cf- , "Unit relation:"- , prettyUnitSet units- ]- ]- where- (cf1, cf, units, descriptions, neighbors) = toCNF cf0--class Pretty a where- pretty :: a -> Doc--instance (Pretty k, Pretty v) => Pretty (Set k v) where- pretty s = sep [pretty k <> " --> " <> pretty v | (k,x) <- Map.assocs s, v <- x]--instance Pretty (Either Cat String) where- pretty (Left x) = text $ show x- pretty (Right x) = quotes $ text x--instance Pretty String where- pretty = text--prettyUnitSet units = vcat $- [ prettyExp f <> " : " <> catTag cat <> " --> " <> text (show cat')- | (cat, x) <- Map.assocs units- , (f, cat') <- x- ]--header opts = vcat $- [ "{-# LANGUAGE MagicHash, FlexibleInstances #-}"- , ""- , "module " <> text (cnfTablesFileM opts) <> " where"- , ""- , "import GHC.Prim"- , "import Control.Applicative hiding (Const)"- , ""- , "import Algebra.RingUtils"- , "import Parsing.Chart ()"- , ""- , "import " <> text (absFileM opts)- , "import " <> text (alexFileM opts)- , "import " <> text ( printerFileM opts)- , ""- , "readInteger :: String -> Integer"- , "readInteger = read"- , ""- , "readDouble :: String -> Double"- , "readDouble = read"- , ""- , "instance RingP [(CATEGORY,a)] where"- , " mul p a b = trav [ map (app tx ty) l :/: map (app tx ty) r | (x, tx) <- a, (y, ty) <- b, let l:/:r = combine p x y ]"- , " where "- , " trav :: [Pair [a]] -> Pair [a]"- , " trav [] = pure []"- , " trav (x:xs) = (++) <$> x <*> trav xs"- , " app tx ty (z, f) = (z, f tx ty)"- , ""- ]--genShowFunction cf =- hang "showAst (cat, ast) = case cat of " 6 $ vcat $- [ vcat- [ hsep [ catTag (Left cat), "->", "printTree", parens ("(unsafeCoerce# ast) ::" <+> text (show cat)) ]- | cat <- filter isDataOrListCat $ reallyAllCats cf- ]- , "_ -> \"Unprintable category\""- ]--genCatTags :: CFG Exp -> Doc-genCatTags cf = vcat- [ "data CATEGORY = " <> punctuate' " |" cs- , " deriving (Eq, Ord, Show)"- ]- where- cs = map catTag $ allSyms cf--genDesc :: CFG Exp -> CatDescriptions -> Doc-genDesc cf descs = vcat $- [ "describe " <> catTag s <> " = " <> text (show (descOf s))- | s <- allSyms cf- ]- where- descOf :: Either Cat String -> String- descOf (Right x) = "token " <> x- descOf (Left x) = maybe (show x) render $ Map.lookup x descs--genCombTable :: UnitRel Cat -> CFG Exp -> Doc-genCombTable units cf = vcat- [ "combine :: Bool -> CATEGORY -> CATEGORY -> Pair [(CATEGORY, a -> a -> a)]"- , genCombine units cf- , "combine _ _ _ = pure []"- ]--allSyms :: CFG Exp -> [Either Cat String]-allSyms cf = concat $- [ map Left $ reallyAllCats cf- , map (Left . TokenCat) $ literals cf- , map (Right . fst) $ cfTokens cf- ]--ppPair (x, y) = parens $ hsep [ x <> comma, y ]--unsafeCoerce' = app' (Con "unsafeCoerce#")--prettyPair (x :/: y) = sep [ x, ":/:", y ]--prettyListFun xs = parens $ sep (map (<> "$") xs) <> "[]"---genCombine :: UnitRel Cat -> CFG Exp -> Doc-genCombine units cf = vcat $ map genEntry $ group' $ map (alt units) (cfgRules cf)- where- genEntry :: ((RHSEl,RHSEl),[(Cat,Exp)]) -> Doc- genEntry ((r1,r2),cs) = hsep $- [ "combine p", catTag r1, catTag r2, equals- , prettyPair (genList <$> splitOptim (Left . fst) cf cs)- ]- mkLam body = "\\ x y -> " <> body- genList xs = prettyListFun $- [ p $ ppPair (catTag . Left $ x, mkLam . prettyExp . unsafeCoerce' $ y)- | ((x, y), p) <- xs- ]--alt :: UnitRel Cat -> Rul Exp -> ((RHSEl,RHSEl),[(Cat,Exp)])-alt units (Rule f (WithPosition _ c) [r1, r2] _) = ((r1, r2), initial:others)- where- initial = (c, f `appMany` args)- others = [ (c', f' `app'` (f `appMany` args))- | (f',c') <- lookupMulti (Left c) units- ]- args = map (unsafeCoerce' . Con) $ [ "x" | isCat r1 ] ++ [ "y" | isCat r2 ]-alt _ _ = error "Only works with binary rules"----genTokTable :: UnitRel Cat -> CFG Exp -> Doc-genTokTable units cf = vcat- [ "tokenToCats :: Bool -> Token -> Pair [(CATEGORY,a)]"- , vcat $ map (genSpecEntry cf units) $ tokInfo cf- , vcat $ map (genTokEntry cf units) $ cfTokens cf- , "tokenToCats p t = error (\"unknown token: \" ++ show t)"- ]--tokInfo cf = concat $- [ [ (catChar , "TC", Con "head")- , (catString , "TL", Id)- , (catInteger, "TI", Con "readInteger")- , (catDouble , "TD", Con "readDouble")- ]- , [ (catIdent,"TV", Con "Ident") | hasIdent cf ]- , [ (t, "T_" <> text t, Con t) | (t, _) <- tokenPragmas cf ]- ]--genTokCommon cf xs = prettyPair (gen <$> splitOptim fst cf xs)- where gen ys = prettyListFun [ p (ppPair (catTag x, y)) | ((x, y), p) <- ys ]--genSpecEntry cf units (tokName, constrName, fun) =- "tokenToCats p (PT (Pn _ l c) (" <> constrName <> " x)) = " <> genTokCommon cf xs- where- xs = map (second (prettyExp . (\ f -> unsafeCoerce' (f `app'` tokArgs)))) $- (Left $ TokenCat tokName, fun) : [ (Left c, f `after` fun) | (f, c) <- lookupMulti (Left $ TokenCat tokName) units ]- tokArgs | isPositionCat cf tokName = Con "((l, c), x)"- | otherwise = Con "x"--genTokEntry cf units (tok,x) =- " -- " <> text tok $$- "tokenToCats p (PT posn (TS _ " <> int x <> ")) = " <> genTokCommon cf xs- where- xs = (Right tok, tokVal) :- [ (Left c, prettyExp (unsafeCoerce' f)) | (f, c) <- lookupMulti (Right tok) units ]- tokVal = "error" <> (text $ show $ "cannot access value of token: " ++ tok)--ppList = brackets . punctuate' ", "--genNeighborSet ns = vcat $- [ vcat [ hsep [ "neighbors", catTag x, equals, ppList (map catTag y) ] | (x, y) <- ns ]- , "neighbors _ = []"- ]----------------------------- Test file generation--genTestFile :: Options -> CF -> Doc-genTestFile opts _ = vcat $- [ "module Main where"- , ""- , "import Parsing.TestProgram"- , "import" <+> text (alexFileM opts)- , "import" <+> text (cnfTablesFileM opts)- , ""- , "main = mainTest showAst tokenToCats tokens tokenLineCol describe neighbors"- ]---genBenchmark opts = vcat $- [ "import Control.Applicative"- , "import GHC.Exts"- , "import System.Environment ( getArgs )"- , ""- , "import Criterion.Main"- , ""- , "import Algebra.RingUtils"- , "import Parsing.Chart"- , ""- , "import" <+> text (alexFileM opts) <+> "as Lexer"- , "import" <+> text (cnfTablesFileM opts) <+> "as Parser"- , ""- , "type T = [(CATEGORY,a)]"- , ""- , "pLGrammar :: [Pair T] -> MT2 T"- , "pLGrammar = mkTree"- , ""- , "main = do"- , " f:_ <- getArgs"- , " s <- readFile f"- , " let ts = zipWith tokenToCats (cycle [False, True]) (Lexer.tokens s)"- , " (ts1, x:ts2) = splitAt (length ts `div` 2) ts"- , " cs = [mkTree ts1, mkTree' ts2]"- , " work [c1, c2] = show $ map fst $ root $ mergein False c1 x c2"- , " defaultMain [bench f $ nf work cs] -- note the hack!!!"- ]
src/BNFC/Backend/HaskellGADT.hs view
@@ -1,21 +1,8 @@ {- BNF Converter: Haskell main file- Copyright (C) 2004-2005 Author: Markus Forberg, Peter Gammie,+ Copyright (C) 2004-2005 Author: Markus Forsberg, Peter Gammie, Aarne Ranta, Björn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.HaskellGADT (makeHaskellGadt) where@@ -27,8 +14,6 @@ import BNFC.Backend.Haskell.HsOpts import BNFC.CF import BNFC.Backend.Haskell.CFtoHappy-import BNFC.Backend.Haskell.CFtoAlex-import BNFC.Backend.Haskell.CFtoAlex2 import BNFC.Backend.Haskell.CFtoAlex3 import BNFC.Backend.HaskellGADT.CFtoAbstractGADT import BNFC.Backend.HaskellGADT.CFtoTemplateGADT@@ -36,7 +21,6 @@ import BNFC.Backend.Haskell.CFtoLayout import BNFC.Backend.XML import BNFC.Backend.Haskell.MkErrM-import BNFC.Backend.Haskell.MkSharedString import qualified BNFC.Backend.Common.Makefile as Makefile import qualified BNFC.Backend.Haskell as Haskell @@ -52,19 +36,12 @@ prMod = printerFileM opts layMod = layoutFileM opts errMod = errFileM opts- shareMod = shareFileM opts do mkfile (absFile opts) $ cf2Abstract (tokenText opts) absMod cf composOpMod mkfile (composOpFile opts) $ composOp composOpMod case alexMode opts of- Alex1 -> do- mkfile (alexFile opts) $ cf2alex lexMod cf- liftIO $ putStrLn " (Use Alex 1.1 to compile.)"- Alex2 -> do- mkfile (alexFile opts) $ cf2alex2 lexMod shareMod (shareStrings opts) (tokenText opts) cf- liftIO $ putStrLn " (Use Alex 2 to compile.)" Alex3 -> do- mkfile (alexFile opts) $ cf2alex3 lexMod shareMod (shareStrings opts) (tokenText opts) cf+ mkfile (alexFile opts) $ cf2alex3 lexMod (tokenText opts) cf liftIO $ putStrLn " (Use Alex 3 to compile.)" mkfile (happyFile opts) $ cf2Happy parMod absMod lexMod (glr opts) (tokenText opts) False cf@@ -72,10 +49,9 @@ mkfile (templateFile opts) $ cf2Template (templateFileM opts) absMod cf mkfile (printerFile opts) $ cf2Printer StringToken False True prMod absMod cf when (hasLayout cf) $ mkfile (layoutFile opts) $- cf2Layout (tokenText opts) (alexMode opts == Alex1) layMod lexMod cf+ cf2Layout (tokenText opts) layMod lexMod cf mkfile (tFile opts) $ Haskell.testfile opts cf mkfile (errFile opts) $ mkErrM errMod- when (shareStrings opts) $ mkfile (shareFile opts) $ sharedString shareMod (tokenText opts) cf Makefile.mkMakefile opts $ Haskell.makefile opts case xml opts of 2 -> makeXML opts True cf
src/BNFC/Backend/HaskellGADT/CFtoAbstractGADT.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: GADT Abstract syntax Generator- Copyright (C) 2004-2005 Author: Markus Forberg, Björn Bringert-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004-2005 Author: Markus Forsberg, Björn Bringert - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE PatternGuards #-}
src/BNFC/Backend/HaskellGADT/CFtoTemplateGADT.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: GADT Template Generator- Copyright (C) 2004-2005 Author: Markus Forberg, Björn Bringert-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004-2005 Author: Markus Forsberg, Björn Bringert - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -}
src/BNFC/Backend/HaskellGADT/HaskellGADTCommon.hs view
@@ -1,20 +1,7 @@ {- BNF Converter: Haskell GADT back-end common stuff - Copyright (C) 2004-2005 Author: Markus Forberg, Björn Bringert - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + Copyright (C) 2004-2005 Author: Markus Forsberg, Björn Bringert - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.HaskellGADT.HaskellGADTCommon (Constructor(..), cf2cons, isTreeType) where
− src/BNFC/Backend/HaskellProfile.hs
@@ -1,204 +0,0 @@-{-- BNF Converter: Haskell main file- Copyright (C) 2004 Author: Markus Forberg, Peter Gammie, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--module BNFC.Backend.HaskellProfile (makeHaskellProfile) where--import Control.Monad (when)-import Data.Maybe (isJust)--import BNFC.CF-import BNFC.Options hiding (Backend)-import BNFC.Backend.Base-import BNFC.Backend.HaskellProfile.CFtoHappyProfile-import BNFC.Backend.Haskell.CFtoAlex-import BNFC.Backend.Haskell.CFtoAlex2-import BNFC.Backend.Haskell.CFtoAlex3-import BNFC.Backend.Haskell.MkErrM---- naming conventions--nameMod :: String -> Bool -> String -> FilePath-nameMod name inDir lang =- if inDir- then lang ++ "." ++ name- else name ++ lang--nameFile :: String -> String -> Bool -> String -> FilePath-nameFile name ext inDir lang =- if inDir- then lang ++ "/" ++ name ++ "." ++ ext- else name ++ lang ++ "." ++ ext--absFileM, alexFile, alexFileM, happyFile, happyFileM, errFile, errFileM, tFile,- mFile :: Bool -> String -> FilePath-absFileM = nameMod "Abs"-alexFile = nameFile "Lex" "x"-alexFileM = nameMod "Lex"-happyFile = nameFile "Par" "y"-happyFileM = nameMod "Par"-tFile = nameFile "Test" "hs"-mFile inDir n = if inDir then n ++ "/" ++ "Makefile" else "Makefile"-errFile b n = if b then n ++ "/" ++ "ErrM.hs" else "ErrM.hs"-errFileM b n = if b then n ++ "." ++ "ErrM" else "ErrM"--makeHaskellProfile :: SharedOptions -> CFP -> Backend-makeHaskellProfile opts cfp = do- let absMod = absFileM (inDir opts) name- lexMod = alexFileM (inDir opts) name- parMod = happyFileM (inDir opts) name- errMod = errFileM (inDir opts) name- let cf = cfp2cf cfp- do----- mkfile (absFile (inDir opts) name) $ cf2Abstract (absFileM (inDir opts) name) cf- case alexMode opts of- Alex1 -> do- mkfile (alexFile (inDir opts) name) $ cf2alex lexMod cf- liftIO $ putStrLn " (Use Alex 1.1 to compile.)"- Alex2 -> do- mkfile (alexFile (inDir opts) name) $ cf2alex2 lexMod "" False StringToken cf- liftIO $ putStrLn " (Use Alex 2 to compile.)"- Alex3 -> do- mkfile (alexFile (inDir opts) name) $ cf2alex3 lexMod "" False StringToken cf- liftIO $ putStrLn " (Use Alex 3 to compile.)"- mkfile (happyFile (inDir opts) name) $- cf2HappyProfileS parMod absMod lexMod cfp- liftIO $ putStrLn " (Tested with Happy 1.13)"----- mkfile (templateFile (inDir opts) name) $----- cf2Template tplMod absMod errMod cf----- mkfile (printerFile (inDir opts) name) $ cf2Printer prMod absMod cf----- if hasLayout cf then----- mkfile (layoutFile (inDir opts) name) $ cf2Layout alex1 (inDir opts) layMod lexMod cf----- else return ()- mkfile (tFile (inDir opts) name) $ testfile (inDir opts) name (xml opts>0) cf- mkfile (errFile (inDir opts) name) $ mkErrM errMod- when (isJust $ make opts)- (mkfile (mFile (inDir opts) name) $ makefile (inDir opts) name)----- case xml of----- 2 -> makeXML name True cf----- 1 -> makeXML name False cf----- _ -> return ()- where name = lang opts--makefile :: Bool -> String -> String-makefile inDir name = makeA where- name' = if inDir then "" else name -- Makefile is inDir- ghcCommand = "ghc --make "++ tFile inDir name ++ " -o " ++- if inDir then name ++ "/" ++ "Test" else "Test" ++ name- makeA = unlines- [- "all:",- "\thappy -gca " ++ happyFile False name',- "\talex " ++ alexFile False name',- '\t' : if inDir then- "(" ++ "cd ..; " ++ ghcCommand ++ ")"- else ghcCommand,- "clean:",- "\t rm -f *.hi *.o",- "distclean: " ++ if inDir then "" else "clean",- if inDir then- "\t rm -rf ../" ++ name -- erase this directory!- else- "\t rm -f " ++ unwords [- "Doc" ++ name ++ ".*",- "Lex" ++ name ++ ".*",- "Par" ++ name ++ ".*",----- "Layout" ++ name ++ ".*",----- "Skel" ++ name ++ ".*",----- "Print" ++ name ++ ".*",- "Test" ++ name ++ ".*",----- "Abs" ++ name ++ ".*",- "Test" ++ name,- "ErrM.*",----- name ++ ".dtd",----- "XML" ++ name ++ ".*",- "Makefile*"- ]- ]---testfile :: Bool -> String -> Bool -> CF -> String-testfile inDir name _ cf = unlines- ["-- automatically generated by BNF Converter",- "module Main where\n",- "",- "import Trees",- "import Profile",- "import System.IO ( stdin, hGetContents )",- "import System.Environment ( getArgs, getProgName )",- "import System.Exit ( exitFailure )",- "",- "import " ++ alexFileM inDir name,- "import " ++ happyFileM inDir name,----- "import " ++ templateFileM inDir name,----- "import " ++ printerFileM inDir name,----- "import " ++ absFileM inDir name,----- if lay then ("import " ++ layoutFileM inDir name) else "",----- if xml then ("import " ++ xmlFileM inDir name) else "",----- "import " ++ errFileM inDir name,- "",- "type ParseFun = [Token] -> Either String CFTree",- "",- "myLLexer = " ++ if lay then "resolveLayout True . myLexer"- else "myLexer",- "",- "runFile :: ParseFun -> FilePath -> IO ()",- "runFile p f = readFile f >>= run p",- "",- "run :: ParseFun -> String -> IO ()",- "run p s = do",- " let ts = myLLexer s",- " let etree = p ts",- " case etree of",- " Right tree -> do",- " case postParse tree of",- " Left s -> do",- " putStrLn \"\\nParse Failed... CFTree:\\n\"",- " putStrLn $ prCFTree tree",- " putStrLn s",- " Right tree -> do",- " putStrLn \"\\nParse Successful!\"",- " putStrLn $ \"\\n[Abstract Syntax]\\n\\n\" ++ prt tree",- " Left s -> do",- " putStrLn s",- " putStrLn \"\\nParse failed... tokenization:\"",- " print ts",- "",- "usage :: IO ()",- "usage = do",- " putStrLn $ unlines",- " [ \"usage: Call with one of the following argument combinations:\"",- " , \" --help Display this help message.\"",- " , \" (no arguments) Parse stdin.\"",- " , \" (file) Parse content of file.\"",- " ]",- " exitFailure",- "",- "main :: IO ()",- "main = do",- " args <- getArgs",- " case args of",- " [\"--help\"] -> usage",- " [] -> hGetContents stdin >>= run " ++ firstParser,- " [f] -> runFile " ++ firstParser ++ " f",- " _ -> do progName <- getProgName",- " putStrLn $ progName ++ \": excess arguments.\""- ]- where- firstParser = 'p' : identCat (firstEntry cf)- lay = hasLayout cf
− src/BNFC/Backend/HaskellProfile/CFtoHappyProfile.hs
@@ -1,190 +0,0 @@-{-- BNF Converter: Happy Generator- Copyright (C) 2004 Author: Markus Forberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--module BNFC.Backend.HaskellProfile.CFtoHappyProfile (cf2HappyProfileS) where--import Data.List (intersperse)--import BNFC.CF-import BNFC.Utils (for)---- Type declarations--type Rules = [(NonTerminal,[(Pattern,Action)])]-type Pattern = String-type Action = String-type MetaVar = String---- default naming--tokenName = "Token"---- The main function, that given a CF and a CFCat to parse according to,--- generates a happy module.-cf2HappyProfileS :: String -> String -> String -> CFP -> String-cf2HappyProfileS = cf2Happy--cf2Happy :: String -> String -> String -> CFP -> String-cf2Happy name absName lexName cf- = unlines- [header name absName lexName,- declarations (allEntryPoints cf),- tokens (cfgSymbols cf ++ reservedWords cf),- specialToks cf,- delimiter,- specialRules cf,- prRules (rulesForHappy cf),- finalize cf]---- construct the header.-header :: String -> String -> String -> String-header modName _ lexName = unlines- [ "-- This Happy file was machine-generated by the BNF converter"- , "{"- , "module " ++ modName ++ " where"- , "import Trees"- , "import " ++ lexName- , "}"- ]----- The declarations of a happy file.-declarations :: [Cat] -> String-declarations ns = unlines- [ generateP ns- , "%monad { Either String } { (>>=) } { return }"- , "%tokentype { " ++ tokenName ++ " }"- ]- where- generateP [] = []- generateP (n:ns) = concat [ "%name p", n', " ", n', "\n", generateP ns ]- where n' = identCat n---- The useless delimiter symbol.-delimiter :: String-delimiter = "\n%%\n"---- Generate the list of tokens and their identifiers.-tokens :: [String] -> String-tokens toks = "%token \n" ++ prTokens toks- where prTokens [] = []- prTokens (t:tk) = " " ++ convert t ++- " { " ++ oneTok t ++ " }\n" ++- prTokens tk- oneTok t = "PT _ (TS " ++ show t ++ ")"---- Happy doesn't allow characters such as åäö to occur in the happy file. This--- is however not a restriction, just a naming paradigm in the happy source file.-convert :: String -> String-convert "\\" = "'" ++ "\\\\" ++ "'"-convert xs = "'" ++ escape xs ++ "'"- where escape [] = []- escape ('\'':xs) = '\\':'\'':escape xs- escape (x:xs) = x:escape xs--rulesForHappy :: CFP -> Rules-rulesForHappy cf = for (ruleGroupsP cf) $ \ (cat,rules) ->- (cat, constructRule cf rules cat)---- For every non-terminal, we construct a set of rules. A rule is a sequence of--- terminals and non-terminals, and an action to be performed.-constructRule :: CFP -> [RuleP] -> NonTerminal -> [(Pattern,Action)]-constructRule cf rules nt =- [ (p, generateAction nt (funRule r) m)- | r <- rules- , let (p, m) = generatePatterns cf r- ]---- Generates a string containing the semantic action.--- An action can for example be: Sum $1 $2, that is, construct an AST--- with the constructor Sum applied to the two metavariables $1 and $2.-generateAction :: NonTerminal -> FunP -> [MetaVar] -> Action-generateAction _ (_,(h,p)) ms = unwords (if isCoercion h then args else fun ++ mss)- where- fun = ["mkFunTree",show h,show p]- mss = ["["] ++ intersperse "," ms ++ ["]"]- args = intersperse "," ms---- Generate patterns and a set of metavariables indicating--- where in the pattern the non-terminal--generatePatterns :: CFP -> RuleP -> (Pattern,[MetaVar])-generatePatterns _cf r = case rhsRule r of- [] -> ("{- empty -}",[])- its -> (unwords (map mkIt its), metas its)- where- mkIt i = case i of- Left c -> identCat c- Right s -> convert s- metas its = [ ('$': show i) | (i, Left _c) <- zip [1 ::Int ..] its ]---- We have now constructed the patterns and actions,--- so the only thing left is to merge them into one string.--prRules :: Rules -> String-prRules = unlines . map prOne- where- prOne (_,[]) = [] -- nt has only internal use- prOne (nt,(p,a):ls) =- unwords [nt', "::", "{", "CFTree", "}\n" ++- nt', ":" , p, "{", a, "}", '\n' : pr ls] ++ "\n"- where- nt' = identCat nt- pr [] = []- pr ((p,a):ls) =- unlines [unwords [" |", p, "{", a , "}"]] ++ pr ls---- Finally, some haskell code.--finalize :: CFP -> String-finalize _ = unlines- [- "{",- "\nhappyError :: [" ++ tokenName ++ "] -> Either String a",- "happyError ts = Left $",- " \"syntax error at \" ++ tokenPos ts ++ " ++- "if null ts then [] else " ++- "(\" before \" ++ " ++ "unwords (map prToken (take 4 ts)))",- "\nmyLexer = tokens",- "}"- ]---- aarne's modifs 8/1/2002:--- Markus's modifs 11/02/2002---- GF literals-specialToks :: CFP -> String-specialToks cf = unlines . (`map` literals cf) $ \case- "Ident" -> "L_ident { PT _ (TV $$) }"- "String" -> "L_quoted { PT _ (TL $$) }"- "Integer" -> "L_integ { PT _ (TI $$) }"- "Double" -> "L_doubl { PT _ (TD $$) }"- "Char" -> "L_charac { PT _ (TC $$) }"- own -> "L_" ++ own ++ " { PT _ (T_" ++ own ++ " " ++ posn ++ ") }"- where posn = if isPositionCat cf own then "_" else "$$"--specialRules :: CFP -> String-specialRules cf = unlines . (`map` literals cf) $ \case- "Ident" -> "Ident : L_ident { mkAtTree (AV (Ident $1)) }"- "String" -> "String : L_quoted { mkAtTree (AS $1) }"- "Integer" -> "Integer : L_integ { mkAtTree (AI ((read $1) :: Integer)) }"- "Double" -> "Double : L_doubl { (read $1) :: Double }"- "Char" -> "Char : L_charac { (read $1) :: Char }"- own -> concat [ own , " : L_" , own , " { " , own , " (" , posn , "$1)}" ]- where posn = if isPositionCat cf own then "mkPosToken " else ""
src/BNFC/Backend/Java.hs view
@@ -5,26 +5,12 @@ Copyright (C) 2004 Author: Markus Forsberg, Peter Gammie, Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} ------------------------------------------------------------------- -- | -- Module : JavaTop -- Copyright : (C)opyright 2003, {markus, aarne, pellauer, peteg, bringert} at cs dot chalmers dot se--- License : GPL (see COPYING for details) -- -- Maintainer : {markus, aarne} at cs dot chalmers dot se -- Stability : alpha@@ -40,6 +26,7 @@ import Prelude hiding ((<>)) import System.FilePath (pathSeparator, isPathSeparator)+import Data.Foldable (toList) import Data.List ( intersperse ) import BNFC.Utils@@ -651,7 +638,7 @@ px = text parser dat = text $ identCat $ normCat def -- Use for AST types. absentity = text $ identCat def -- Use for parser/printer name.- eps = allEntryPoints cf+ eps = toList $ allEntryPoints cf def = head eps -- | Error handling in ANTLR.
src/BNFC/Backend/Java/CFtoAbstractVisitor.hs view
@@ -3,19 +3,6 @@ Copyright (C) 2006 Bjorn Bringert Based on CFtoVisitSkel.hs, Copyright (C) 2004-2006 Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Java.CFtoAbstractVisitor (cf2AbstractVisitor) where
src/BNFC/Backend/Java/CFtoAllVisitor.hs view
@@ -3,19 +3,6 @@ Copyright (C) 2006 Bjorn Bringert Based on CFtoVisitSkel.hs, Copyright (C) 2004-2006 Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Java.CFtoAllVisitor (cf2AllVisitor) where
src/BNFC/Backend/Java/CFtoAntlr4Lexer.hs view
@@ -1,41 +1,16 @@ {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-} {- BNF Converter: Java Antlr4 Lexer generator Copyright (C) 2015 Author: Gabriele Paganelli - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the Antlr4 input file. Based on CFtoJLex15.hs Author : Gabriele Paganelli (gapag@distruzione.org)-- License : GPL (GNU General Public License)- Created : 15 Oct, 2015 - Modified :--- ************************************************************** -} module BNFC.Backend.Java.CFtoAntlr4Lexer ( cf2AntlrLex ) where@@ -91,7 +66,7 @@ where frg a = "fragment" <+> a <+> ";" escapeChars :: String -> String-escapeChars = concatMap escapeChar+escapeChars = concatMap escapeCharInSingleQuotes -- | -- >>> lexSymbols [("foo","bar")]@@ -154,7 +129,7 @@ , "mode STRINGMODE;" , "STRINGESC : '\\\\' -> more , pushMode(STRESCAPE);" , "STRINGEND : '\"' -> type(STRING), mode(DEFAULT_MODE);"- , "STRINGTEXT : ~[\\\"\\\\] -> more;"+ , "STRINGTEXT : ~[\"\\\\] -> more;" ] charmodes = [ "mode CHARMODE;" , "CHARANY : ~[\\'\\\\] -> more, mode(CHAREND);"
src/BNFC/Backend/Java/CFtoAntlr4Parser.hs view
@@ -3,45 +3,19 @@ Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the ANTLR .g4 input file. It follows the same basic structure of CFtoHappy. - Author : Gabriele Paganelli (gapag@distruzione.org),--- License : GPL (GNU General Public License)-+ Author : Gabriele Paganelli (gapag@distruzione.org) Created : 15 Oct, 2015 - Modified :--- ************************************************************** -} {-# LANGUAGE LambdaCase #-} module BNFC.Backend.Java.CFtoAntlr4Parser ( cf2AntlrParse ) where +import Data.Foldable ( toList ) import Data.List ( intercalate ) import Data.Maybe @@ -84,7 +58,7 @@ , "" -- Generate start rules [#272] -- _X returns [ dX result ] : x=X EOF { $result = $x.result; }- , prRules packageAbsyn $ map entrypoint $ allEntryPoints cf+ , prRules packageAbsyn $ map entrypoint $ toList $ allEntryPoints cf -- Generate regular rules , prRules packageAbsyn $ rulesForAntlr4 packageAbsyn cf env ]
src/BNFC/Backend/Java/CFtoComposVisitor.hs view
@@ -3,19 +3,6 @@ Copyright (C) 2006 Bjorn Bringert Based on CFtoVisitSkel.hs, Copyright (C) 2004-2006 Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE OverloadedStrings #-}
src/BNFC/Backend/Java/CFtoCup15.hs view
@@ -3,40 +3,17 @@ Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the CUP input file. It follows the same basic structure of CFtoHappy. - Author : Michael Pellauer (pellauer@cs.chalmers.se),- Bjorn Bringert (bringert@cs.chalmers.se)-- License : GPL (GNU General Public License)+ Author : Michael Pellauer+ Bjorn Bringert Created : 26 April, 2003- Modified : 5 Aug, 2004 -- ************************************************************** -}+ module BNFC.Backend.Java.CFtoCup15 ( cf2Cup, definedRules ) where import BNFC.CF
src/BNFC/Backend/Java/CFtoFoldVisitor.hs view
@@ -3,19 +3,6 @@ Copyright (C) 2006 Bjorn Bringert Based on CFtoVisitSkel.hs, Copyright (C) 2004-2006 Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE OverloadedStrings #-}
src/BNFC/Backend/Java/CFtoJLex15.hs view
@@ -4,39 +4,15 @@ BNF Converter: Java JLex generator Copyright (C) 2004 Author: Michael Pellauer - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the JLex input file. This file is quite different than Alex or Flex. - Author : Michael Pellauer (pellauer@cs.chalmers.se),- Bjorn Bringert (bringert@cs.chalmers.se)-- License : GPL (GNU General Public License)+ Author : Michael Pellauer+ Bjorn Bringert Created : 25 April, 2003- Modified : 4 Nov, 2004 -- ************************************************************** -} module BNFC.Backend.Java.CFtoJLex15 ( cf2jlex ) where
src/BNFC/Backend/Java/CFtoJavaAbs15.hs view
@@ -6,25 +6,6 @@ BNF Converter: Java 1.5 Abstract Syntax Copyright (C) 2004 Author: Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates the Java Abstract Syntax It uses the BNFC.Backend.Common.NamedVariables module for variable naming. It returns a list of file names, and the@@ -34,17 +15,11 @@ The generated classes also support the Visitor Design Pattern. - Author : Michael Pellauer (pellauer@cs.chalmers.se),- Bjorn Bringert (bringert@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer+ Bjorn Bringert Created : 24 April, 2003- Modified : 16 June, 2004 -- ************************************************************** -} module BNFC.Backend.Java.CFtoJavaAbs15 (cf2JavaAbs, typename, cat2JavaType) where
src/BNFC/Backend/Java/CFtoJavaPrinter15.hs view
@@ -5,26 +5,6 @@ BNF Converter: Java Pretty Printer generator Copyright (C) 2004 Author: Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---{-- **************************************************************- BNF Converter Module- Description : This module generates the Java Pretty Printer class. In addition, since there's no good way to display a class heirarchy (toString() doesn't@@ -38,15 +18,13 @@ Author : Michael Pellauer (pellauer@cs.chalmers.se), Bjorn Bringert (bringert@cs.chalmers.se) - License : GPL (GNU General Public License)- Created : 24 April, 2003 Modified : 9 Aug, 2004- Added string buffer for efficiency (Michael, August 03)- **************************************************************+ -}+ module BNFC.Backend.Java.CFtoJavaPrinter15 ( cf2JavaPrinter ) where import Prelude hiding ((<>))
src/BNFC/Backend/Java/CFtoVisitSkel15.hs view
@@ -2,41 +2,16 @@ BNF Converter: Java Vistor skeleton generator Copyright (C) 2004 Author: Michael Pellauer, Bjorn Bringert - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-- **************************************************************- BNF Converter Module- Description : This module generates a Skeleton function which uses the Visitor Design Pattern, which users may find more familiar than Appel's method. - Author : Michael Pellauer (pellauer@cs.chalmers.se),- Bjorn Bringert (bringert@cs.chalmers.se)-- License : GPL (GNU General Public License)-+ Author : Michael Pellauer+ Bjorn Bringert Created : 4 August, 2003- Modified : 16 June, 2004 -- ************************************************************** -} {-# LANGUAGE LambdaCase #-}
src/BNFC/Backend/Java/RegToAntlrLexer.hs view
@@ -1,10 +1,11 @@-module BNFC.Backend.Java.RegToAntlrLexer (printRegJLex, escapeChar) where+module BNFC.Backend.Java.RegToAntlrLexer (printRegJLex, escapeCharInSingleQuotes) where -- modified from RegToJLex.hs import Data.Char (ord, showLitChar)+import Numeric (showHex) -import AbsBNF+import BNFC.Abs -- the top-level printing method printRegJLex :: Reg -> String@@ -31,26 +32,31 @@ -- the printer class does the job class Print a where prt :: Int -> a -> [String]- prtList :: [a] -> [String]- prtList = concatMap (prt 0) -instance Print a => Print [a] where- prt _ = prtList--instance Print Char where- prt _ c = [escapeChar c]- prtList = map (concat . prt 0)--escapeChar :: Char -> String-escapeChar x+-- | Print char according to ANTLR regex format.+escapeChar :: String -> Char -> String+escapeChar reserved x | x `elem` reserved = '\\' : [x]- | ord x >= 256 = [x]+ | ord x >= 65536 = "\\u{" ++ h ++ "}"+ | ord x >= 256 = "\\u" ++ replicate (4 - length h) '0' ++ h | otherwise = showLitChar x ""+ where+ h = showHex (ord x) "" --- Characters that must be escaped in ANTLR regular expressions-reserved :: [Char]-reserved = ['\'','\\']+-- | Escape character for use inside single quotes.+escapeCharInSingleQuotes :: Char -> String+escapeCharInSingleQuotes = escapeChar ['\'','\\'] +-- The ANTLR definition of what can be in a [char set] is here:+-- https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md#lexer-rule-elements+-- > The following escaped characters are interpreted as single special characters:+-- > \n, \r, \b, \t, \f, \uXXXX, and \u{XXXXXX}.+-- > To get ], \, or - you must escape them with \.++-- | Escape character for use inside @[char set]@.+escapeInCharSet :: Char -> String+escapeInCharSet = escapeChar [ ']', '\\', '-' ]+ prPrec :: Int -> Int -> [String] -> [String] prPrec i j = if j<i then parenth else id @@ -60,26 +66,24 @@ instance Print Reg where prt i e = case e of RSeq reg0 reg- -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg])+ -> prPrec i 2 (concat [prt 2 reg0 , [" "], prt 3 reg]) RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg])- -- JLex does not support set difference- --RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg]) RMinus reg0 REps -> prt i reg0 -- REps is identity for set difference- RMinus RAny reg@(RChar _)- -> prPrec i 3 (concat [["~["],prt 0 reg,["]"]])+ RMinus RAny (RChar c)+ -> ["~'", escapeCharInSingleQuotes c, "'"] RMinus RAny (RAlts str)- -> prPrec i 3 (concat [["~["],prt 0 str,["]"]])+ -> concat [["~["], map escapeInCharSet str ,["]"]] RMinus _ _ -> error "Antlr does not support general set difference"- RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]])- RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]])- ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]])- REps -> prPrec i 3 [""]- RChar c -> prPrec i 3 (concat [["'"], prt 0 c, ["'"]])- RAlts str -> prPrec i 3 (concat [["["],prt 0 str,["]"]])+ RStar reg -> concat [prt 3 reg , ["*"]]+ RPlus reg -> concat [prt 3 reg , ["+"]]+ ROpt reg -> concat [prt 3 reg , ["?"]]+ REps -> [""]+ RChar c -> ["'", escapeCharInSingleQuotes c, "'"]+ RAlts str -> concat [ ["["], map escapeInCharSet str, ["]"] ] RSeqs str -> prPrec i 2 $ map show str- RDigit -> prPrec i 3 ["DIGIT"]- RLetter -> prPrec i 3 ["LETTER"]- RUpper -> prPrec i 3 ["CAPITAL"]- RLower -> prPrec i 3 ["SMALL"]- RAny -> prPrec i 3 ["[\\u0000-\\u00FF]"]+ RDigit -> ["DIGIT"]+ RLetter -> ["LETTER"]+ RUpper -> ["CAPITAL"]+ RLower -> ["SMALL"]+ RAny -> ["[\\u0000-\\u00FF]"]
src/BNFC/Backend/Java/RegToJLex.hs view
@@ -2,7 +2,7 @@ import Data.Char (ord, showLitChar) -import AbsBNF (Identifier(..), Reg(..))+import BNFC.Abs (Identifier(..), Reg(..)) import BNFC.Options (JavaLexerParser(..)) import BNFC.Backend.Common (flexEps)
src/BNFC/Backend/Latex.hs view
@@ -1,38 +1,24 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+ {- BNF Converter: Latex Generator- Copyright (C) 2004 Author: Markus Forberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg, Aarne Ranta - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -}+ module BNFC.Backend.Latex where -import Data.List-#if !(MIN_VERSION_base(4,8,0))-import Data.Monoid-#endif+import qualified Data.List as List import System.FilePath ((<.>),replaceExtension) import Text.Printf -import AbsBNF (Reg (..))+import BNFC.Abs (Reg (..)) import BNFC.Options hiding (Backend) import BNFC.Backend.Base import BNFC.Backend.Common.Makefile as Makefile import BNFC.CF import BNFC.Utils-import BNFC.PrettyPrint hiding ((<.>), empty)+import BNFC.PrettyPrint hiding (empty) -- | Entry point: create .tex file and a Makefile to compile it. makeLatex :: SharedOptions -> CF -> Backend@@ -123,7 +109,7 @@ prtLiterals :: String -> CF -> String prtLiterals _ cf =- unlines . concat . intersperse [""] . map stringLit . filter (/= catIdent) $ literals cf+ unlines . concat . List.intersperse [""] . map stringLit . filter (/= catIdent) $ literals cf stringLit :: TokenCat -> [String] stringLit = \case@@ -165,8 +151,8 @@ then "There are no multiple-line comments in the grammar." else "Multiple-line comments are enclosed with " ++ mult ++".") where- sing = intercalate ", " $ map (symbol.prt) ys- mult = intercalate ", " $+ sing = List.intercalate ", " $ map (symbol.prt) ys+ mult = List.intercalate ", " $ map (\(x,y) -> symbol (prt x) ++ " and " ++ symbol (prt y)) xs
src/BNFC/Backend/OCaml.hs view
@@ -2,19 +2,6 @@ BNF Converter: OCaml main file Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- based on BNFC Haskell backend@@ -45,21 +32,26 @@ noLang _ name = name withLang :: SharedOptions -> String -> String-withLang opts name = name ++ lang opts+withLang opts name = name ++ sanitizedLang opts mkMod :: (SharedOptions -> String -> String) -> String -> SharedOptions -> String mkMod addLang name opts =- pref ++ if inDir opts then lang opts ++ "." ++ name else addLang opts name+ pref ++ if inDir opts then sanitizedLang opts ++ "." ++ name else addLang opts name where pref = maybe "" (++".") (inPackage opts) mkFile :: (SharedOptions -> String -> String) -> String -> String -> SharedOptions -> FilePath mkFile addLang name ext opts = pref ++ if inDir opts- then lang opts </> name ++ ext'+ then sanitizedLang opts </> name ++ ext' else addLang opts name ++ if null ext then "" else ext' where pref = maybe "" (\ p -> pkgToDir p </> "") (inPackage opts) ext' = if null ext then "" else "." ++ ext +-- | Turn language name into a valid ocaml module identifier.+sanitizedLang :: SharedOptions -> String+sanitizedLang = camelCase_ . lang++ absFile, absFileM, ocamllexFile, ocamllexFileM, ocamlyaccFile, ocamlyaccFileM, utilFile, templateFile, templateFileM, printerFile, printerFileM, tFile :: SharedOptions -> String@@ -106,7 +98,7 @@ codeDir :: SharedOptions -> FilePath codeDir opts = let pref = maybe "" pkgToDir (inPackage opts)- dir = if inDir opts then lang opts else ""+ dir = if inDir opts then sanitizedLang opts else "" sep = if null pref || null dir then "" else [pathSeparator] in pref ++ sep ++ dir
src/BNFC/Backend/OCaml/CFtoOCamlAbs.hs view
@@ -2,19 +2,6 @@ BNF Converter: OCaml Abstract Syntax Generator Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- based on BNFC Haskell backend
src/BNFC/Backend/OCaml/CFtoOCamlLex.hs view
@@ -4,19 +4,6 @@ BNF Converter: ocamllex Generator Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} @@ -26,11 +13,12 @@ import Prelude hiding ((<>)) +import Data.Char (ord) import qualified Data.List as List import Text.PrettyPrint hiding (render) import qualified Text.PrettyPrint as PP -import AbsBNF+import BNFC.Abs import BNFC.CF import BNFC.Backend.Common (asciiKeywords, unicodeAndSymbols) import BNFC.Backend.OCaml.CFtoOCamlYacc (terminal)@@ -47,51 +35,56 @@ ] header :: String -> CF -> [String]-header parserMod cf = [- "(* This ocamllex file was machine-generated by the BNF converter *)",- "{",- "open " ++ parserMod,- "open Lexing",- "",- hashtables cf,- "",- "let unescapeInitTail (s:string) : string =",- " let rec unesc s = match s with",- " '\\\\'::c::cs when List.mem c ['\\\"'; '\\\\'; '\\\''] -> c :: unesc cs",- " | '\\\\'::'n'::cs -> '\\n' :: unesc cs",- " | '\\\\'::'t'::cs -> '\\t' :: unesc cs",- " | '\\\\'::'r'::cs -> '\\r' :: unesc cs",- -- " | '\\\\'::'f'::cs -> '\\f' :: unesc cs", -- \f not supported by ocaml- " | '\\\"'::[] -> []",- " | c::cs -> c :: unesc cs",- " | _ -> []",- " (* explode/implode from caml FAQ *)",- " in let explode (s : string) : char list =",- " let rec exp i l =",- " if i < 0 then l else exp (i - 1) (s.[i] :: l) in",- " exp (String.length s - 1) []",- " in let implode (l : char list) : string =",- " let res = Buffer.create (List.length l) in",- " List.iter (Buffer.add_char res) l;",- " Buffer.contents res",- " in implode (unesc (List.tl (explode s)))",- "",- "let incr_lineno (lexbuf:Lexing.lexbuf) : unit =",- " let pos = lexbuf.lex_curr_p in",- " lexbuf.lex_curr_p <- { pos with",- " pos_lnum = pos.pos_lnum + 1;",- " pos_bol = pos.pos_cnum;",- " }",- "}"+header parserMod cf = List.intercalate [""] . filter (not . null) $ concat+ [ [ [ "(* This ocamllex file was machine-generated by the BNF converter *)"+ , ""+ , "(* preamble *)"+ , "{"+ , "open " ++ parserMod+ , "open Lexing"+ ]+ ]+ , hashtables cf+ , [ [ "let unescapeInitTail (s:string) : string ="+ , " let rec unesc s = match s with"+ , " '\\\\'::c::cs when List.mem c ['\\\"'; '\\\\'; '\\\''] -> c :: unesc cs"+ , " | '\\\\'::'n'::cs -> '\\n' :: unesc cs"+ , " | '\\\\'::'t'::cs -> '\\t' :: unesc cs"+ , " | '\\\\'::'r'::cs -> '\\r' :: unesc cs"+ -- " | '\\\\'::'f'::cs -> '\\f' :: unesc cs", -- \f not supported by ocaml+ , " | '\\\"'::[] -> []"+ , " | c::cs -> c :: unesc cs"+ , " | _ -> []"+ , " (* explode/implode from caml FAQ *)"+ , " in let explode (s : string) : char list ="+ , " let rec exp i l ="+ , " if i < 0 then l else exp (i - 1) (s.[i] :: l) in"+ , " exp (String.length s - 1) []"+ , " in let implode (l : char list) : string ="+ , " let res = Buffer.create (List.length l) in"+ , " List.iter (Buffer.add_char res) l;"+ , " Buffer.contents res"+ , " in implode (unesc (List.tl (explode s)))"+ , ""+ , "let incr_lineno (lexbuf:Lexing.lexbuf) : unit ="+ , " let pos = lexbuf.lex_curr_p in"+ , " lexbuf.lex_curr_p <- { pos with"+ , " pos_lnum = pos.pos_lnum + 1;"+ , " pos_bol = pos.pos_cnum;"+ , " }"+ , "}"+ ]+ ] ] --- | set up hashtables for reserved symbols and words-hashtables :: CF -> String-hashtables cf = unlines . concat $+-- | Set up hashtables for reserved symbols and words.+hashtables :: CF -> [[String]]+hashtables cf = [ ht "symbol_table" $ unicodeAndSymbols cf , ht "resword_table" $ asciiKeywords cf ] where+ ht :: String -> [String] -> [String] ht table syms = unless (null syms) $ [ unwords [ "let", table, "= Hashtbl.create", show (length syms) ] , unwords [ "let _ = List.iter (fun (kwd, tok) -> Hashtbl.add", table, "kwd tok)" ]@@ -109,27 +102,30 @@ ] cMacros :: [String]-cMacros = [- "let l = ['a'-'z' 'A'-'Z' '\\192' - '\\255'] # ['\\215' '\\247'] (* isolatin1 letter FIXME *)",- "let c = ['A'-'Z' '\\192'-'\\221'] # ['\\215'] (* capital isolatin1 letter FIXME *)",- "let s = ['a'-'z' '\\222'-'\\255'] # ['\\247'] (* small isolatin1 letter FIXME *)",- "let d = ['0'-'9'] (* digit *)",- "let i = l | d | ['_' '\\''] (* identifier character *)",- "let u = _ (* universal: any character *)"+cMacros =+ [ "(* BNFC character classes *)"+ , "let _letter = ['a'-'z' 'A'-'Z' '\\192' - '\\255'] # ['\\215' '\\247'] (* isolatin1 letter FIXME *)"+ , "let _upper = ['A'-'Z' '\\192'-'\\221'] # '\\215' (* capital isolatin1 letter FIXME *)"+ , "let _lower = ['a'-'z' '\\222'-'\\255'] # '\\247' (* small isolatin1 letter FIXME *)"+ , "let _digit = ['0'-'9'] (* _digit *)"+ , "let _idchar = _letter | _digit | ['_' '\\''] (* identifier character *)"+ , "let _universal = _ (* universal: any character *)"+ , "" ] rMacros :: CF -> [String] rMacros cf | null symbs = [] | otherwise =- [ "let rsyms = (* reserved words consisting of special symbols *)"- , " " ++ unwords (List.intersperse "|" (map mkEsc symbs))+ [ "(* reserved words consisting of special symbols *)"+ , unwords $ "let rsyms =" : List.intersperse "|" (map mkEsc symbs) ] where symbs = unicodeAndSymbols cf -- user macros, derived from the user-defined tokens uMacros :: CF -> [String]-uMacros cf = ["let " ++ name ++ " = " ++ rep | (name, rep, _, _) <- userTokens cf]+uMacros cf = if null res then [] else "(* user-defined token types *)" : res+ where res = ["let " ++ name ++ " = " ++ rep | (name, rep, _, _) <- userTokens cf] -- | Returns the tuple of @(reg_name, reg_representation, token_name, is_position_token)@. @@ -141,23 +137,27 @@ ] -- | Make OCamlLex rule--- >>> mkRule "token" [("REGEX1","ACTION1"),("REGEX2","ACTION2"),("...","...")]+-- >>> mkRule "token" [("REGEX1","ACTION1"),("REGULAREXPRESSION2","ACTION2"),("...","...")]+-- (* lexing rules *) -- rule token =--- parse REGEX1 {ACTION1}--- | REGEX2 {ACTION2}--- | ... {...}+-- parse REGEX1 { ACTION1 }+-- | REGULAREXPRESSION2+-- { ACTION2 }+-- | ... { ... } -- -- If no regex are given, we dont create a lexer rule: -- >>> mkRule "empty" [] -- <BLANKLINE> mkRule :: Doc -> [(Doc,Doc)] -> Doc mkRule _ [] = empty-mkRule entrypoint (r1:rn) = vcat- [ "rule" <+> entrypoint <+> "="- , nest 2 $ hang "parse" 4 $ vcat- (nest 2 (mkOne r1):map (("|" <+>) . mkOne) rn) ]+mkRule entrypoint (r:rs) = vcat+ [ "(* lexing rules *)"+ , "rule" <+> entrypoint <+> "="+ , nest 2 $ hang "parse" 4 $ vcat $+ nest 2 (mkOne r) : map (("|" <+>) . mkOne) rs+ ] where- mkOne (regex, action) = regex <+> braces action+ mkOne (regex, action) = regex $$ nest 8 (hsep ["{", action, "}"]) -- | Create regex for single line comments -- >>> mkRegexSingleLineComment "--"@@ -169,10 +169,10 @@ -- | Create regex for multiline comments. -- >>> mkRegexMultilineComment "<!--" "-->"--- "<!--" (u # '-')* '-' ((u # '-')+ '-')* '-' ((u # ['-''>']) (u # '-')* '-' ((u # '-')+ '-')* '-' | '-')* '>'+-- "<!--" [^ '-']* '-' ([^ '-']+ '-')* '-' ([^ '-' '>'][^ '-']* '-' ([^ '-']+ '-')* '-' | '-')* '>' -- -- >>> mkRegexMultilineComment "\"'" "'\""--- "\"'" (u # '\'')* '\'' ((u # ['"''\'']) (u # '\'')* '\'' | '\'')* '"'+-- "\"'" [^ '\'']* '\'' ([^ '"' '\''][^ '\'']* '\'' | '\'')* '"' mkRegexMultilineComment :: String -> String -> Doc mkRegexMultilineComment b e = text $ printRegOCaml $ mkRegMultilineComment b e @@ -186,26 +186,26 @@ ++ -- reserved keywords [ ( "rsyms"- , "let id = lexeme lexbuf in try Hashtbl.find symbol_table id with Not_found -> failwith (\"internal lexer error: reserved symbol \" ^ id ^ \" not found in hashtable\")" )+ , "let x = lexeme lexbuf in try Hashtbl.find symbol_table x with Not_found -> failwith (\"internal lexer error: reserved symbol \" ^ x ^ \" not found in hashtable\")" ) | not (null (cfgSymbols cf))] ++ -- user tokens [ (text n , tokenAction pos (text t)) | (n,_,t,pos) <- userTokens cf] ++ -- predefined tokens- [ ( "l i*", tokenAction False "Ident" ) ]+ [ ( "_letter _idchar*", tokenAction False "Ident" ) ] ++ -- integers- [ ( "d+", "let i = lexeme lexbuf in TOK_Integer (int_of_string i)" )+ [ ( "_digit+", "TOK_Integer (int_of_string (lexeme lexbuf))" ) -- doubles- , ( "d+ '.' d+ ('e' ('-')? d+)?"- , "let f = lexeme lexbuf in TOK_Double (float_of_string f)" )+ , ( "_digit+ '.' _digit+ ('e' ('-')? _digit+)?"+ , "TOK_Double (float_of_string (lexeme lexbuf))" ) -- strings- , ( "'\\\"' ((u # ['\\\"' '\\\\' '\\n']) | ('\\\\' ('\\\"' | '\\\\' | '\\\'' | 'n' | 't' | 'r')))* '\\\"'"- , "let s = lexeme lexbuf in TOK_String (unescapeInitTail s)" )+ , ( "'\\\"' (([^ '\\\"' '\\\\' '\\n']) | ('\\\\' ('\\\"' | '\\\\' | '\\\'' | 'n' | 't' | 'r')))* '\\\"'"+ , "TOK_String (unescapeInitTail (lexeme lexbuf))" ) -- chars- , ( "'\\'' ((u # ['\\\'' '\\\\']) | ('\\\\' ('\\\\' | '\\\'' | 'n' | 't' | 'r'))) '\\\''"- , "let s = lexeme lexbuf in TOK_Char s.[1]")+ , ( "'\\'' (([^ '\\\'' '\\\\']) | ('\\\\' ('\\\\' | '\\\'' | 'n' | 't' | 'r'))) '\\\''"+ , "TOK_Char (lexeme lexbuf).[1]") -- spaces , ( "[' ' '\\t']", "token lexbuf") -- new lines@@ -216,14 +216,14 @@ where (multilineC, singleLineC) = comments cf tokenAction pos t = case asciiKeywords cf of- [] -> "let l = lexeme lexbuf in TOK_" <> t <+> arg- _ -> "let l = lexeme lexbuf in try Hashtbl.find resword_table l with Not_found -> TOK_" <> t <+> arg+ [] -> "TOK_" <> t <+> arg "(lexeme lexbuf)"+ _ -> "let l = lexeme lexbuf in try Hashtbl.find resword_table l with Not_found -> TOK_" <> t <+> arg "l" where- arg | pos = "((lexeme_start lexbuf, lexeme_end lexbuf), l)"- | otherwise = "l"+ arg l | pos = text $ "((lexeme_start lexbuf, lexeme_end lexbuf), " ++ l ++ ")"+ | otherwise = text l ---------------------------------------------------------------------- Modified from the inlined version of @RegToAlex@.+-- Modified from the inlined version of former @RegToAlex@. ------------------------------------------------------------------- -- modified from pretty-printer generated by the BNF converter@@ -262,9 +262,14 @@ prt _ = prtList instance Print Char where- prt _ c = [show c] -- if isAlphaNum c then [[c]] else ['\\':[c]]+ prt _ c = [charLiteral c] prtList s = [show s] -- map (concat . prt 0) s +charLiteral :: Char -> String+charLiteral c+ | ord c <= 256 = show c+ | otherwise = ['"', c, '"'] -- ocamllex does not accept unicode character literals+ prPrec :: Int -> Int -> [String] -> [String] prPrec i j = if j<i then parenth else id @@ -275,17 +280,21 @@ prt i e = case e of RSeq reg0 reg -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg]) RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg])+ RMinus RAny (RChar c) -> ["[^", charLiteral c, "]"]+ RMinus RAny (RAlts str) -> concat [ ["[^"], map charLiteral str, ["]"] ] RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg])- RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]])- RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]])- ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]])- REps -> prPrec i 3 (["\"\""]) -- special construct for eps in ocamllex?- RChar c -> prPrec i 3 (concat [prt 0 c])- RAlts str -> prPrec i 3 (concat [["["], [concatMap show str], ["]"]])+ RStar reg -> concat [prt 3 reg , ["*"]]+ RPlus reg -> concat [prt 3 reg , ["+"]]+ ROpt reg -> concat [prt 3 reg , ["?"]]+ REps -> ["\"\""]+ RChar c -> [ charLiteral c ]+ -- ocamllex accepts unicode characters only in string literals.+ -- Thus we translate RAlts to a disjunction rather than a character set+ RAlts str -> prPrec i 1 $ List.intersperse "|" $ map charLiteral str+ -- RAlts str -> concat [ ["["], map charLiteral str, ["]"] ] RSeqs str -> [ show str ]- -- RSeqs str -> prPrec i 2 (concat (map (prt 0) str))- RDigit -> prPrec i 3 (concat [["d"]])- RLetter -> prPrec i 3 (concat [["l"]])- RUpper -> prPrec i 3 (concat [["c"]])- RLower -> prPrec i 3 (concat [["s"]])- RAny -> prPrec i 3 (concat [["u"]])+ RDigit -> ["_digit"]+ RLetter -> ["_letter"]+ RUpper -> ["_upper"]+ RLower -> ["_lower"]+ RAny -> ["_universal"]
src/BNFC/Backend/OCaml/CFtoOCamlPrinter.hs view
@@ -2,19 +2,6 @@ BNF Converter: Pretty-printer generator Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- based on BNFC Haskell backend
src/BNFC/Backend/OCaml/CFtoOCamlShow.hs view
@@ -2,19 +2,6 @@ BNF Converter: Non-pretty-printer generator (no "deriving Show" in OCaml...) Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- there is no "deriving Show" in OCaml, although there are solutions based
src/BNFC/Backend/OCaml/CFtoOCamlTemplate.hs view
@@ -2,19 +2,6 @@ BNF Converter: Template Generator Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- based on BNFC Haskell backend
src/BNFC/Backend/OCaml/CFtoOCamlTest.hs view
@@ -4,19 +4,6 @@ BNF Converter: Generate main/test module for OCaml Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.OCaml.CFtoOCamlTest where@@ -36,11 +23,6 @@ -- (* I'm a comment *) comment :: Doc -> Doc comment d = "(*" <+> d <+> "*)"---- | OCaml String concatenation--- >>> "print a" <^> doubleQuotes "abc"--- print a ^ "abc"-a <^> b = a <+> "^" <+> b -- | Generate a test program in OCaml ocamlTestfile :: String -> String -> String -> String -> String -> CF -> Doc
src/BNFC/Backend/OCaml/CFtoOCamlYacc.hs view
@@ -2,19 +2,6 @@ BNF Converter: ocamlyacc Generator Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} -- based on BNFC Haskell backend@@ -28,6 +15,7 @@ where import Data.Char+import Data.Foldable (toList) import BNFC.CF import BNFC.Utils ((+++))@@ -143,7 +131,7 @@ ("%start" +++ unwords (map epName eps)) : (map typing eps)- where eps = allEntryPoints cf+ where eps = toList $ allEntryPoints cf typing :: Cat -> String typing c = "%type" +++ "<" ++ qualify (normCat c) ++ ">" +++ epName c qualify c = if c `elem` [ TokenCat "Integer", TokenCat "Double", TokenCat "Char",@@ -161,7 +149,7 @@ c:cs -> toUpper c : cs entryPointRules :: CF -> String-entryPointRules cf = unlines $ map mkRule $ allEntryPoints cf+entryPointRules cf = unlines $ map mkRule $ toList $ allEntryPoints cf where mkRule :: Cat -> String mkRule s = unlines [
src/BNFC/Backend/OCaml/OCamlUtil.hs view
@@ -2,19 +2,6 @@ BNF Converter: OCaml backend utility module Copyright (C) 2005 Author: Kristofer Johannisson - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE LambdaCase #-}
src/BNFC/Backend/Pygments.hs view
@@ -11,7 +11,7 @@ import Prelude hiding ((<>)) -import AbsBNF (Reg(..))+import BNFC.Abs (Reg(..)) import BNFC.Backend.Base (mkfile, Backend) import BNFC.CF import BNFC.Lexing
src/BNFC/Backend/Txt2Tag.hs view
@@ -1,26 +1,13 @@ {- BNF Converter: Latex Generator- Copyright (C) 2004 Author: Markus Forberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.+ Copyright (C) 2004 Author: Markus Forsberg, Aarne Ranta - You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.Txt2Tag (cfToTxt)where import BNFC.CF-import AbsBNF (Reg (..))+import BNFC.Abs (Reg (..)) import BNFC.Utils import Data.List
src/BNFC/Backend/XML.hs view
@@ -2,19 +2,6 @@ BNF Converter: XML generator Copyright (C) 2004 Author: Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.Backend.XML ---- (cf2DTD, cf2XML)
src/BNFC/CF.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE PatternGuards #-}+{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeSynonymInstances #-} @@ -11,19 +12,6 @@ BNF Converter: Abstract syntax Copyright (C) 2004 Author: Markus Forsberg, Michael Pellauer, Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} module BNFC.CF (@@ -41,7 +29,7 @@ WithPosition(..), blendInPosition, RString, RCat, Cat(..), strToCat, catToStr,- TokenCat,+ BaseCat, TokenCat, catString, catInteger, catDouble, catChar, catIdent, NonTerminal, SentForm, Fun, RFun, IsFun(..),@@ -78,6 +66,7 @@ filterNonUnique, isList, -- Checks if a category is a list category. isTokenCat, maybeTokenCat,+ baseCat, sameCat, -- Information functions for list functions. isNilFun, -- empty list function? ([])@@ -98,26 +87,14 @@ tokenPragmas, -- get the user-defined regular expression tokens tokenNames, -- get the names of all user-defined tokens precCat, -- get the precendence level of a Cat C1 => 1, C => 0- precLevels, -- get all precendence levels in the grammar, sorted in increasing order. precRule, -- get the precendence level of the value category of a rule.- precCF, -- Check if the CF consists of precendence levels.- isUsedCat, usedTokenCats,+ isUsedCat, isPositionCat, hasPositionTokens, hasIdent, hasIdentLikeTokens, hasLayout, layoutPragmas,- sigLookup, -- Get the type of a rule label.-- CFP, -- CF with profiles- RuleP,- FunP,- Prof,- cf2cfpRule,- cf2cfp,- cfp2cf,- trivialProf,- funRuleP, ruleGroupsP, allCatsP, allEntryPointsP+ sigLookup -- Get the type of a rule label. ) where import Control.Monad (guard)@@ -125,17 +102,24 @@ import Data.Function (on) import Data.List (nub, intersperse, sort, group, intercalate, find) import qualified Data.List as List+import Data.List.NonEmpty (pattern (:|), (<|))+import qualified Data.List.NonEmpty as List1 import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map+import Data.Set (Set) import qualified Data.Set as Set import Data.String (IsString(..)) -import AbsBNF (Reg())-import ParBNF (pCat)-import LexBNF (tokens)-import qualified AbsBNF as Abs+import BNFC.Abs (Reg())+import BNFC.Par (pCat)+import BNFC.Lex (tokens)+import qualified BNFC.Abs as Abs +import BNFC.Utils (spanEnd)++type List1 = List1.NonEmpty+ -- | A context free grammar consists of a set of rules and some extended -- information (e.g. pragmas, literals, symbols, keywords). @@ -143,14 +127,16 @@ -- | A rule consists of a function name, a main category and a sequence of -- terminals and non-terminals.+-- -- @ -- function_name . Main_Cat ::= sequence -- @ type Rule = Rul RFun --- | Polymorphic rule type for common type signatures for CF and CFP.+-- | Polymorphic rule type. +-- N.B.: Was originally made polymorphic for the sake of removed backend --profile. data Rul function = Rule { funRule :: function -- ^ The function (semantic action) of a rule.@@ -179,15 +165,16 @@ -- | A sentential form is a sequence of non-terminals or terminals. type SentForm = [Either Cat String] --- | Polymorphic CFG type for common type signatures for CF and CFP.+-- | Type of context-free grammars (GFG). data CFG function = CFG { cfgPragmas :: [Pragma]+ , cfgUsedCats :: Set Cat -- ^ Categories used by the parser. , cfgLiterals :: [Literal] -- ^ @Char, String, Ident, Integer, Double@. -- @String@s are quoted strings, -- and @Ident@s are unquoted.- , cfgSymbols :: [Symbol] -- ^ Symbols in the grammar, e.g. “*”, '->'.- , cfgKeywords :: [KeyWord] -- ^ Reserved words, e.g. 'if' 'while'.+ , cfgSymbols :: [Symbol] -- ^ Symbols in the grammar, e.g. “*”, “->”.+ , cfgKeywords :: [KeyWord] -- ^ Reserved words, e.g. @if@, @while@. , cfgReversibleCats :: [Cat] -- ^ Categories that can be made left-recursive. , cfgRules :: [Rul function] , cfgSignature :: Signature -- ^ Types of rule labels, computed from 'cfgRules'.@@ -258,16 +245,16 @@ -- | Pragmas. -data Pragma = CommentS String -- ^ for single line comments- | CommentM (String,String) -- ^ for multiple-line comments.- | TokenReg RString Bool Reg -- ^ for tokens- | EntryPoints [RCat]- | Layout [String]- | LayoutStop [String]- | LayoutTop- | FunDef RFun [String] Exp- -- ...- deriving (Show)+data Pragma+ = CommentS String -- ^ for single line comments+ | CommentM (String, String) -- ^ for multiple-line comments.+ | TokenReg RString Bool Reg -- ^ for tokens+ | EntryPoints [RCat]+ | Layout [String]+ | LayoutStop [String]+ | LayoutTop+ | FunDef RFun [String] Exp+ deriving (Show) -- | User-defined regular expression tokens tokenPragmas :: CFG f -> [(TokenCat,Reg)]@@ -360,10 +347,11 @@ = Cat String -- ^ Ordinary non-terminal. | TokenCat TokenCat -- ^ Token types (like @Ident@, @Integer@, ..., user-defined). | ListCat Cat -- ^ List non-terminals, e.g., @[Ident]@, @[Exp]@, @[Exp1]@.- | CoercCat String Integer -- ^ E.g. @Exp1@, @Exp2.+ | CoercCat String Integer -- ^ E.g. @Exp1@, @Exp2@. deriving (Eq, Ord) type TokenCat = String+type BaseCat = String -- An alias for Cat used in many backends: type NonTerminal = Cat@@ -390,11 +378,13 @@ Left _ -> Cat s -- error $ "Error parsing cat " ++ s ++ " (" ++ e ++ ")" -- Might be one of the "Internal cat" which are not -- really parsable...- where cat2cat (Abs.IdCat (Abs.Identifier (_pos, i))) =- case span isDigit (reverse i) of- ([],c') -> Cat (reverse c')- (d,c') -> CoercCat (reverse c') (read (reverse d))- cat2cat (Abs.ListCat c) = ListCat (cat2cat c)+ where+ cat2cat = \case+ Abs.IdCat (Abs.Identifier (_pos, x))+ | null ds -> if c `elem` specialCatsP then TokenCat c else Cat c+ | otherwise -> CoercCat c (read ds)+ where (ds, c) = spanEnd isDigit x+ Abs.ListCat c -> ListCat (cat2cat c) -- Build-in categories contants catString, catInteger, catDouble, catChar, catIdent :: TokenCat@@ -455,6 +445,14 @@ isList (ListCat _) = True isList _ = False +-- | Get the underlying category identifier.+baseCat :: Cat -> Either BaseCat TokenCat+baseCat = \case+ ListCat c -> baseCat c+ CoercCat x _ -> Left x+ Cat x -> Left x+ TokenCat x -> Right x+ isTokenCat :: Cat -> Bool isTokenCat (TokenCat _) = True isTokenCat _ = False@@ -522,14 +520,11 @@ -- | The abstract syntax of a grammar. type Data = (Cat, [(String, [Cat])]) --- | @firstEntry@ returns the first entrypoint--- or (if none), the first @Cat@egory appearing in the grammar.+-- | @firstEntry@ returns the first of the @entrypoints@,+-- or (if none), the first parsable @Cat@egory appearing in the grammar. firstEntry :: CF -> Cat-firstEntry cf =- case allEntryPoints cf of- (x:_) -> x- [] -> valCat . head . cfgRules $ cf+firstEntry cf = List1.head $ allEntryPoints cf -- aggressively ban nonunique names (AR 31/5/2012) @@ -613,13 +608,7 @@ -- | Is the category is used on an rhs? -- Includes internal rules. isUsedCat :: CFG f -> Cat -> Bool-isUsedCat cf = (`elem` [ c | Rule _ _ rhs _ <- cfgRules cf, Left c <- rhs ])- -- TODO: isUsedCat is used in some places where the internal rules should be ignored.---- | All token categories used in the grammar.--- Includes internal rules.-usedTokenCats :: CFG f -> [TokenCat]-usedTokenCats cf = [ c | Rule _ _ rhs _ <- cfgRules cf, Left (TokenCat c) <- rhs ]+isUsedCat cf = (`Set.member` cfgUsedCats cf) -- | Group all parsable categories with their rules. -- Deletes whitespace separators, as they will not become part of the parsing rules.@@ -788,12 +777,6 @@ precRule :: Rul f -> Integer precRule = precCat . valCat -precLevels :: CF -> [Integer]-precLevels cf = Set.toAscList $ Set.fromList [ precCat c | c <- reallyAllCats cf]--precCF :: CF -> Bool-precCF cf = length (precLevels cf) > 1- -- | Defines or uses the grammar token types like @Ident@? -- Excludes position tokens. hasIdentLikeTokens :: CFG g -> Bool@@ -807,47 +790,14 @@ isPositionCat :: CFG f -> TokenCat -> Bool isPositionCat cf cat = or [ b | TokenReg name b _ <- cfgPragmas cf, wpThing name == cat] --- | Grammar with permutation profile à la GF. AR 22/9/2004-type CFP = CFG FunP-type FunP = (RFun,Prof)-type RuleP = Rul FunP --- | Pair of: the original function name, profile-type Prof = (RFun, [([[Int]],[Int])])--cf2cfp :: CF -> CFP-cf2cfp cfg@CFG{..} = cfg { cfgRules = map cf2cfpRule cfgRules }--cf2cfpRule :: Rule -> RuleP-cf2cfpRule (Rule f c its internal) = Rule (f, (f, trivialProf its)) c its internal--cfp2cf :: CFP -> CF-cfp2cf = fmap fst--trivialProf :: SentForm -> [([[Int]],[Int])]-trivialProf its = [([],[i]) | (i,_) <- zip [0..] [c | Left c <- its]]--{-# DEPRECATED allCatsP, allEntryPointsP "Use the version without P postfix instead" #-}--funRuleP :: RuleP -> RFun-funRuleP = fst . funRule--ruleGroupsP :: CFP -> [(Cat,[RuleP])]-ruleGroupsP cf = [(c, rulesForCatP cf c) | c <- allCatsP cf]--rulesForCatP :: CFP -> Cat -> [RuleP]-rulesForCatP cf cat = [r | r <- cfgRules cf, isParsable r, valCat r == cat]--allCatsP :: CFP -> [Cat]-allCatsP = reallyAllCats----- | Categories that are entry points to the parser-allEntryPoints :: CFG f -> [Cat]+-- | Categories that are entry points to the parser.+--+-- These are either the declared @entrypoints@ (in the original order),+-- or, if no @entrypoints@ were declared explicitly,+-- all parsable categories (in the order of declaration in the grammar file).+allEntryPoints :: CFG f -> List1 Cat allEntryPoints cf = case concat [ cats | EntryPoints cats <- cfgPragmas cf ] of- [] -> allParserCats cf- cs -> map wpThing cs--allEntryPointsP :: CFP -> [Cat]-allEntryPointsP = allEntryPoints+ [] -> List1.fromList $ allParserCats cf -- assumed to be non-empty+ c:cs -> fmap wpThing (c :| cs)
+ src/BNFC/Check/EmptyTypes.hs view
@@ -0,0 +1,81 @@+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE ScopedTypeVariables #-}++-- | Check whether generated AST will have empty types.+--+-- Internal rules are included.+--+-- We compute by a saturation algorithm which token types are used in which non-terminal.+-- A non-terminal does not use any token types, we flag an empty type.++module BNFC.Check.EmptyTypes (emptyData) where++import Data.Maybe+import Data.Map (Map)+import Data.Set (Set)++import qualified Data.List as List+import qualified Data.Map as Map+import qualified Data.Set as Set++import BNFC.CF++-- | Compute the categories that have empty data type declarations in the abstract syntax.+-- Disregards list types.+emptyData :: forall f. (IsFun f) => [Rul f] -> [RCat]+emptyData rs =+ [ pc+ | Rule _ pc _ _ <- rs+ , let c = wpThing pc+ , not $ isList c+ , Left x <- [baseCat c]+ , maybe True List.null $ Map.lookup x ruleMap+ ]+ where+ ruleMap :: Map BaseCat [f]+ ruleMap = Map.unionsWith (++) $ (`mapMaybe` rs) $ \case+ Rule f pc _ _+ | not (isCoercion f), Left x <- baseCat (wpThing pc)+ -> Just $ Map.singleton x [f]+ | otherwise+ -> Nothing+++-- -- STILLBORN CODE:++-- type UsedTokenTypes = Map BaseCat (Set TokenCat)++-- -- | Not sure what emptyCats computes:+-- emptyCats :: [Rul f] -> [RCat]+-- emptyCats rs =+-- [ pc+-- | Rule _ pc _ _ <- rs+-- , let c = wpThing pc+-- , not $ isList c+-- , Left x <- [baseCat c]+-- , maybe False Set.null $ Map.lookup x usedTokenMap+-- ]+-- where+-- -- The computation of the UsedTokenTypes is likely correct (but untested).+-- usedTokenMap = saturate Map.empty+-- -- standard least fixed-point iteration from below+-- saturate m = if m' == m then m' else saturate m'+-- where m' = step m+-- -- step is monotone!+-- step :: UsedTokenTypes -> UsedTokenTypes+-- step m = Map.unionsWith Set.union $ map stepRule rs+-- where+-- -- Compute the used tokens for a NT based on a single rule,+-- -- using the information we have already for the NTs on the rhs.+-- stepRule (Rule _ (WithPosition _ c0) rhs _) =+-- case baseCat c0 of+-- Left x -> Map.singleton x $ Set.unions $ map typesFor rhsCats+-- -- The TokenCat case is actually impossible, but this is consistent:+-- Right x -> Map.singleton x $ Set.singleton x+-- where+-- rhsCats = mapMaybe (either (Just . baseCat) (const Nothing)) rhs+-- typesFor = \case+-- -- Not token cat:+-- Left c -> Map.findWithDefault Set.empty c m+-- -- TokenCat:+-- Right c -> Set.singleton c
src/BNFC/GetCF.hs view
@@ -2,36 +2,28 @@ BNF Converter: Abstract syntax Copyright (C) 2004 Author: Markus Forsberg, Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE CPP #-}+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE TypeFamilies #-} -- for type equality ~+{-# LANGUAGE NoMonoLocalBinds #-} -- counteract TypeFamilies -- | Check LBNF input file and turn it into the 'CF' internal representation. module BNFC.GetCF- ( parseCF, parseCFP+ ( parseCF , checkRule, transItem ) where import Control.Arrow (left)-import Control.Monad.Reader (Reader, runReader, MonadReader(..), asks)+import Control.Monad.Reader (ReaderT, runReaderT, MonadReader(..), asks) import Control.Monad.State (State, evalState, get, modify) import Control.Monad.Except (MonadError(..)) @@ -39,21 +31,26 @@ import Data.Either (partitionEithers) import Data.Functor (($>)) -- ((<&>)) -- only from ghc 8.4 import Data.List (nub, partition)+import Data.List.NonEmpty (pattern (:|)) import qualified Data.List as List-import Data.Maybe (mapMaybe)+import qualified Data.List.NonEmpty as List1+import Data.Maybe +import Data.Set (Set) import qualified Data.Foldable as Fold import qualified Data.Set as Set+import qualified Data.Map as Map import System.Exit (exitFailure) import System.IO (hPutStrLn, stderr) -- Local imports: -import qualified AbsBNF as Abs-import ParBNF+import qualified BNFC.Abs as Abs+import BNFC.Par import BNFC.CF+import BNFC.Check.EmptyTypes import BNFC.Options import BNFC.Regex (nullable, simpReg) import BNFC.TypeChecker@@ -62,23 +59,17 @@ type Err = Either String -- $setup--- >>> import PrintBNF+-- >>> import BNFC.Print -- | Entrypoint. parseCF :: SharedOptions -> Target -> String -> IO CF-parseCF opts t s = cfp2cf <$> parseCFP opts t s---- | Entrypoint (profiles).--parseCFP :: SharedOptions -> Target -> String -> IO CFP-parseCFP opts target content = do- cfp <- runErr $ pGrammar (myLexer content)+parseCF opts target content = do+ cf <- runErr $ pGrammar (myLexer content) -- <&> expandRules -- <&> from ghc 8.4 >>= return . expandRules- >>= getCFP opts+ >>= getCF opts >>= return . markTokenCategories- let cf = cfp2cf cfp either dieUnlessForce return $ runTypeChecker $ checkDefinitions cf -- Some backends do not allow the grammar name to coincide with@@ -106,10 +97,43 @@ , show target ++ "." ] + -- Token types that end in a numeral confuse BNFC, because of CoerceCat.+ let userTokenTypes = [ rx | TokenReg rx _ _ <- cfgPragmas cf ]+ case filter (isJust . hasNumericSuffix . wpThing) userTokenTypes of+ [] -> return ()+ rxs -> dieUnlessForce $ unlines $ concat+ [ [ "ERROR: illegal token names:" ]+ , printNames rxs+ , [ "Token names may not end with a number---to avoid confusion with coercion categories." ]+ ]++ -- Fail if grammar defines a @token@ twice.+ case duplicatesOn wpThing userTokenTypes of+ [] -> return ()+ gs -> dieUnlessForce $ unlines $ concat+ [ [ "ERROR: duplicate token definitions:" ]+ , map printDuplicateTokenDefs gs+ ]+ where+ printDuplicateTokenDefs (rx :| rxs) = concat $+ [ concat [ " ", wpThing rx, " at " ]+ , unwords $ map (prettyPosition . wpPosition) (rx : rxs)+ ]++ -- Fail if token name conflicts with category name.+ let userTokenNames = Map.fromList $ map (\ rx -> (wpThing rx, rx)) userTokenTypes+ case mapMaybe (\ rx -> (rx,) <$> Map.lookup (wpThing rx) userTokenNames) (allCatsIdNorm cf) of+ [] -> return ()+ ns -> dieUnlessForce $ unlines $ concat+ [ [ "ERROR: these token definitions conflict with non-terminals:" ]+ , map (\ (rx, rp) -> " " ++ blendInPosition rp ++ " conflicts with " ++ blendInPosition rx) ns+ ]+ -- Warn or fail if the grammar uses non unique names.- case filter (not . isDefinedRule) $ filterNonUnique names of+ let nonUniqueNames = filter (not . isDefinedRule) $ filterNonUnique names+ case nonUniqueNames of [] -> return ()- ns | target `elem` [ TargetCpp , TargetCppNoStl , TargetJava ]+ ns | target `elem` [ TargetC, TargetCpp , TargetCppNoStl , TargetJava ] -> dieUnlessForce $ unlines $ concat [ [ "ERROR: names not unique:" ] , printNames ns@@ -123,7 +147,8 @@ ] -- Warn or fail if the grammar uses names not unique modulo upper/lowercase.- case filter (not . isDefinedRule) $ duplicatesOn (map toLower . wpThing) names of+ case nub $ filter (`notElem` nonUniqueNames) $ filter (not . isDefinedRule) $+ concatMap List1.toList $ duplicatesOn (map toLower . wpThing) names of [] -> return () ns | target `elem` [ TargetJava ] -> dieUnlessForce $ unlines $ concat@@ -162,7 +187,7 @@ ] -- Print warnings if user defined nullable tokens.- Fold.mapM_ putStrLn $ checkTokens cf+ Fold.mapM_ dieUnlessForce $ checkTokens cf -- Check for empty grammar. let nRules = length (cfgRules cf)@@ -174,9 +199,15 @@ dieUnlessForce $ "ERROR: the languages defined by this grammar are empty since it mentions no terminals." + unlessNull (emptyData $ cfgRules cf) $ \ pcs -> do+ dieUnlessForce $ unlines $ concat+ [ [ "ERROR: the following categories have empty abstract syntax:" ]+ , printNames $ map (fmap catToStr) pcs+ ]+ -- Passed the tests: Print the number of rules. putStrLn $ show nRules +++ "rules accepted\n"- return cfp+ return cf where runErr = either die return@@ -192,103 +223,118 @@ "Aborting. (Use option --force to continue despite errors.)" exitFailure - printNames :: [RString] -> [String]- printNames = map ((" " ++) . blendInPosition) . List.sortOn lexicoGraphic- where- lexicoGraphic (WithPosition pos x) = (pos,x)+ -- | All token categories used in the grammar.+ -- Includes internal rules.+ usedTokenCats :: CFG f -> [TokenCat]+ usedTokenCats cf = [ c | Rule _ _ rhs _ <- cfgRules cf, Left (TokenCat c) <- rhs ] +-- | Print vertical list of names with position sorted by position.+printNames :: [RString] -> [String]+printNames = map ((" " ++) . blendInPosition) . List.sortOn lexicoGraphic+ where+ lexicoGraphic (WithPosition pos x) = (pos,x)+ die :: String -> IO a die msg = do hPutStrLn stderr msg exitFailure --- | Translate the parsed grammar file into a context-free grammar 'CFP'.+-- | Translate the parsed grammar file into a context-free grammar 'CF'. -- Desugars and type-checks. -getCFP :: SharedOptions -> Abs.Grammar -> Err CFP-getCFP opts (Abs.Grammar defs0) = do- let (defs,inlineDelims)= if cnf opts then (defs0,id) else removeDelims defs0- (pragma,rules0) = partitionEithers $ concat $ mapM transDef defs `runTrans` opts- rules = inlineDelims rules0- reservedWords = nub [t | r <- rules, isParsable r, Right t <- rhsRule r, not $ all isSpace t]+getCF :: SharedOptions -> Abs.Grammar -> Err CF+getCF opts (Abs.Grammar defs) = do+ (pragma, rules) <- partitionEithers . concat <$> mapM transDef defs `runTrans` opts+ let reservedWords = nub [ t | r <- rules, isParsable r, Right t <- rhsRule r, not $ all isSpace t ] -- Issue #204: exclude keywords from internal rules -- Issue #70: whitespace separators should be treated like "", at least in the parser- literals = nub- [ lit | xs <- map rhsRule rules- , Left (Cat lit) <- xs- , lit `elem` specialCatsP- ]+ usedCats = Set.fromList [ c | Rule _ _ rhs _ <- rules, Left c <- rhs ]+ -- literals = used builtin token cats (Integer, String, ...)+ literals = filter (\ s -> TokenCat s `Set.member` usedCats) $ specialCatsP (symbols,keywords) = partition notIdent reservedWords- sig <- runTypeChecker $ buildSignature $ map (fmap fst) rules- let cf = revs $ CFG pragma literals symbols keywords [] rules sig- case mapMaybe (checkRule (cfp2cf cf)) rules of+ sig <- runTypeChecker $ buildSignature rules+ let+ cf = revs $ CFG+ { cfgPragmas = pragma+ , cfgUsedCats = usedCats+ , cfgLiterals = literals+ , cfgSymbols = symbols+ , cfgKeywords = keywords+ , cfgReversibleCats = []+ , cfgRules = rules+ , cfgSignature = sig+ }+ case mapMaybe (checkRule cf) rules of [] -> return () msgs -> throwError $ unlines msgs return cf where notIdent s = null s || not (isAlpha (head s)) || any (not . isIdentRest) s- isIdentRest c = isAlphaNum c || c == '_'- revs cfp@CFG{..} =- cfp { cfgReversibleCats = findAllReversibleCats (cfp2cf cfp) }+ isIdentRest c = isAlphaNum c || c == '_' || c == '\''+ revs cf@CFG{..} =+ cf{ cfgReversibleCats = findAllReversibleCats cf } -- | This function goes through each rule of a grammar and replace Cat "X" with -- TokenCat "X" when "X" is a token type.-markTokenCategories :: CFP -> CFP-markTokenCategories cf@CFG{..} = cf { cfgRules = newRules }+markTokenCategories :: CF -> CF+markTokenCategories cf = fixTokenCats tokenCatNames cf where- newRules = [ Rule f (fmap mark c) (map (left mark) rhs) internal | Rule f c rhs internal <- cfgRules ]- tokenCatNames = [ wpThing n | TokenReg n _ _ <- cfgPragmas ] ++ specialCatsP- mark = toTokenCat tokenCatNames+ tokenCatNames = [ wpThing n | TokenReg n _ _ <- cfgPragmas cf ] ++ specialCatsP +class FixTokenCats a where+ fixTokenCats :: [TokenCat] -> a -> a + default fixTokenCats :: (Functor t, FixTokenCats b, t b ~ a) => [TokenCat] -> a -> a+ fixTokenCats = fmap . fixTokenCats++instance FixTokenCats a => FixTokenCats [a]+instance FixTokenCats a => FixTokenCats (WithPosition a)++instance (FixTokenCats a, Ord a) => FixTokenCats (Set a) where+ fixTokenCats = Set.map . fixTokenCats+ -- | Change the constructor of categories with the given names from Cat to -- TokenCat--- >>> toTokenCat ["A"] (Cat "A") == TokenCat "A"+-- >>> fixTokenCats ["A"] (Cat "A") == TokenCat "A" -- True--- >>> toTokenCat ["A"] (ListCat (Cat "A")) == ListCat (TokenCat "A")+-- >>> fixTokenCats ["A"] (ListCat (Cat "A")) == ListCat (TokenCat "A") -- True--- >>> toTokenCat ["A"] (Cat "B") == Cat "B"+-- >>> fixTokenCats ["A"] (Cat "B") == Cat "B" -- True-toTokenCat :: [String] -> Cat -> Cat-toTokenCat ns (Cat a) | a `elem` ns = TokenCat a-toTokenCat ns (ListCat c) = ListCat (toTokenCat ns c)-toTokenCat _ c = c ---removeDelims :: [Abs.Def] -> ([Abs.Def], [RuleP] -> [RuleP])-removeDelims xs = (ys ++ map delimToSep ds,- foldr (.) id [map (inlineDelim' d) | d <- ds])- where- (ds,ys) = partition isDelim xs- isDelim (Abs.Delimiters{}) = True- isDelim _ = False+instance FixTokenCats Cat where+ fixTokenCats ns = \case+ Cat a | a `elem` ns -> TokenCat a+ ListCat c -> ListCat $ fixTokenCats ns c+ c -> c - inlineDelim :: Abs.Def -> Either Cat String -> [Either Cat String]- inlineDelim (Abs.Delimiters cat open close _ _) (Left c)- | c == ListCat (transCat' cat) = [Right open, Left c, Right close]- inlineDelim _ x = [x]+instance FixTokenCats (Either Cat String) where+ fixTokenCats = left . fixTokenCats - inlineDelim' :: Abs.Def -> RuleP -> RuleP- inlineDelim' d@(Abs.Delimiters cat _ _ _ _) r@(Rule f c rhs internal)- | wpThing c == ListCat (transCat' cat) = r- | otherwise = Rule f c (concatMap (inlineDelim d) rhs) internal- inlineDelim' _ _ = error "Not a delimiters pragma"+instance FixTokenCats (Rul f) where+ fixTokenCats ns (Rule f c rhs internal) =+ Rule f (fixTokenCats ns c) (fixTokenCats ns rhs) internal +instance FixTokenCats Pragma where+ fixTokenCats ns = \case+ EntryPoints eps -> EntryPoints $ fixTokenCats ns eps+ p -> p - delimToSep (Abs.Delimiters cat _ _ (Abs.SepTerm s) sz) = Abs.Terminator sz cat s- delimToSep (Abs.Delimiters cat _ _ (Abs.SepSepar s) sz) = Abs.Separator sz cat s- delimToSep (Abs.Delimiters cat _ _ Abs.SepNone sz) = Abs.Terminator sz cat ""- delimToSep x = x+instance FixTokenCats (CFG f) where+ fixTokenCats ns cf@CFG{..} = cf+ { cfgPragmas = fixTokenCats ns cfgPragmas+ , cfgUsedCats = fixTokenCats ns cfgUsedCats+ , cfgRules = fixTokenCats ns cfgRules+ } -- | Translation monad.-newtype Trans a = Trans { unTrans :: Reader SharedOptions a }- deriving (Functor, Applicative, Monad, MonadReader SharedOptions)+newtype Trans a = Trans { unTrans :: ReaderT SharedOptions Err a }+ deriving (Functor, Applicative, Monad, MonadReader SharedOptions, MonadError String) -runTrans :: Trans a -> SharedOptions -> a-runTrans m opts = unTrans m `runReader` opts+runTrans :: Trans a -> SharedOptions -> Err a+runTrans m opts = unTrans m `runReaderT` opts -transDef :: Abs.Def -> Trans [Either Pragma RuleP]+transDef :: Abs.Def -> Trans [Either Pragma Rule] transDef = \case Abs.Rule label cat items -> do f <- transLabel label@@ -304,12 +350,15 @@ Abs.Token ident reg -> do x <- transIdent ident; return [Left $ TokenReg x False $ simpReg reg] Abs.PosToken ident reg -> do x <- transIdent ident; return [Left $ TokenReg x True $ simpReg reg]- Abs.Entryp idents -> do xs <- mapM transIdent idents; return [Left $ EntryPoints $ map (fmap strToCat) xs]- Abs.Separator size ident str -> map (Right . cf2cfpRule) <$> separatorRules size ident str- Abs.Terminator size ident str -> map (Right . cf2cfpRule) <$> terminatorRules size ident str- Abs.Delimiters a b c d e -> map (Right . cf2cfpRule) <$> delimiterRules a b c d e- Abs.Coercions ident int -> map (Right . cf2cfpRule) <$> coercionRules ident int- Abs.Rules ident strs -> map (Right . cf2cfpRule) <$> ebnfRules ident strs+ Abs.Entryp cats -> singleton . Left . EntryPoints <$> mapM transCat cats+ Abs.Separator size ident str -> map Right <$> separatorRules size ident str+ Abs.Terminator size ident str -> map Right <$> terminatorRules size ident str+ Abs.Delimiters cat _ _ _ _ -> do+ WithPosition pos _ <- transCat cat+ throwError $ blendInPosition $ WithPosition pos $+ "The delimiters pragma " ++ removedIn290+ Abs.Coercions ident int -> map Right <$> coercionRules ident int+ Abs.Rules ident strs -> map Right <$> ebnfRules ident strs Abs.Layout ss -> return [ Left $ Layout ss ] Abs.LayoutStop ss -> return [ Left $ LayoutStop ss] Abs.LayoutTop -> return [ Left $ LayoutTop ]@@ -318,54 +367,6 @@ let xs' = map transArg xs return [ Left $ FunDef f xs' $ transExp xs' e ] -delimiterRules :: Abs.Cat -> String -> String -> Abs.Separation -> Abs.MinimumSize -> Trans [Rule]-delimiterRules a0 l r (Abs.SepTerm "") size = delimiterRules a0 l r Abs.SepNone size-delimiterRules a0 l r (Abs.SepSepar "") size = delimiterRules a0 l r Abs.SepNone size-delimiterRules a0 l r sep size = do- WithPosition pos a <- transCat a0- let as = ListCat a- a' = '@':'@':show a- c = '@':'{':show a- d = '@':'}':show a- let wp = WithPosition pos- rule f c = Rule (wp f) (wp c)- return $ concat- -- recognizing a single element- [ [ rule "(:[])" (strToCat a') (Left a : termin) Parsable -- optional terminator/separator-- -- glueing two sublists- , rule "(++)" (strToCat a') [Left (strToCat a'), Left (strToCat a')] Parsable-- -- starting on either side with a delimiter- , rule "[]" (strToCat c) [Right l] Parsable- , rule (if optFinal then "(:[])" else "[]")- (strToCat d) ([Left a | optFinal] ++ [Right r]) Parsable-- -- gathering chains- , rule "(++)" (strToCat c) [Left (strToCat c), Left (strToCat a')] Parsable- , rule "(++)" (strToCat d) [Left (strToCat a'), Left (strToCat d)] Parsable-- -- finally, put together left and right chains- , rule "(++)" as [Left (strToCat c), Left (strToCat d)] Parsable- ]- -- special rule for the empty list if necessary- , [ rule "[]" as [Right l, Right r] Parsable | optEmpty ]- ]- where- -- optionally separated concat. of x and y categories.- termin = case sep of- Abs.SepSepar t -> [Right t]- Abs.SepTerm t -> [Right t]- _ -> []- optFinal = case (sep, size) of- (Abs.SepSepar _, _ ) -> True- (Abs.SepTerm _ , Abs.MNonempty ) -> True- (Abs.SepNone , Abs.MNonempty) -> True- _ -> False- optEmpty = case sep of- Abs.SepSepar _ -> size == Abs.MEmpty- _ -> False- -- | Translate @separator [nonempty] C "s"@. -- The position attached to the generated rules is taken from @C@. --@@ -380,9 +381,9 @@ | all isSpace s = terminatorRules size c0 s | otherwise = do WithPosition pos c <- transCat c0- let wp = WithPosition pos let cs = ListCat c- let rule x rhs = Rule (wp x) (wp cs) rhs Parsable+ let rule :: String -> SentForm -> Rule+ rule x rhs = Rule (WithPosition pos x) (WithPosition pos cs) rhs Parsable return $ concat [ [ rule "[]" [] | size == Abs.MEmpty ] , [ rule "(:[])" [Left c] ]@@ -445,9 +446,13 @@ -- It also sanitizes the terminals a bit by skipping empty terminals -- or splitting multiwords terminals. -- This means that the following rule--- Foo. S ::= "foo bar" ""+--+-- > Foo. S ::= "foo bar" ""+-- -- is equivalent to--- Foo. S ::= "foo" "bar"+--+-- > Foo. S ::= "foo" "bar"+ transItem :: Abs.Item -> [Either Cat String] transItem (Abs.Terminal str) = [ Right w | w <- words str ] transItem (Abs.NTerminal cat) = [ Left (transCat' cat) ]@@ -464,21 +469,13 @@ file <- asks lbnfFile return $ WithPosition (Position file line col) $ strToCat c -transLabel :: Abs.Label -> Trans (RFun, Prof)+transLabel :: Abs.Label -> Trans RFun transLabel = \case- Abs.LabNoP f -> do g <- transLabelId f; return (g,(g,[])) ---- should be Nothing- Abs.LabP f p -> do g <- transLabelId f; return (g,(g, map transProf p))- Abs.LabPF f g p -> (,) <$> transLabelId f <*> do (,map transProf p) <$> transLabelId g- Abs.LabF f g -> (,) <$> transLabelId f <*> do (,[]) <$> transLabelId g- where- transLabelId = \case Abs.Id id -> transIdent id Abs.Wild -> return $ noPosition $ "_" Abs.ListE -> return $ noPosition $ "[]" Abs.ListCons -> return $ noPosition $ "(:)" Abs.ListOne -> return $ noPosition $ "(:[])"- transProf (Abs.ProfIt bss as) =- ([map fromInteger bs | Abs.Ints bs <- bss], map fromInteger as) transIdent :: Abs.Identifier -> Trans RString transIdent (Abs.Identifier ((line, col), str)) = do@@ -513,58 +510,72 @@ -- | Check if any of the user-defined terminal categories is nullable. checkTokens :: CFG f -> Maybe String checkTokens cf- | null ns = Nothing- | otherwise = Just $ unlines- [ "Warning : " -- TODO: change to error in a future version- , " The following tokens accept the empty string: "- , " " ++ unwords ns- , " This is error-prone and will not be supported in the future."+ | null pxs = Nothing+ | otherwise = Just $ unlines $ concat+ [ [ "ERROR: The following tokens accept the empty string:" ]+ , printNames pxs ] where- ns = map (show . fst) . filter (nullable . snd) $ tokenPragmas cf+ pxs = [ px | TokenReg px _ regex <- cfgPragmas cf, nullable regex ] -- we should actually check that -- (1) coercions are always between variants -- (2) no other digits are used -checkRule :: CF -> RuleP -> Maybe String-checkRule cf (Rule (f,_) (WithPosition _ cat) rhs _)+checkRule :: CF -> Rule -> Maybe String+checkRule cf (Rule f (WithPosition _ cat) rhs _) | Cat ('@':_) <- cat = Nothing -- Generated by a pragma; it's a trusted category- | badCoercion = failure $ "Bad coercion in rule" +++ s- | badNil = failure $ "Bad empty list rule" +++ s- | badOne = failure $ "Bad one-element list rule" +++ s- | badCons = failure $ "Bad list construction rule" +++ s- | badList = failure $ "Bad list formation rule" +++ s- | badSpecial = failure $ "Bad special category rule" +++ s- | badTypeName = failure $ "Bad type name" +++ unwords (map show badtypes) +++ "in" +++ s- | badFunName = failure $ "Bad constructor name" +++ fun +++ "in" +++ s- | badMissing = failure $ "no production for" +++ unwords missing ++ ", appearing in rule\n " ++ s- | otherwise = Nothing+ | badCoercion = stdFail txtCoercion "Bad coercion in rule"+ | badNil = stdFail txtNil "Bad empty list rule"+ | badOne = stdFail txtOne "Bad one-element list rule"+ | badCons = stdFail txtCons "Bad list construction rule"+ | badList = stdFail txtList "Bad list formation rule"+ | badSpecial = failure $ "Bad special category rule" +++ s+ | badTypeName = failure $ "Bad type name" +++ unwords (map show badTypes) +++ "in" +++ s+ | badFunName = failure $ "Bad constructor name" +++ fun +++ "in" +++ s+ | badMissing = failure $ "no production for" +++ unwords missing ++ ", appearing in rule\n " ++ s+ | otherwise = Nothing where failure = Just . blendInPosition . (f $>)+ stdFail txt err = failure $ unlines [ err ++ ":", " " ++ s, txt ]+ fun = wpThing f s = fun ++ "." +++ show cat +++ "::=" +++ unwords (map (either show show) rhs) -- Todo: consider using the show instance of Rule- c = normCat cat- cs = [normCat c | Left c <- rhs]- badCoercion = isCoercion f && [c] /= cs- badNil = isNilFun f && not (isList c && null cs)- badOne = isOneFun f && not (isList c && cs == [catOfList c])- badCons = isConsFun f && not (isList c && cs == [catOfList c, c])- badList = isList c &&- not (isCoercion f || isNilCons f)+ c = normCat cat -- lhs cat without the coercion number+ cs = [normCat c | Left c <- rhs] -- rhs cats without the coercion numbers++ badCoercion = isCoercion f && cs /= [c] -- the single rhs cat needs to match the lhs cat+ txtCoercion = "In a coercion (label _), category on the left of ::= needs to be the single category on the right."++ badNil = isNilFun f && not (isList c && null cs)+ txtNil = "In a nil rule (label []), the category on the left of ::= needs to be a list category [C] and no categories are allowed on the right."++ badOne = isOneFun f && not (isList c && cs == [catOfList c])+ txtOne = "In a singleton rule (label (:[])), the category on the left of ::= needs to be a list category [C], and C must be the sole categories on the right."++ badCons = isConsFun f && not (isList c && cs == [catOfList c, c])+ txtCons = "In a cons rule (label (:)), the category on the left of ::= needs to be a list category [C], and C and [C] (in this order) must be the sole categories on the right."++ badList = isList c && not (isCoercion f || isNilCons f)+ txtList = "List categories [C] can only be formed by rules labeled _, [], (:), or (:[])."+ badSpecial = elem c [ Cat x | x <- specialCatsP] && not (isCoercion f) badMissing = not (null missing) missing = filter (`notElem` defineds) [show c | Left c <- rhs]- defineds = tokenNames cf ++ specialCatsP ++ map (show . valCat) (cfgRules cf)- badTypeName = not (null badtypes)- badtypes = filter isBadType $ cat : [c | Left c <- rhs]- isBadType (ListCat c) = isBadType c- isBadType (CoercCat c _) = isBadCatName c- isBadType (Cat s) = isBadCatName s- isBadType (TokenCat s) = isBadCatName s- isBadCatName s = not $ isUpper (head s) || (head s == '@')+ where+ defineds = tokenNames cf ++ specialCatsP ++ map (show . valCat) (cfgRules cf)++ badTypeName = not (null badTypes)+ badTypes = filter isBadType $ cat : [c | Left c <- rhs]+ where+ isBadType (ListCat c) = isBadType c+ isBadType (CoercCat c _) = isBadCatName c+ isBadType (Cat s) = isBadCatName s+ isBadType (TokenCat s) = isBadCatName s+ isBadCatName s = not $ isUpper (head s) || (head s == '@')+ badFunName = not (all (\c -> isAlphaNum c || c == '_') (wpThing f) {-isUpper (head f)-} || isCoercion f || isNilCons f) @@ -614,7 +625,7 @@ mkRule :: Abs.Identifier -> Abs.RHS -> State [(String, Int)] Abs.Def mkRule ident (Abs.RHS rhs) = do- fun <- Abs.LabNoP . Abs.Id <$> mkName ident rhs+ fun <- Abs.Id <$> mkName ident rhs return $ Abs.Rule fun (Abs.IdCat ident) rhs mkName :: Abs.Identifier -> [Abs.Item] -> State [(String, Int)] Abs.Identifier
+ src/BNFC/Lex.hs view
@@ -0,0 +1,525 @@+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-missing-signatures #-}+{-# LANGUAGE CPP,MagicHash #-}+{-# LINE 3 "BNFC/Lex.x" #-}+{-# OPTIONS -fno-warn-incomplete-patterns #-}+{-# OPTIONS_GHC -w #-}+module BNFC.Lex where++import qualified Data.Bits+import Data.Word (Word8)+import Data.Char (ord)+#if __GLASGOW_HASKELL__ >= 603+#include "ghcconfig.h"+#elif defined(__GLASGOW_HASKELL__)+#include "config.h"+#endif+#if __GLASGOW_HASKELL__ >= 503+import Data.Array+#else+import Array+#endif+#if __GLASGOW_HASKELL__ >= 503+import Data.Array.Base (unsafeAt)+import GHC.Exts+#else+import GlaExts+#endif+alex_tab_size :: Int+alex_tab_size = 8+alex_base :: AlexAddr+alex_base = AlexA#+ "\xf8\xff\xff\xff\x49\x00\x00\x00\xc9\xff\xff\xff\xe0\xff\xff\xff\xc9\x00\x00\x00\x9c\x01\x00\x00\x2d\x00\x00\x00\x1c\x02\x00\x00\x9c\x02\x00\x00\x1c\x03\x00\x00\x9c\x03\x00\x00\x1c\x04\x00\x00\x9c\x04\x00\x00\x0d\x05\x00\x00\x00\x00\x00\x00\x8d\x05\x00\x00\x00\x00\x00\x00\xfe\x05\x00\x00\x00\x00\x00\x00\x6f\x06\x00\x00\x00\x00\x00\x00\x0b\x01\x00\x00\x00\x00\x00\x00\xb0\x06\x00\x00\x00\x00\x00\x00\xf1\x06\x00\x00\xf1\x07\x00\x00\xb1\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x22\x08\x00\x00\x22\x09\x00\x00\xe2\x08\x00\x00\x00\x00\x00\x00\xbb\x09\x00\x00\xbb\x0a\x00\x00\xc1\x09\x00\x00\x7b\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\x0a\x00\x00\xdb\xff\xff\xff\x47\x00\x00\x00\x72\x00\x00\x00\xb2\x0b\x00\x00\x3d\x0b\x00\x00\x32\x0c\x00\x00\xf2\x0c\x00\x00\xb2\x0c\x00\x00\x00\x00\x00\x00\xa8\x0d\x00\x00\x00\x00\x00\x00\x78\x00\x00\x00\xdc\xff\xff\xff\xdd\xff\xff\xff\x00\x00\x00\x00\xdf\xff\xff\xff\x81\x0e\x00\x00\xe4\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7e\x00\x00\x00\xb9\x09\x00\x00\x8c\x00\x00\x00"#++alex_table :: AlexAddr+alex_table = AlexA#+ "\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x37\x00\x3c\x00\x2b\x00\x32\x00\x05\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x34\x00\x02\x00\x2c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x22\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x35\x00\x37\x00\x00\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x38\x00\x37\x00\x00\x00\x37\x00\x00\x00\x37\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x37\x00\x03\x00\x37\x00\x00\x00\x37\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x36\x00\x37\x00\x37\x00\x01\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x03\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x2a\x00\x00\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x33\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1b\x00\x0a\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x15\x00\x0f\x00\x0e\x00\x0e\x00\x0e\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2f\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x01\x00\x1b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1b\x00\x0a\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x15\x00\x0f\x00\x0e\x00\x0e\x00\x0e\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x04\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x23\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x1f\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x1a\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x1c\x00\x08\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x09\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x15\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0a\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x14\x00\x17\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x19\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1f\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x21\x00\x20\x00\x09\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x16\x00\x17\x00\x0c\x00\x10\x00\x10\x00\x10\x00\x11\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3b\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x00\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x23\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x25\x00\x08\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x19\x00\x0b\x00\x12\x00\x12\x00\x12\x00\x13\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2f\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x30\x00\x04\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x27\x00\x28\x00\x07\x00\x1d\x00\x1d\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x2e\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++alex_check :: AlexAddr+alex_check = AlexA#+ "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x3d\x00\x27\x00\x2d\x00\x2d\x00\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x20\x00\x3a\x00\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\xff\xff\x3d\x00\xff\xff\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x27\x00\x5d\x00\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x66\x00\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\x72\x00\xff\xff\x74\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xc3\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x7d\x00\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x2d\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x27\x00\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\x65\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x66\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\x72\x00\xff\xff\x74\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x22\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xff\xff\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\xff\xff\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xff\xff\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xc3\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_deflt :: AlexAddr+alex_deflt = AlexA#+ "\xff\xff\x05\x00\xff\xff\xff\xff\xff\xff\x05\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x14\x00\x14\x00\xff\xff\x16\x00\x16\x00\x18\x00\x18\x00\x1c\x00\x1c\x00\x21\x00\x21\x00\x26\x00\x26\x00\x05\x00\x05\x00\x05\x00\x27\x00\x27\x00\x03\x00\x03\x00\x03\x00\x03\x00\x2c\x00\xff\xff\x2c\x00\x2c\x00\x31\x00\x31\x00\xff\xff\xff\xff\xff\xff\x2c\x00\xff\xff\xff\xff\x32\x00\x32\x00\x32\x00\x32\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_accept = listArray (0 :: Int, 63)+ [ AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccNone+ , AlexAccSkip+ , AlexAccSkip+ , AlexAccSkip+ , AlexAcc 10+ , AlexAcc 9+ , AlexAcc 8+ , AlexAcc 7+ , AlexAcc 6+ , AlexAcc 5+ , AlexAcc 4+ , AlexAcc 3+ , AlexAcc 2+ , AlexAcc 1+ , AlexAcc 0+ ]++alex_actions = array (0 :: Int, 11)+ [ (10,alex_action_3)+ , (9,alex_action_3)+ , (8,alex_action_3)+ , (7,alex_action_3)+ , (6,alex_action_4)+ , (5,alex_action_5)+ , (4,alex_action_6)+ , (3,alex_action_7)+ , (2,alex_action_8)+ , (1,alex_action_9)+ , (0,alex_action_9)+ ]++{-# LINE 49 "BNFC/Lex.x" #-}+tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)+tok f p s = f p s++data Tok =+ TS !String !Int -- reserved words and symbols+ | TL !String -- string literals+ | TI !String -- integer literals+ | TV !String -- identifiers+ | TD !String -- double precision float literals+ | TC !String -- character literals+ | T_Identifier !String++ deriving (Eq,Show,Ord)++data Token =+ PT Posn Tok+ | Err Posn+ deriving (Eq,Show,Ord)++printPosn :: Posn -> String+printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c++tokenPos :: [Token] -> String+tokenPos (t:_) = printPosn (tokenPosn t)+tokenPos [] = "end of file"++tokenPosn :: Token -> Posn+tokenPosn (PT p _) = p+tokenPosn (Err p) = p++tokenLineCol :: Token -> (Int, Int)+tokenLineCol = posLineCol . tokenPosn++posLineCol :: Posn -> (Int, Int)+posLineCol (Pn _ l c) = (l,c)++mkPosToken :: Token -> ((Int, Int), String)+mkPosToken t@(PT p _) = (posLineCol p, tokenText t)++tokenText :: Token -> String+tokenText t = case t of+ PT _ (TS s _) -> s+ PT _ (TL s) -> show s+ PT _ (TI s) -> s+ PT _ (TV s) -> s+ PT _ (TD s) -> s+ PT _ (TC s) -> s+ Err _ -> "#error"+ PT _ (T_Identifier s) -> s++prToken :: Token -> String+prToken t = tokenText t++data BTree = N | B String Tok BTree BTree deriving (Show)++eitherResIdent :: (String -> Tok) -> String -> Tok+eitherResIdent tv s = treeFind resWords+ where+ treeFind N = tv s+ treeFind (B a t left right) | s < a = treeFind left+ | s > a = treeFind right+ | s == a = t++resWords :: BTree+resWords = b "delimiters" 20 (b ";" 10 (b "," 5 (b "*" 3 (b ")" 2 (b "(" 1 N N) N) (b "+" 4 N N)) (b ":" 8 (b "." 7 (b "-" 6 N N) N) (b "::=" 9 N N))) (b "_" 15 (b "[" 13 (b "?" 12 (b "=" 11 N N) N) (b "]" 14 N N)) (b "comment" 18 (b "coercions" 17 (b "char" 16 N N) N) (b "define" 19 N N)))) (b "rules" 30 (b "layout" 25 (b "eps" 23 (b "entrypoints" 22 (b "digit" 21 N N) N) (b "internal" 24 N N)) (b "nonempty" 28 (b "lower" 27 (b "letter" 26 N N) N) (b "position" 29 N N))) (b "toplevel" 35 (b "terminator" 33 (b "stop" 32 (b "separator" 31 N N) N) (b "token" 34 N N)) (b "|" 38 (b "{" 37 (b "upper" 36 N N) N) (b "}" 39 N N))))+ where b s n = let bs = s+ in B bs (TS bs n)++unescapeInitTail :: String -> String+unescapeInitTail = id . unesc . tail . id+ where+ unesc s = case s of+ '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs+ '\\':'n':cs -> '\n' : unesc cs+ '\\':'t':cs -> '\t' : unesc cs+ '\\':'r':cs -> '\r' : unesc cs+ '\\':'f':cs -> '\f' : unesc cs+ '"':[] -> []+ c:cs -> c : unesc cs+ _ -> []++-------------------------------------------------------------------+-- Alex wrapper code.+-- A modified "posn" wrapper.+-------------------------------------------------------------------++data Posn = Pn !Int !Int !Int+ deriving (Eq, Show,Ord)++alexStartPos :: Posn+alexStartPos = Pn 0 1 1++alexMove :: Posn -> Char -> Posn+alexMove (Pn a l c) '\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)+alexMove (Pn a l c) '\n' = Pn (a+1) (l+1) 1+alexMove (Pn a l c) _ = Pn (a+1) l (c+1)++type Byte = Word8++type AlexInput = (Posn, -- current position,+ Char, -- previous char+ [Byte], -- pending bytes on the current char+ String) -- current input string++tokens :: String -> [Token]+tokens str = go (alexStartPos, '\n', [], str)+ where+ go :: AlexInput -> [Token]+ go inp@(pos, _, _, str) =+ case alexScan inp 0 of+ AlexEOF -> []+ AlexError (pos, _, _, _) -> [Err pos]+ AlexSkip inp' len -> go inp'+ AlexToken inp' len act -> act pos (take len str) : (go inp')++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))+alexGetByte (p, _, [], s) =+ case s of+ [] -> Nothing+ (c:s) ->+ let p' = alexMove p c+ (b:bs) = utf8Encode c+ in p' `seq` Just (b, (p', c, bs, s))++alexInputPrevChar :: AlexInput -> Char+alexInputPrevChar (p, c, bs, s) = c++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+utf8Encode :: Char -> [Word8]+utf8Encode = map fromIntegral . go . ord+ where+ go oc+ | oc <= 0x7f = [oc]++ | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]++ | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)+ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]+ | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)+ , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)+ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]+alex_action_3 = tok (\p s -> PT p (eitherResIdent TV s))+alex_action_4 = tok (\p s -> PT p (eitherResIdent T_Identifier s))+alex_action_5 = tok (\p s -> PT p (eitherResIdent TV s))+alex_action_6 = tok (\p s -> PT p (TL $ unescapeInitTail s))+alex_action_7 = tok (\p s -> PT p (TC s))+alex_action_8 = tok (\p s -> PT p (TI s))+alex_action_9 = tok (\p s -> PT p (TD s))++{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- -----------------------------------------------------------------------------+-- ALEX TEMPLATE+--+-- This code is in the PUBLIC DOMAIN; you may copy it freely and use+-- it for any purpose whatsoever.++-- -----------------------------------------------------------------------------+-- INTERNALS and main scanner engine++++++++++++++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define GTE(n,m) (tagToEnum# (n >=# m))+#define EQ(n,m) (tagToEnum# (n ==# m))+#else+#define GTE(n,m) (n >=# m)+#define EQ(n,m) (n ==# m)+#endif++++++++++++++++++++data AlexAddr = AlexA# Addr#+-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ < 503+uncheckedShiftL# = shiftL#+#endif++{-# INLINE alexIndexInt16OffAddr #-}+alexIndexInt16OffAddr (AlexA# arr) off =+#ifdef WORDS_BIGENDIAN+ narrow16Int# i+ where+ i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)+ high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+ low = int2Word# (ord# (indexCharOffAddr# arr off'))+ off' = off *# 2#+#else+ indexInt16OffAddr# arr off+#endif++++++{-# INLINE alexIndexInt32OffAddr #-}+alexIndexInt32OffAddr (AlexA# arr) off =+#ifdef WORDS_BIGENDIAN+ narrow32Int# i+ where+ i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`+ (b2 `uncheckedShiftL#` 16#) `or#`+ (b1 `uncheckedShiftL#` 8#) `or#` b0)+ b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))+ b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))+ b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+ b0 = int2Word# (ord# (indexCharOffAddr# arr off'))+ off' = off *# 4#+#else+ indexInt32OffAddr# arr off+#endif+++++++#if __GLASGOW_HASKELL__ < 503+quickIndex arr i = arr ! i+#else+-- GHC >= 503, unsafeAt is available from Data.Array.Base.+quickIndex = unsafeAt+#endif+++++-- -----------------------------------------------------------------------------+-- Main lexing routines++data AlexReturn a+ = AlexEOF+ | AlexError !AlexInput+ | AlexSkip !AlexInput !Int+ | AlexToken !AlexInput !Int a++-- alexScan :: AlexInput -> StartCode -> AlexReturn a+alexScan input__ (I# (sc))+ = alexScanUser undefined input__ (I# (sc))++alexScanUser user__ input__ (I# (sc))+ = case alex_scan_tkn user__ input__ 0# input__ sc AlexNone of+ (AlexNone, input__') ->+ case alexGetByte input__ of+ Nothing ->++++ AlexEOF+ Just _ ->++++ AlexError input__'++ (AlexLastSkip input__'' len, _) ->++++ AlexSkip input__'' len++ (AlexLastAcc k input__''' len, _) ->++++ AlexToken input__''' len (alex_actions ! k)+++-- Push the input through the DFA, remembering the most recent accepting+-- state it encountered.++alex_scan_tkn user__ orig_input len input__ s last_acc =+ input__ `seq` -- strict in the input+ let+ new_acc = (check_accs (alex_accept `quickIndex` (I# (s))))+ in+ new_acc `seq`+ case alexGetByte input__ of+ Nothing -> (new_acc, input__)+ Just (c, new_input) ->++++ case fromIntegral c of { (I# (ord_c)) ->+ let+ base = alexIndexInt32OffAddr alex_base s+ offset = (base +# ord_c)+ check = alexIndexInt16OffAddr alex_check offset++ new_s = if GTE(offset,0#) && EQ(check,ord_c)+ then alexIndexInt16OffAddr alex_table offset+ else alexIndexInt16OffAddr alex_deflt s+ in+ case new_s of+ -1# -> (new_acc, input__)+ -- on an error, we want to keep the input *before* the+ -- character that failed, not after.+ _ -> alex_scan_tkn user__ orig_input+++++ (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len)+ -- note that the length is increased ONLY if this is the 1st byte in a char encoding)++ new_input new_s new_acc+ }+ where+ check_accs (AlexAccNone) = last_acc+ check_accs (AlexAcc a ) = AlexLastAcc a input__ (I# (len))+ check_accs (AlexAccSkip) = AlexLastSkip input__ (I# (len))++++++++++++++data AlexLastAcc+ = AlexNone+ | AlexLastAcc !Int !AlexInput !Int+ | AlexLastSkip !AlexInput !Int++data AlexAcc user+ = AlexAccNone+ | AlexAcc Int+ | AlexAccSkip+++++++++++++++++++++++++++++
+ src/BNFC/Lex.x view
@@ -0,0 +1,199 @@+-- -*- haskell -*-+-- This Alex file was machine-generated by the BNF converter+{+{-# OPTIONS -fno-warn-incomplete-patterns #-}+{-# OPTIONS_GHC -w #-}+module BNFC.Lex where++import qualified Data.Bits+import Data.Word (Word8)+import Data.Char (ord)+}+++$c = [A-Z\192-\221] # [\215] -- capital isolatin1 letter (215 = \times) FIXME+$s = [a-z\222-\255] # [\247] -- small isolatin1 letter (247 = \div ) FIXME+$l = [$c $s] -- letter+$d = [0-9] -- digit+$i = [$l $d _ '] -- identifier character+$u = [. \n] -- universal: any character++@rsyms = -- symbols and non-identifier-like reserved words+ \; | \. | \: \: \= | \[ | \] | \, | \_ | \( | \: | \) | \= | \| | \- | \* | \+ | \? | \{ | \}++:-++-- Line comments+"--" [.]* ;++-- Block comments+\{ \- [$u # \-]* \- ([$u # [\- \}]] [$u # \-]* \- | \-)* \} ;++$white+ ;+@rsyms+ { tok (\p s -> PT p (eitherResIdent TV s)) }+$l (\_ | ($d | $l)) *+ { tok (\p s -> PT p (eitherResIdent T_Identifier s)) }++$l $i*+ { tok (\p s -> PT p (eitherResIdent TV s)) }+\" ([$u # [\" \\ \n]] | (\\ (\" | \\ | \' | n | t | r | f)))* \"+ { tok (\p s -> PT p (TL $ unescapeInitTail s)) }+\' ($u # [\' \\] | \\ [\\ \' n t r f]) \'+ { tok (\p s -> PT p (TC s)) }+$d++ { tok (\p s -> PT p (TI s)) }+$d+ \. $d+ (e (\-)? $d+)?+ { tok (\p s -> PT p (TD s)) }++{++tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)+tok f p s = f p s++data Tok =+ TS !String !Int -- reserved words and symbols+ | TL !String -- string literals+ | TI !String -- integer literals+ | TV !String -- identifiers+ | TD !String -- double precision float literals+ | TC !String -- character literals+ | T_Identifier !String++ deriving (Eq,Show,Ord)++data Token =+ PT Posn Tok+ | Err Posn+ deriving (Eq,Show,Ord)++printPosn :: Posn -> String+printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c++tokenPos :: [Token] -> String+tokenPos (t:_) = printPosn (tokenPosn t)+tokenPos [] = "end of file"++tokenPosn :: Token -> Posn+tokenPosn (PT p _) = p+tokenPosn (Err p) = p++tokenLineCol :: Token -> (Int, Int)+tokenLineCol = posLineCol . tokenPosn++posLineCol :: Posn -> (Int, Int)+posLineCol (Pn _ l c) = (l,c)++mkPosToken :: Token -> ((Int, Int), String)+mkPosToken t@(PT p _) = (posLineCol p, tokenText t)++tokenText :: Token -> String+tokenText t = case t of+ PT _ (TS s _) -> s+ PT _ (TL s) -> show s+ PT _ (TI s) -> s+ PT _ (TV s) -> s+ PT _ (TD s) -> s+ PT _ (TC s) -> s+ Err _ -> "#error"+ PT _ (T_Identifier s) -> s++prToken :: Token -> String+prToken t = tokenText t++data BTree = N | B String Tok BTree BTree deriving (Show)++eitherResIdent :: (String -> Tok) -> String -> Tok+eitherResIdent tv s = treeFind resWords+ where+ treeFind N = tv s+ treeFind (B a t left right) | s < a = treeFind left+ | s > a = treeFind right+ | s == a = t++resWords :: BTree+resWords = b "delimiters" 20 (b ";" 10 (b "," 5 (b "*" 3 (b ")" 2 (b "(" 1 N N) N) (b "+" 4 N N)) (b ":" 8 (b "." 7 (b "-" 6 N N) N) (b "::=" 9 N N))) (b "_" 15 (b "[" 13 (b "?" 12 (b "=" 11 N N) N) (b "]" 14 N N)) (b "comment" 18 (b "coercions" 17 (b "char" 16 N N) N) (b "define" 19 N N)))) (b "rules" 30 (b "layout" 25 (b "eps" 23 (b "entrypoints" 22 (b "digit" 21 N N) N) (b "internal" 24 N N)) (b "nonempty" 28 (b "lower" 27 (b "letter" 26 N N) N) (b "position" 29 N N))) (b "toplevel" 35 (b "terminator" 33 (b "stop" 32 (b "separator" 31 N N) N) (b "token" 34 N N)) (b "|" 38 (b "{" 37 (b "upper" 36 N N) N) (b "}" 39 N N))))+ where b s n = let bs = s+ in B bs (TS bs n)++unescapeInitTail :: String -> String+unescapeInitTail = id . unesc . tail . id+ where+ unesc s = case s of+ '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs+ '\\':'n':cs -> '\n' : unesc cs+ '\\':'t':cs -> '\t' : unesc cs+ '\\':'r':cs -> '\r' : unesc cs+ '\\':'f':cs -> '\f' : unesc cs+ '"':[] -> []+ c:cs -> c : unesc cs+ _ -> []++-------------------------------------------------------------------+-- Alex wrapper code.+-- A modified "posn" wrapper.+-------------------------------------------------------------------++data Posn = Pn !Int !Int !Int+ deriving (Eq, Show,Ord)++alexStartPos :: Posn+alexStartPos = Pn 0 1 1++alexMove :: Posn -> Char -> Posn+alexMove (Pn a l c) '\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)+alexMove (Pn a l c) '\n' = Pn (a+1) (l+1) 1+alexMove (Pn a l c) _ = Pn (a+1) l (c+1)++type Byte = Word8++type AlexInput = (Posn, -- current position,+ Char, -- previous char+ [Byte], -- pending bytes on the current char+ String) -- current input string++tokens :: String -> [Token]+tokens str = go (alexStartPos, '\n', [], str)+ where+ go :: AlexInput -> [Token]+ go inp@(pos, _, _, str) =+ case alexScan inp 0 of+ AlexEOF -> []+ AlexError (pos, _, _, _) -> [Err pos]+ AlexSkip inp' len -> go inp'+ AlexToken inp' len act -> act pos (take len str) : (go inp')++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))+alexGetByte (p, _, [], s) =+ case s of+ [] -> Nothing+ (c:s) ->+ let p' = alexMove p c+ (b:bs) = utf8Encode c+ in p' `seq` Just (b, (p', c, bs, s))++alexInputPrevChar :: AlexInput -> Char+alexInputPrevChar (p, c, bs, s) = c++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+utf8Encode :: Char -> [Word8]+utf8Encode = map fromIntegral . go . ord+ where+ go oc+ | oc <= 0x7f = [oc]++ | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]++ | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)+ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]+ | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)+ , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)+ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+ , 0x80 + oc Data.Bits..&. 0x3f+ ]+}
src/BNFC/Lexing.hs view
@@ -8,8 +8,8 @@ -- import Control.Arrow ( (&&&) ) import Data.List ( inits, tails ) -import AbsBNF ( Reg(..) )-import PrintBNF ( printTree ) -- for debug printing+import BNFC.Abs ( Reg(..) )+import BNFC.Print ( printTree ) -- for debug printing import BNFC.CF import BNFC.Regex ( simpReg ) import BNFC.Utils ( unless )
+ src/BNFC/License.hs view
@@ -0,0 +1,22 @@+-- This file was autogenerated from LICENSE, do not edit!!++{-# LANGUAGE QuasiQuotes #-}++module BNFC.License where++import Data.String.QQ++license :: String+license = [s|+Copyright 2002-2020 Andreas Abel, Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt, Paul Callaghan, Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Pascal Hof, Simon Huber, Patrik Jansson, Kristofer Johannisson, Antti-Juhani Kaijanaho, Andreas Lööw, Justin Meiners, Kent Mein, Ulf Norell, Gabriele Paganelli, Michael Pellauer, Fabian Ruch, and Aarne Ranta.++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+|]
− src/BNFC/MultiView.hs
@@ -1,126 +0,0 @@-{-- BNF Converter: Abstract syntax- Copyright (C) 2004 Author: Markus Forsberg, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---module BNFC.MultiView where--import Data.Maybe--import ParBNF-import PrintBNF-import AbsBNF--preprocessMCF :: FilePath -> IO ([FilePath],String)-preprocessMCF f = do- s <- readFile f- gr <- case pLGrammar $ myLexer s of- Right g -> return g- Left s -> error s- let name = takeWhile (/='.') f- let grs = extract name gr- let entryp = entrypoint gr- mapM_ writeCF grs- return $ (map fst grs,entryp)--extract :: String -> LGrammar -> [(FilePath, Grammar)]-extract name (LGr ldefs) =- [(file lang,Grammar $ mapMaybe (getDef lang) ldefs) |- lang <- views]- where- views = [lang | LDefView langs <- ldefs, Identifier (_, lang) <- langs]- getDef lang ldef = case ldef of- DefAll d -> Just d- DefSome ids d | lang `elem` map (\ (Identifier (_,x)) -> x) ids -> Just d- _ -> Nothing- file lang = name ++ "_" ++ lang ++ ".cf"----- the entrypoint is the same for all languages - could be different--entrypoint :: LGrammar -> String-entrypoint (LGr rs0) = head $- [c | Entryp (Identifier (_,c) :_) <- rs] ++- [c | Rule _ (IdCat (Identifier (_,c))) _ <- rs]- where- rs = mapMaybe getR rs0- getR d = case d of- DefAll d -> Just d- DefSome _ d -> Just d- _LDefView -> Nothing--writeCF :: (FilePath, Grammar) -> IO ()-writeCF (file,gr) = do- writeFile file $ printTree gr- putStrLn $ "wrote file " ++ file------ These are Haskell specific;----- should be generalized by inspecting the options xx--mkTestMulti :: String -> [String] -> FilePath -> [FilePath] -> IO ()-mkTestMulti cat xx file files = do- let abs = takeWhile (/='.') file- let cncs = map (takeWhile (/='.')) files- let content = testfile cat xx abs cncs- writeFile ("TestTrans" ++ abs ++ ".hs") content--mkMakefileMulti :: [String] -> FilePath -> [FilePath] -> IO ()-mkMakefileMulti xx file files = do- let abs = takeWhile (/='.') file- let cncs = map (takeWhile (/='.')) files- let content = makefile xx abs cncs- writeFile "Makefile" content--makefile _ abs cncs = unlines $- "all:" :- ["\tmake -f Makefile_" ++ cnc | cnc <- cncs] ++- ["\tghc --make -o TestTrans" ++ abs ++ " TestTrans" ++ abs,- ""- ]--testfile cat _ abs cncs = unlines $- ["module Main where"] ++- ["import qualified Lex" ++ cnc | cnc <- cncs] ++- ["import qualified Par" ++ cnc | cnc <- cncs] ++- ["import qualified Print" ++ cnc | cnc <- cncs] ++- ["import Abs" ++ abs,- "import System.Environment (getArgs)",- "",- "main :: IO ()",- "main = do",- " i:o:f:_ <- getArgs",- " s <- readFile f",- " case parse i s of",- " Right t -> putStrLn $ prin o t",- " Left s -> error s",- "",- "parse i = case i of"- ] ++- [- " " ++ sho cnc ++ " -> Par" ++ cnc ++ ".p" ++ cat ++- " . Par" ++ cnc ++ ".myLexer" | cnc <- cncs- ] ++- [- "",- "prin o = case o of"- ] ++- [- " " ++ sho cnc ++ " -> Print" ++ cnc ++- ".printTree" | cnc <- cncs- ]- where- sho = show . tail . dropWhile (/='_')
src/BNFC/Options.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances#-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE TypeSynonymInstances #-} module BNFC.Options ( Mode(..), Target(..), Backend@@ -9,6 +12,7 @@ , defaultOptions, isDefault, printOptions , AlexVersion(..), HappyMode(..), OCamlParser(..), JavaLexerParser(..) , RecordPositions(..), TokenText(..)+ , removedIn290 , translateOldOptions ) where@@ -17,9 +21,12 @@ import Control.Monad.Writer (WriterT, runWriterT, tell) import Control.Monad.Except (MonadError(..)) +import Data.Bifunctor+import Data.Either (partitionEithers) import qualified Data.Map as Map-import qualified Data.List as List+-- import qualified Data.List as List import Data.Maybe (fromMaybe, maybeToList)+import Data.Semigroup (Semigroup(..)) -- for ghc 7.10 import Data.Version (showVersion ) import System.Console.GetOpt@@ -40,7 +47,7 @@ -- e.g. invalid argument/combination of arguments = UsageError String -- Basic modes: print some info and exits- | Help | Version+ | Help | License | Version -- Normal mode, specifying the back end to use, -- the option record to be passed to the backend -- and the path of the input grammar file@@ -48,32 +55,30 @@ deriving (Eq,Show,Ord) -- | Target languages-data Target = TargetC | TargetCpp | TargetCppNoStl | TargetCSharp+data Target = TargetC | TargetCpp | TargetCppNoStl | TargetHaskell | TargetHaskellGadt | TargetLatex- | TargetJava | TargetOCaml | TargetProfile | TargetPygments+ | TargetJava | TargetOCaml | TargetPygments | TargetCheck deriving (Eq, Bounded, Enum, Ord) -- | List of Haskell target. haskellTargets :: [Target]-haskellTargets = [ TargetHaskell, TargetHaskellGadt, TargetProfile ]+haskellTargets = [ TargetHaskell, TargetHaskellGadt ] instance Show Target where show TargetC = "C" show TargetCpp = "C++" show TargetCppNoStl = "C++ (without STL)"- show TargetCSharp = "C#" show TargetHaskell = "Haskell" show TargetHaskellGadt = "Haskell (with GADT)" show TargetLatex = "Latex" show TargetJava = "Java" show TargetOCaml = "OCaml"- show TargetProfile = "Haskell (with permutation profiles)" show TargetPygments = "Pygments" show TargetCheck = "Check LBNF file" -- | Which version of Alex is targeted?-data AlexVersion = Alex1 | Alex2 | Alex3+data AlexVersion = Alex3 deriving (Show,Eq,Ord,Bounded,Enum) -- | Happy modes@@ -115,11 +120,9 @@ , functor :: Bool -- ^ Option @--functor@. Make AST functorial? , generic :: Bool -- ^ Option @--generic@. Derive Data, Generic, Typeable? , alexMode :: AlexVersion -- ^ Options @--alex@.- , shareStrings :: Bool -- ^ Option @--sharestrings@. , tokenText :: TokenText -- ^ Options @--bytestrings@, @--string-token@, and @--text-token@. , glr :: HappyMode -- ^ Happy option @--glr@. , xml :: Int -- ^ Options @--xml@, generate DTD and XML printers.- , cnf :: Bool -- ^ Option @--cnf@. Generate CNF-like tables? , agda :: Bool -- ^ Option @--agda@. Create bindings for Agda? --- OCaml specific , ocamlParser :: OCamlParser -- ^ Option @--menhir@ to switch to @Menhir@.@@ -150,11 +153,9 @@ , functor = False , generic = False , alexMode = Alex3- , shareStrings = False , tokenText = StringToken , glr = Standard , xml = 0- , cnf = False , agda = False -- OCaml specific , ocamlParser = OCamlYacc@@ -208,14 +209,12 @@ , [ "--functor" | functor opts ] , [ "--generic" | generic opts ] , unlessDefault alexMode opts $ \ o -> [ printAlexOption o ]- , [ "--sharestrings" | shareStrings opts ] , [ "--bytestrings" | tokenText opts == ByteStringToken ] , [ "--text-token" | tokenText opts == TextToken, not (agda opts) ] -- default for --agda , [ "--string-token" | tokenText opts == StringToken, agda opts ] -- default unless --agda , [ "--glr" | glr opts == GLR ] , [ "--xml" | xml opts == 1 ] , [ "--xmlt" | xml opts == 2 ]- , [ "--cnf" | cnf opts ] , [ "--agda" | agda opts ] -- C# options: , [ "--vs" | visualStudio opts ]@@ -237,20 +236,16 @@ TargetC -> "c" TargetCpp -> "cpp" TargetCppNoStl -> "cpp-nostl"- TargetCSharp -> "csharp" TargetHaskell -> "haskell" TargetHaskellGadt -> "haskell-gadt" TargetLatex -> "latex" TargetJava -> "java" TargetOCaml -> "ocaml"- TargetProfile -> "profile" TargetPygments -> "pygments" TargetCheck -> "check" printAlexOption :: AlexVersion -> String printAlexOption = ("--" ++) . \case- Alex1 -> "alex1"- Alex2 -> "alex2" Alex3 -> "alex3" printJavaLexerParserOption :: JavaLexerParser -> String@@ -269,6 +264,7 @@ globalOptions :: [ OptDescr Mode ] globalOptions = [ Option [] ["help"] (NoArg Help) "show help",+ Option [] ["license"] (NoArg License) "show license", Option [] ["version","numeric-version"] (NoArg Version) "show version number"] -- | Options for the target languages@@ -291,14 +287,10 @@ "Output C++ code for use with FLex and Bison" , Option "" ["cpp-nostl"] (NoArg (\o -> o {target = TargetCppNoStl})) "Output C++ code (without STL) for use with FLex and Bison"- , Option "" ["csharp"] (NoArg (\o -> o {target = TargetCSharp}))- "Output C# code for use with GPLEX and GPPG [deprecated]" , Option "" ["ocaml"] (NoArg (\o -> o {target = TargetOCaml})) "Output OCaml code for use with ocamllex and ocamlyacc" , Option "" ["ocaml-menhir"] (NoArg (\ o -> o{ target = TargetOCaml, ocamlParser = Menhir })) "Output OCaml code for use with ocamllex and menhir (short for --ocaml --menhir)"- , Option "" ["profile"] (NoArg (\o -> o {target = TargetProfile}))- "Output Haskell code for rules with permutation profiles [deprecated]" , Option "" ["pygments"] (NoArg (\o -> o {target = TargetPygments})) "Output a Python lexer for Pygments" , Option "" ["check"] (NoArg (\ o -> o{target = TargetCheck }))@@ -317,7 +309,7 @@ , ( Option ['p'] ["name-space"] (ReqArg (\n o -> o {inPackage = Just n}) "NAMESPACE") "Prepend NAMESPACE to the package/module name"- , [TargetCpp, TargetCSharp, TargetJava] ++ haskellTargets)+ , [TargetCpp, TargetJava] ++ haskellTargets) -- Java backend: , ( Option [] ["jlex" ] (NoArg (\o -> o {javaLexerParser = JLexCup})) "Lex with JLex, parse with CUP (default)"@@ -335,29 +327,15 @@ , ( Option [] ["menhir"] (NoArg (\ o -> o { ocamlParser = Menhir })) "Generate parser with menhir" , [TargetOCaml] )- -- C++ backend:- , ( Option [] ["vs"] (NoArg (\o -> o {visualStudio = True}))- "Generate Visual Studio solution/project files"- , [TargetCSharp] )- , ( Option [] ["wcf"] (NoArg (\o -> o {wcf = True}))- "Add support for Windows Communication Foundation,\n by marking abstract syntax classes as DataContracts"- , [TargetCSharp] ) -- Haskell backends: , ( Option ['d'] [] (NoArg (\o -> o {inDir = True})) "Put Haskell code in modules LANG.* instead of LANG* (recommended)" , haskellTargets )- , ( Option [] ["alex1"] (NoArg (\o -> o {alexMode = Alex1}))- "Use Alex 1.1 as Haskell lexer tool [deprecated]"- , haskellTargets )- , ( Option [] ["alex2"] (NoArg (\o -> o {alexMode = Alex2}))- "Use Alex 2 as Haskell lexer tool [deprecated]"- , haskellTargets )- , ( Option [] ["alex3"] (NoArg (\o -> o {alexMode = Alex3}))- "Use Alex 3 as Haskell lexer tool (default)"- , haskellTargets )- , ( Option [] ["sharestrings"] (NoArg (\o -> o {shareStrings = True}))- "Use string sharing in Alex 2 lexer [deprecated]"- , haskellTargets )+ -- -- Option --alex3 is obsolete since Alex 3 is the only choice now.+ -- -- Keep this in case there will be a new lexer backend for Haskell.+ -- , ( Option [] ["alex3"] (NoArg (\o -> o {alexMode = Alex3}))+ -- "Use Alex 3 as Haskell lexer tool (default)"+ -- , haskellTargets ) , ( Option [] ["bytestrings"] (NoArg (\o -> o { tokenText = ByteStringToken })) "Use ByteString in Alex lexer" , haskellTargets )@@ -373,20 +351,17 @@ , haskellTargets ) , ( Option [] ["functor"] (NoArg (\o -> o {functor = True})) "Make the AST a functor and use it to store the position of the nodes"- , haskellTargets ) -- TODO: ok with --profile?+ , haskellTargets ) , ( Option [] ["generic"] (NoArg (\o -> o {generic = True})) "Derive Data, Generic, and Typeable instances for AST types"- , haskellTargets ) -- TODO: ok with --profile?+ , haskellTargets ) , ( Option [] ["xml"] (NoArg (\o -> o {xml = 1})) "Also generate a DTD and an XML printer" , haskellTargets ) , ( Option [] ["xmlt"] (NoArg (\o -> o {xml = 2})) "DTD and an XML printer, another encoding" , haskellTargets )- -- CNF and Agda do not support the GADT syntax- , ( Option [] ["cnf"] (NoArg (\o -> o {cnf = True}))- "Use the CNF parser instead of happy"- , [TargetHaskell] )+ -- Agda does not support the GADT syntax , ( Option [] ["agda"] (NoArg (\o -> o { agda = True, tokenText = TextToken })) "Also generate Agda bindings for the abstract syntax" , [TargetHaskell] )@@ -419,7 +394,7 @@ title :: [String] title = [ "The BNF Converter, " ++ showVersion version ++ " (c) 2002-today BNFC development team."- , "Free software under GNU General Public License (GPL)."+ , "Free software under the BSD 3-clause license." , "List of recent contributors at https://github.com/BNFC/bnfc/graphs/contributors." , "Report bugs at https://github.com/BNFC/bnfc/issues." , ""@@ -437,6 +412,7 @@ usage = unlines [ "usage: bnfc [--TARGET] [OPTIONS] LANG.cf" , " or: bnfc --[numeric-]version"+ , " or: bnfc [--license]" , " or: bnfc [--help]" ] @@ -448,7 +424,7 @@ , usageInfo "TARGET languages" targetOptions ] ++ map targetUsage helpTargets where- helpTargets = [ TargetHaskell, TargetJava, TargetC, TargetCpp, TargetCSharp ]+ helpTargets = [ TargetHaskell, TargetJava, TargetC, TargetCpp ] targetUsage t = usageInfo (printf "Special options for the %s backend" (show t)) (specificOptions' t)@@ -465,6 +441,9 @@ type ParseOpt = WriterT UsageWarnings (Either String) type UsageWarnings = [String] +instance {-# OVERLAPPING #-} Semigroup (ParseOpt ()) where (<>) = (>>)+instance {-# OVERLAPPING #-} Monoid (ParseOpt ()) where mempty = pure (); mappend = (<>)+ parseMode' :: [String] -> ParseOpt Mode parseMode' [] = return Help parseMode' args =@@ -516,21 +495,17 @@ TargetC -> True TargetCpp -> True TargetCppNoStl -> True- TargetCSharp -> False TargetHaskell -> True TargetHaskellGadt -> True TargetLatex -> True TargetJava -> True TargetOCaml -> True- TargetProfile -> False TargetPygments -> True TargetCheck -> True instance Maintained AlexVersion where printFeature = printAlexOption maintained = \case- Alex1 -> False- Alex2 -> False Alex3 -> True instance Maintained HappyMode where@@ -556,7 +531,6 @@ warnDeprecatedOptions Options{..} = do warnDeprecatedBackend alexMode warnDeprecatedBackend glr- Ctrl.when shareStrings $ warnDeprecated $ "feature --sharestrings" -- * Backward compatibility @@ -566,16 +540,59 @@ -- Note: this only works properly for former options that had no arguments. processUnknownOptions :: [String] -> ParseOpt () processUnknownOptions os = do- case List.partition (`elem` obsoleteOptions) os of- -- Throw an error for properly unknown options.- (_, us@[_] ) -> throwError $ unwords $ "Unrecognized option:" : us- (_, us@(_:_)) -> throwError $ unwords $ "Unrecognized options:" : us- -- Generate warning for former options that are now obsolete.- (os@[_] , _) -> tell [ unwords $ "Warning: ignoring obsolete options:" : os ]- (os@(_:_), _) -> tell [ unwords $ "Warning: ignoring obsolete options:" : os ]- ([], []) -> return ()++ -- Classify unknown options.+ let cl = map (\ o -> bimap (bimap (o,) (o,)) (o,) $ classifyUnknownOption o) os+ let (errs, obsolete) = partitionEithers cl++ -- Print warnings about obsolete options.+ case map (\ (o, ObsoleteOption) -> o) obsolete of+ [] -> pure ()+ os@[_] -> tell [ unwords $ "Warning: ignoring obsolete option:" : os ]+ os@(_:_) -> tell [ unwords $ "Warning: ignoring obsolete options:" : os ]++ -- Throw errors.+ unless (null errs) $ do+ let (unknown, removed) = partitionEithers errs+ throwError $ unlines $ concat+ [ [ "Option error(s):" ]+ , case map (\ (o, UnknownOption) -> o) unknown of+ [] -> []+ us@[_] -> [ unwords $ "Unrecognized option:" : us ]+ us@(_:_) -> [ unwords $ "Unrecognized options:" : us ]+ , map (\ (o, RemovedOption msg) -> concat [ o, ": ", msg ]) removed+ ]++-- | Option has never been known.+data UnknownOption = UnknownOption++-- | Option is obsolete, print warning and continue.+data ObsoleteOption = ObsoleteOption++-- | Error: Option has been removed, throw error with given message.+newtype RemovedOption = RemovedOption String++classifyUnknownOption :: String -> Either (Either UnknownOption RemovedOption) ObsoleteOption+classifyUnknownOption = \case+ "--alex1" -> supportRemovedIn290 $ "Alex version 1"+ "--alex2" -> supportRemovedIn290 $ "Alex version 2"+ "--alex3" -> obsolete+ s@"--sharestrings" -> optionRemovedIn290 s+ s@"--cnf" -> optionRemovedIn290 s+ "--csharp" -> supportRemovedIn290 "C#"+ "--profile" -> supportRemovedIn290 "permutation profiles"+ _ -> unknown where- obsoleteOptions = []+ unknown = Left $ Left UnknownOption+ obsolete = Right ObsoleteOption+ removed = Left . Right . RemovedOption+ supportRemovedIn290 feature = removed $+ unwords [ "Support for", feature, removedIn290 ]+ optionRemovedIn290 o = removed $+ unwords [ "Option", o, removedIn290 ]++removedIn290 :: String+removedIn290 = "has been removed in version 2.9.0." -- | A translation function to maintain backward compatibility -- with the old option syntax.
+ src/BNFC/Par.hs view
@@ -0,0 +1,1596 @@+{-# OPTIONS_GHC -w #-}+{-# OPTIONS -XMagicHash -XBangPatterns -XTypeSynonymInstances -XFlexibleInstances -cpp #-}+#if __GLASGOW_HASKELL__ >= 710+{-# OPTIONS_GHC -XPartialTypeSignatures #-}+#endif+{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}+module BNFC.Par+ ( happyError+ , myLexer+ , pGrammar+ , pListDef+ , pDef+ , pItem+ , pListItem+ , pCat+ , pListCat+ , pLabel+ , pArg+ , pListArg+ , pSeparation+ , pListString+ , pExp+ , pExp1+ , pExp2+ , pListExp+ , pListExp2+ , pRHS+ , pListRHS+ , pMinimumSize+ , pReg+ , pReg1+ , pReg2+ , pReg3+ ) where+import qualified BNFC.Abs+import BNFC.Lex+import qualified Data.Array as Happy_Data_Array+import qualified Data.Bits as Bits+import qualified GHC.Exts as Happy_GHC_Exts+import Control.Applicative(Applicative(..))+import Control.Monad (ap)++-- parser produced by Happy Version 1.19.12++newtype HappyAbsSyn = HappyAbsSyn HappyAny+#if __GLASGOW_HASKELL__ >= 607+type HappyAny = Happy_GHC_Exts.Any+#else+type HappyAny = forall a . a+#endif+newtype HappyWrap27 = HappyWrap27 (Char)+happyIn27 :: (Char) -> (HappyAbsSyn )+happyIn27 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap27 x)+{-# INLINE happyIn27 #-}+happyOut27 :: (HappyAbsSyn ) -> HappyWrap27+happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut27 #-}+newtype HappyWrap28 = HappyWrap28 (Double)+happyIn28 :: (Double) -> (HappyAbsSyn )+happyIn28 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap28 x)+{-# INLINE happyIn28 #-}+happyOut28 :: (HappyAbsSyn ) -> HappyWrap28+happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut28 #-}+newtype HappyWrap29 = HappyWrap29 (Integer)+happyIn29 :: (Integer) -> (HappyAbsSyn )+happyIn29 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap29 x)+{-# INLINE happyIn29 #-}+happyOut29 :: (HappyAbsSyn ) -> HappyWrap29+happyOut29 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut29 #-}+newtype HappyWrap30 = HappyWrap30 (String)+happyIn30 :: (String) -> (HappyAbsSyn )+happyIn30 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap30 x)+{-# INLINE happyIn30 #-}+happyOut30 :: (HappyAbsSyn ) -> HappyWrap30+happyOut30 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut30 #-}+newtype HappyWrap31 = HappyWrap31 (BNFC.Abs.Identifier)+happyIn31 :: (BNFC.Abs.Identifier) -> (HappyAbsSyn )+happyIn31 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap31 x)+{-# INLINE happyIn31 #-}+happyOut31 :: (HappyAbsSyn ) -> HappyWrap31+happyOut31 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut31 #-}+newtype HappyWrap32 = HappyWrap32 (BNFC.Abs.Grammar)+happyIn32 :: (BNFC.Abs.Grammar) -> (HappyAbsSyn )+happyIn32 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap32 x)+{-# INLINE happyIn32 #-}+happyOut32 :: (HappyAbsSyn ) -> HappyWrap32+happyOut32 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut32 #-}+newtype HappyWrap33 = HappyWrap33 ([BNFC.Abs.Def])+happyIn33 :: ([BNFC.Abs.Def]) -> (HappyAbsSyn )+happyIn33 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap33 x)+{-# INLINE happyIn33 #-}+happyOut33 :: (HappyAbsSyn ) -> HappyWrap33+happyOut33 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut33 #-}+newtype HappyWrap34 = HappyWrap34 (BNFC.Abs.Def)+happyIn34 :: (BNFC.Abs.Def) -> (HappyAbsSyn )+happyIn34 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap34 x)+{-# INLINE happyIn34 #-}+happyOut34 :: (HappyAbsSyn ) -> HappyWrap34+happyOut34 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut34 #-}+newtype HappyWrap35 = HappyWrap35 (BNFC.Abs.Item)+happyIn35 :: (BNFC.Abs.Item) -> (HappyAbsSyn )+happyIn35 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap35 x)+{-# INLINE happyIn35 #-}+happyOut35 :: (HappyAbsSyn ) -> HappyWrap35+happyOut35 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut35 #-}+newtype HappyWrap36 = HappyWrap36 ([BNFC.Abs.Item])+happyIn36 :: ([BNFC.Abs.Item]) -> (HappyAbsSyn )+happyIn36 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap36 x)+{-# INLINE happyIn36 #-}+happyOut36 :: (HappyAbsSyn ) -> HappyWrap36+happyOut36 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut36 #-}+newtype HappyWrap37 = HappyWrap37 (BNFC.Abs.Cat)+happyIn37 :: (BNFC.Abs.Cat) -> (HappyAbsSyn )+happyIn37 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap37 x)+{-# INLINE happyIn37 #-}+happyOut37 :: (HappyAbsSyn ) -> HappyWrap37+happyOut37 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut37 #-}+newtype HappyWrap38 = HappyWrap38 ([BNFC.Abs.Cat])+happyIn38 :: ([BNFC.Abs.Cat]) -> (HappyAbsSyn )+happyIn38 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap38 x)+{-# INLINE happyIn38 #-}+happyOut38 :: (HappyAbsSyn ) -> HappyWrap38+happyOut38 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut38 #-}+newtype HappyWrap39 = HappyWrap39 (BNFC.Abs.Label)+happyIn39 :: (BNFC.Abs.Label) -> (HappyAbsSyn )+happyIn39 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap39 x)+{-# INLINE happyIn39 #-}+happyOut39 :: (HappyAbsSyn ) -> HappyWrap39+happyOut39 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut39 #-}+newtype HappyWrap40 = HappyWrap40 (BNFC.Abs.Arg)+happyIn40 :: (BNFC.Abs.Arg) -> (HappyAbsSyn )+happyIn40 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap40 x)+{-# INLINE happyIn40 #-}+happyOut40 :: (HappyAbsSyn ) -> HappyWrap40+happyOut40 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut40 #-}+newtype HappyWrap41 = HappyWrap41 ([BNFC.Abs.Arg])+happyIn41 :: ([BNFC.Abs.Arg]) -> (HappyAbsSyn )+happyIn41 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap41 x)+{-# INLINE happyIn41 #-}+happyOut41 :: (HappyAbsSyn ) -> HappyWrap41+happyOut41 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut41 #-}+newtype HappyWrap42 = HappyWrap42 (BNFC.Abs.Separation)+happyIn42 :: (BNFC.Abs.Separation) -> (HappyAbsSyn )+happyIn42 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap42 x)+{-# INLINE happyIn42 #-}+happyOut42 :: (HappyAbsSyn ) -> HappyWrap42+happyOut42 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut42 #-}+newtype HappyWrap43 = HappyWrap43 ([String])+happyIn43 :: ([String]) -> (HappyAbsSyn )+happyIn43 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap43 x)+{-# INLINE happyIn43 #-}+happyOut43 :: (HappyAbsSyn ) -> HappyWrap43+happyOut43 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut43 #-}+newtype HappyWrap44 = HappyWrap44 (BNFC.Abs.Exp)+happyIn44 :: (BNFC.Abs.Exp) -> (HappyAbsSyn )+happyIn44 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap44 x)+{-# INLINE happyIn44 #-}+happyOut44 :: (HappyAbsSyn ) -> HappyWrap44+happyOut44 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut44 #-}+newtype HappyWrap45 = HappyWrap45 (BNFC.Abs.Exp)+happyIn45 :: (BNFC.Abs.Exp) -> (HappyAbsSyn )+happyIn45 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap45 x)+{-# INLINE happyIn45 #-}+happyOut45 :: (HappyAbsSyn ) -> HappyWrap45+happyOut45 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut45 #-}+newtype HappyWrap46 = HappyWrap46 (BNFC.Abs.Exp)+happyIn46 :: (BNFC.Abs.Exp) -> (HappyAbsSyn )+happyIn46 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap46 x)+{-# INLINE happyIn46 #-}+happyOut46 :: (HappyAbsSyn ) -> HappyWrap46+happyOut46 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut46 #-}+newtype HappyWrap47 = HappyWrap47 ([BNFC.Abs.Exp])+happyIn47 :: ([BNFC.Abs.Exp]) -> (HappyAbsSyn )+happyIn47 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap47 x)+{-# INLINE happyIn47 #-}+happyOut47 :: (HappyAbsSyn ) -> HappyWrap47+happyOut47 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut47 #-}+newtype HappyWrap48 = HappyWrap48 ([BNFC.Abs.Exp])+happyIn48 :: ([BNFC.Abs.Exp]) -> (HappyAbsSyn )+happyIn48 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap48 x)+{-# INLINE happyIn48 #-}+happyOut48 :: (HappyAbsSyn ) -> HappyWrap48+happyOut48 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut48 #-}+newtype HappyWrap49 = HappyWrap49 (BNFC.Abs.RHS)+happyIn49 :: (BNFC.Abs.RHS) -> (HappyAbsSyn )+happyIn49 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap49 x)+{-# INLINE happyIn49 #-}+happyOut49 :: (HappyAbsSyn ) -> HappyWrap49+happyOut49 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut49 #-}+newtype HappyWrap50 = HappyWrap50 ([BNFC.Abs.RHS])+happyIn50 :: ([BNFC.Abs.RHS]) -> (HappyAbsSyn )+happyIn50 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap50 x)+{-# INLINE happyIn50 #-}+happyOut50 :: (HappyAbsSyn ) -> HappyWrap50+happyOut50 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut50 #-}+newtype HappyWrap51 = HappyWrap51 (BNFC.Abs.MinimumSize)+happyIn51 :: (BNFC.Abs.MinimumSize) -> (HappyAbsSyn )+happyIn51 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap51 x)+{-# INLINE happyIn51 #-}+happyOut51 :: (HappyAbsSyn ) -> HappyWrap51+happyOut51 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut51 #-}+newtype HappyWrap52 = HappyWrap52 (BNFC.Abs.Reg)+happyIn52 :: (BNFC.Abs.Reg) -> (HappyAbsSyn )+happyIn52 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap52 x)+{-# INLINE happyIn52 #-}+happyOut52 :: (HappyAbsSyn ) -> HappyWrap52+happyOut52 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut52 #-}+newtype HappyWrap53 = HappyWrap53 (BNFC.Abs.Reg)+happyIn53 :: (BNFC.Abs.Reg) -> (HappyAbsSyn )+happyIn53 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap53 x)+{-# INLINE happyIn53 #-}+happyOut53 :: (HappyAbsSyn ) -> HappyWrap53+happyOut53 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut53 #-}+newtype HappyWrap54 = HappyWrap54 (BNFC.Abs.Reg)+happyIn54 :: (BNFC.Abs.Reg) -> (HappyAbsSyn )+happyIn54 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap54 x)+{-# INLINE happyIn54 #-}+happyOut54 :: (HappyAbsSyn ) -> HappyWrap54+happyOut54 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut54 #-}+newtype HappyWrap55 = HappyWrap55 (BNFC.Abs.Reg)+happyIn55 :: (BNFC.Abs.Reg) -> (HappyAbsSyn )+happyIn55 x = Happy_GHC_Exts.unsafeCoerce# (HappyWrap55 x)+{-# INLINE happyIn55 #-}+happyOut55 :: (HappyAbsSyn ) -> HappyWrap55+happyOut55 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut55 #-}+happyInTok :: (Token) -> (HappyAbsSyn )+happyInTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyInTok #-}+happyOutTok :: (HappyAbsSyn ) -> (Token)+happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOutTok #-}+++happyExpList :: HappyAddr+happyExpList = HappyA# "\x00\x00\x00\x00\x00\x00\x80\x00\xa9\xd7\xb8\x01\x04\x00\x00\x00\x00\x00\x00\x08\x90\x7a\x8d\x1b\x40\x00\x00\x00\x00\x00\x00\x80\x00\xa8\xd7\xb8\x01\x04\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x08\x80\x02\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x80\x00\x08\x00\x00\xc0\x07\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x80\x00\x08\x00\x00\xc0\x07\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x80\x00\x08\x00\x00\xc0\x07\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x48\x28\x03\x4c\x00\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x80\x00\x48\x28\x03\x4c\x00\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x48\x28\x03\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x06\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x48\x28\x03\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x80\x00\x08\x00\x00\xc0\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x08\x80\x02\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x02\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\xa9\xd7\xb8\x01\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\xa9\xd7\xb8\x01\x04\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x80\x00\x08\x00\x00\xc0\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x48\x28\x03\x4c\x00\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x06\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x84\x32\xc0\x04\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x08\x80\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++{-# NOINLINE happyExpListPerState #-}+happyExpListPerState st =+ token_strs_expected+ where token_strs = ["error","%dummy","%start_pGrammar","%start_pListDef","%start_pDef","%start_pItem","%start_pListItem","%start_pCat","%start_pListCat","%start_pLabel","%start_pArg","%start_pListArg","%start_pSeparation","%start_pListString","%start_pExp","%start_pExp1","%start_pExp2","%start_pListExp","%start_pListExp2","%start_pRHS","%start_pListRHS","%start_pMinimumSize","%start_pReg","%start_pReg1","%start_pReg2","%start_pReg3","Char","Double","Integer","String","Identifier","Grammar","ListDef","Def","Item","ListItem","Cat","ListCat","Label","Arg","ListArg","Separation","ListString","Exp","Exp1","Exp2","ListExp","ListExp2","RHS","ListRHS","MinimumSize","Reg","Reg1","Reg2","Reg3","'('","')'","'*'","'+'","','","'-'","'.'","':'","'::='","';'","'='","'?'","'['","']'","'_'","'char'","'coercions'","'comment'","'define'","'delimiters'","'digit'","'entrypoints'","'eps'","'internal'","'layout'","'letter'","'lower'","'nonempty'","'position'","'rules'","'separator'","'stop'","'terminator'","'token'","'toplevel'","'upper'","'{'","'|'","'}'","L_charac","L_doubl","L_integ","L_quoted","L_Identifier","%eof"]+ bit_start = st * 100+ bit_end = (st + 1) * 100+ read_bit = readArrayBit happyExpList+ bits = map read_bit [bit_start..bit_end - 1]+ bits_indexed = zip bits [0..99]+ token_strs_expected = concatMap f bits_indexed+ f (False, _) = []+ f (True, nr) = [token_strs !! nr]++happyActOffsets :: HappyAddr+happyActOffsets = HappyA# "\x1e\x00\x1e\x00\x40\x00\xf6\xff\xf6\xff\xf4\xff\xf4\xff\x2b\x00\x18\x00\x18\x00\x2f\x00\xe0\xff\x1d\x00\x1d\x00\x1d\x00\x1d\x00\x1d\x00\xf6\xff\xf6\xff\x4c\x00\x59\x00\x59\x00\x59\x00\x59\x00\x45\x00\x00\x00\x00\x00\x06\x00\x59\x00\x46\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46\x00\x01\x00\xb6\x00\x11\x00\x59\x00\xdf\xff\x7a\x00\x55\x00\x00\x00\x00\x00\x00\x00\xf6\xff\x00\x00\x00\x00\x61\x00\x74\x00\xf4\xff\x00\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x00\x74\x00\x1d\x00\x1d\x00\x00\x00\x00\x00\x1d\x00\x9e\x00\xb0\x00\x00\x00\x79\x00\x79\x00\x79\x00\x79\x00\xba\x00\xa1\x00\xa1\x00\xac\x00\xac\x00\x00\x00\xb5\x00\xaf\x00\xaf\x00\x00\x00\xaf\x00\xd6\x00\xda\x00\x00\x00\xfb\x00\xe7\x00\xe7\x00\xe7\x00\xe7\x00\xe7\x00\xef\x00\xe9\x00\xfe\x00\x07\x01\xf4\xff\xf4\xff\x2b\x00\x85\x00\x1d\x01\x1b\x01\x36\x01\x36\x01\x30\x01\x31\x01\x67\x01\x1e\x00\x46\x01\x00\x00\x00\x00\x1e\x00\x59\x00\xf4\xff\xf4\xff\x69\x01\x48\x01\x00\x00\x4a\x01\x00\x00\x6f\x01\x00\x00\x4c\x01\x4e\x01\x51\x01\x4f\x01\xf4\xff\xf4\xff\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x52\x01\x1d\x00\x1d\x00\x00\x00\x6a\x01\x79\x01\x00\x00\x70\x01\xf6\xff\x00\x00\x59\x00\x59\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x58\x01\x72\x01\x13\x00\x00\x00\x00\x00\x00\x00\x7b\x01\x59\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x74\x01\x00\x00\x7a\x01\x00\x00\x00\x00\x7c\x01\x5a\x01\xf4\xff\x00\x00\x59\x00\xf6\xff\x5a\x01\x5a\x01\x5e\x01\x00\x00\x00\x00\x00\x00\x00\x00\x5e\x01\x7d\x01\x2f\x00\x1d\x00\xf6\xff\x86\x01\x00\x00\x00\x00\x00\x00\x6d\x01\xf6\xff\x00\x00\x00\x00\x00\x00"#++happyGotoOffsets :: HappyAddr+happyGotoOffsets = HappyA# "\xf5\x00\x24\x01\x35\x01\x50\x01\x3a\x01\x2a\x01\x55\x01\x5f\x00\x48\x00\x57\x00\x7e\x01\x03\x00\xec\x00\x0f\x01\x23\x01\xaa\x00\x8f\x00\x16\x01\xc9\x00\x73\x01\x5c\x00\x72\x00\x08\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\x00\x87\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x89\x01\x4b\x00\x00\x00\x00\x00\x4b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x01\x00\x00\x00\x00\x00\x00\x00\x00\x61\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94\x00\x00\x00\xf1\x00\xb2\x00\x00\x00\x00\x00\x9c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8b\x01\x8c\x01\x00\x00\xb3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8d\x01\x8f\x01\x90\x01\x62\x01\x57\x01\x29\x01\x04\x00\x00\x00\x91\x01\x78\x01\x7f\x01\x92\x01\x00\x00\x00\x00\x2b\x01\x00\x00\x00\x00\x00\x00\x34\x01\x6a\x00\x63\x01\x64\x01\x00\x00\x94\x01\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x96\x01\xd9\x00\x97\x01\x99\x01\x65\x01\x59\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x05\x01\xc7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcc\x00\x00\x00\x27\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9a\x01\x66\x01\x00\x00\x6f\x00\xe1\x00\x9b\x01\x9c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x84\x01\x0a\x01\x45\x01\x00\x00\x00\x00\x00\x00\x00\x00\x88\x01\x4d\x01\x00\x00\x00\x00\x00\x00"#++happyAdjustOffset :: Happy_GHC_Exts.Int# -> Happy_GHC_Exts.Int#+happyAdjustOffset off = off++happyDefActions :: HappyAddr+happyDefActions = HappyA# "\xe1\xff\xe1\xff\x00\x00\x00\x00\xcb\xff\x00\x00\xc7\xff\x00\x00\x00\x00\xbe\xff\xbc\xff\x00\x00\x00\x00\x00\x00\x00\x00\xac\xff\x00\x00\xcb\xff\xcb\xff\xa3\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe7\xff\x98\xff\x00\x00\x00\x00\x00\x00\x91\xff\x95\xff\x99\xff\x94\xff\x92\xff\x93\xff\x00\x00\x00\x00\x9d\xff\x00\x00\x9f\xff\x00\x00\xa1\xff\x00\x00\xa4\xff\xcd\xff\xc8\xff\xcb\xff\xa7\xff\xcc\xff\xa6\xff\x00\x00\x00\x00\xe4\xff\xe3\xff\x00\x00\xb1\xff\xaf\xff\xb2\xff\xb0\xff\xb3\xff\xa9\xff\x00\x00\x00\x00\xac\xff\xe6\xff\xe5\xff\xb3\xff\xab\xff\xb6\xff\xb4\xff\x00\x00\x00\x00\x00\x00\x00\x00\xb9\xff\x00\x00\x00\x00\x00\x00\x00\x00\xbf\xff\xbe\xff\x00\x00\x00\x00\xc4\xff\x00\x00\x00\x00\x00\x00\xc3\xff\xc6\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc7\xff\x00\x00\x00\x00\x00\x00\x00\x00\xa3\xff\xa3\xff\x00\x00\x00\x00\xe0\xff\xe1\xff\x00\x00\xe2\xff\xde\xff\xe1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xff\x00\x00\xce\xff\x00\x00\xd7\xff\x00\x00\xbe\xff\xdc\xff\x00\x00\x00\x00\xc7\xff\xc2\xff\x00\x00\xbd\xff\xbb\xff\xba\xff\x00\x00\x00\x00\xac\xff\xb5\xff\x00\x00\x00\x00\xa8\xff\x00\x00\xcb\xff\xca\xff\x00\x00\x00\x00\x9e\xff\x9c\xff\x9b\xff\x9a\xff\x00\x00\x00\x00\x00\x00\x90\xff\x97\xff\x96\xff\xa2\xff\xa0\xff\xa5\xff\xc9\xff\xad\xff\xae\xff\xaa\xff\xb7\xff\xb8\xff\xc1\xff\x00\x00\xc5\xff\x00\x00\xd3\xff\xdb\xff\x00\x00\x00\x00\x00\x00\xcf\xff\x00\x00\xcb\xff\x00\x00\x00\x00\xd9\xff\xdf\xff\xd5\xff\xd6\xff\xd2\xff\xd8\xff\x00\x00\xbc\xff\x00\x00\xcb\xff\x00\x00\xc0\xff\xdd\xff\xd1\xff\xa3\xff\xcb\xff\xda\xff\xd4\xff"#++happyCheck :: HappyAddr+happyCheck = HappyA# "\xff\xff\x0d\x00\x01\x00\x0d\x00\x02\x00\x26\x00\x03\x00\x03\x00\x00\x00\x03\x00\x04\x00\x2b\x00\x2d\x00\x03\x00\x0d\x00\x0d\x00\x03\x00\x10\x00\x0c\x00\x10\x00\x10\x00\x02\x00\x15\x00\x06\x00\x17\x00\x00\x00\x10\x00\x1a\x00\x1b\x00\x10\x00\x01\x00\x01\x00\x2c\x00\x2b\x00\x2c\x00\x1b\x00\x1c\x00\x24\x00\x25\x00\x00\x00\x0a\x00\x28\x00\x0d\x00\x0d\x00\x01\x00\x0f\x00\x2d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x2d\x00\x16\x00\x1c\x00\x18\x00\x19\x00\x0d\x00\x26\x00\x0f\x00\x1d\x00\x1e\x00\x1f\x00\x2d\x00\x21\x00\x22\x00\x01\x00\x1b\x00\x1c\x00\x2c\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2c\x00\x00\x00\x04\x00\x0d\x00\x1f\x00\x0f\x00\x21\x00\x11\x00\x12\x00\x13\x00\x14\x00\x0d\x00\x16\x00\x2c\x00\x18\x00\x19\x00\x01\x00\x04\x00\x00\x00\x1d\x00\x1e\x00\x1f\x00\x00\x00\x21\x00\x22\x00\x04\x00\x0d\x00\x0e\x00\x0d\x00\x1c\x00\x1c\x00\x10\x00\x00\x00\x0c\x00\x2c\x00\x28\x00\x15\x00\x00\x00\x17\x00\x2b\x00\x00\x00\x1a\x00\x1b\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x24\x00\x25\x00\x00\x00\x06\x00\x28\x00\x2d\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x26\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1a\x00\x1b\x00\x1c\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x1a\x00\x1b\x00\x1c\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x2d\x00\x13\x00\x05\x00\x15\x00\x20\x00\x2d\x00\x13\x00\x23\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x13\x00\x2b\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x04\x00\x08\x00\x03\x00\x04\x00\x11\x00\x12\x00\x13\x00\x14\x00\x05\x00\x0d\x00\x0e\x00\x0c\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x03\x00\x04\x00\x2d\x00\x03\x00\x04\x00\x08\x00\x09\x00\x0a\x00\x08\x00\x09\x00\x0a\x00\x2b\x00\x11\x00\x12\x00\x13\x00\x14\x00\x2d\x00\x04\x00\x08\x00\x16\x00\x17\x00\x2c\x00\x16\x00\x17\x00\x03\x00\x04\x00\x0d\x00\x0e\x00\x0e\x00\x08\x00\x09\x00\x0a\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x07\x00\x16\x00\x17\x00\x04\x00\x05\x00\x06\x00\x07\x00\x11\x00\x12\x00\x13\x00\x05\x00\x0c\x00\x11\x00\x12\x00\x13\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x2d\x00\x2c\x00\x11\x00\x12\x00\x13\x00\x03\x00\x04\x00\x11\x00\x12\x00\x13\x00\x08\x00\x09\x00\x0a\x00\x12\x00\x13\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x04\x00\x2b\x00\x06\x00\x07\x00\x16\x00\x04\x00\x04\x00\x04\x00\x0c\x00\x06\x00\x07\x00\x2c\x00\x0a\x00\x0c\x00\x13\x00\x0c\x00\x04\x00\x04\x00\x06\x00\x07\x00\x07\x00\x03\x00\x04\x00\x22\x00\x0c\x00\x0c\x00\x08\x00\x09\x00\x0a\x00\x03\x00\x04\x00\x2c\x00\x03\x00\x04\x00\x08\x00\x09\x00\x0a\x00\x08\x00\x09\x00\x0a\x00\x03\x00\x04\x00\x1c\x00\x03\x00\x04\x00\x08\x00\x09\x00\x0a\x00\x08\x00\x04\x00\x0a\x00\x04\x00\x2c\x00\x04\x00\x2d\x00\x0a\x00\x0b\x00\x0a\x00\x0b\x00\x0a\x00\x0b\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x09\x00\x2d\x00\x2c\x00\x2b\x00\x07\x00\x2b\x00\x0e\x00\x2a\x00\x2c\x00\x02\x00\x2b\x00\x2b\x00\x0e\x00\x27\x00\x0e\x00\x06\x00\x0e\x00\x09\x00\x26\x00\x2b\x00\x09\x00\x0b\x00\x02\x00\x1c\x00\x03\x00\x18\x00\x03\x00\x0f\x00\x03\x00\x03\x00\x18\x00\x04\x00\x03\x00\x0f\x00\x04\x00\x04\x00\x04\x00\x18\x00\x04\x00\x03\x00\x03\x00\x02\x00\xff\xff\x03\x00\x03\x00\x03\x00\x18\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++happyTable :: HappyAddr+happyTable = HappyA# "\x00\x00\x35\x00\x1d\x00\x35\x00\xa8\x00\x94\x00\x4b\x00\x4b\x00\x1a\x00\x96\x00\x97\x00\x36\x00\xff\xff\x4b\x00\x1e\x00\xa9\x00\x4b\x00\x1f\x00\x98\x00\x4c\x00\x78\x00\x9c\x00\x20\x00\x93\x00\x21\x00\x1a\x00\xb0\x00\x22\x00\x23\x00\xa6\x00\x40\x00\x57\x00\x37\x00\x36\x00\x37\x00\x25\x00\x26\x00\x24\x00\x25\x00\x1a\x00\x6f\x00\x1a\x00\x41\x00\x58\x00\x57\x00\x59\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\xff\xff\x65\x00\x1b\x00\x66\x00\x67\x00\x58\x00\x94\x00\x59\x00\x68\x00\x69\x00\x6a\x00\xff\xff\x6b\x00\x6c\x00\x57\x00\x9f\x00\x26\x00\x37\x00\x1a\x00\x42\x00\x43\x00\x36\x00\x37\x00\x37\x00\x1a\x00\x50\x00\x58\x00\x4f\x00\x59\x00\x50\x00\x61\x00\x62\x00\x63\x00\x64\x00\x53\x00\x65\x00\x37\x00\x66\x00\x67\x00\x1d\x00\x50\x00\x1a\x00\x68\x00\x69\x00\x6a\x00\x1a\x00\x6b\x00\x6c\x00\x54\x00\x51\x00\x52\x00\x1e\x00\x94\x00\x2d\x00\x1f\x00\x1a\x00\x55\x00\x37\x00\x1a\x00\x20\x00\x1a\x00\x21\x00\x36\x00\x1a\x00\x22\x00\x23\x00\x29\x00\x2a\x00\x28\x00\x26\x00\x9a\x00\x2a\x00\x28\x00\x26\x00\x24\x00\x25\x00\x1a\x00\x93\x00\x1a\x00\xff\xff\xb5\x00\x2a\x00\x28\x00\x26\x00\x91\x00\xba\x00\x2a\x00\x28\x00\x26\x00\x27\x00\x28\x00\x26\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x9e\x00\x28\x00\x26\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\xff\xff\x3d\x00\x8b\x00\x3e\x00\x7a\x00\xff\xff\x3d\x00\x7b\x00\x8e\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x3d\x00\x36\x00\x8b\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x50\x00\x8a\x00\x96\x00\x97\x00\x44\x00\x45\x00\x46\x00\x47\x00\x89\x00\x51\x00\x85\x00\x98\x00\x44\x00\x45\x00\x46\x00\x8c\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x2d\x00\x2e\x00\xff\xff\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x2f\x00\x30\x00\x31\x00\x36\x00\x44\x00\x45\x00\x46\x00\xa4\x00\xff\xff\x50\x00\x85\x00\x32\x00\x33\x00\x37\x00\x32\x00\xa0\x00\x2d\x00\x2e\x00\x51\x00\xad\x00\x84\x00\x2f\x00\x30\x00\x31\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x82\x00\x32\x00\xb9\x00\x54\x00\x6f\x00\x70\x00\x6d\x00\x4a\x00\x45\x00\x46\x00\x83\x00\x5f\x00\x8d\x00\x45\x00\x46\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x43\x00\xff\xff\x37\x00\xa5\x00\x45\x00\x46\x00\x2d\x00\x2e\x00\xc2\x00\x45\x00\x46\x00\x2f\x00\x30\x00\x31\x00\x49\x00\x46\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x54\x00\x36\x00\x6c\x00\x6d\x00\x37\x00\x54\x00\x2e\x00\x54\x00\x5f\x00\x71\x00\x6d\x00\x37\x00\x5b\x00\x7b\x00\x48\x00\x5f\x00\x54\x00\x54\x00\xb6\x00\x6d\x00\x5e\x00\x2d\x00\x2e\x00\x78\x00\x5f\x00\x5f\x00\x2f\x00\x5c\x00\x31\x00\x2d\x00\x2e\x00\x37\x00\x2d\x00\x2e\x00\x2f\x00\x91\x00\x31\x00\x2f\x00\xc1\x00\x31\x00\x2d\x00\x2e\x00\x2d\x00\x2d\x00\x2e\x00\x2f\x00\xc5\x00\x31\x00\x5d\x00\x2e\x00\x31\x00\x2e\x00\x37\x00\x2e\x00\xff\xff\x59\x00\x5a\x00\x59\x00\x7c\x00\x59\x00\xa9\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x8f\x00\x7d\x00\xb4\x00\xb3\x00\xaa\x00\xbb\x00\x73\x00\xb3\x00\xff\xff\x37\x00\x36\x00\xb0\x00\x36\x00\xa4\x00\x43\x00\x37\x00\xa3\x00\x36\x00\x36\x00\xa2\x00\x9e\x00\x9d\x00\x93\x00\xc0\x00\xbf\x00\x94\x00\x36\x00\xc5\x00\xbe\x00\xc1\x00\x2d\x00\x99\x00\x2b\x00\x98\x00\x4d\x00\x87\x00\x86\x00\x75\x00\x80\x00\x7f\x00\xc3\x00\x7e\x00\x76\x00\x73\x00\x74\x00\xb1\x00\xae\x00\xac\x00\xab\x00\x00\x00\xbc\x00\xb8\x00\xb7\x00\xc6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++happyReduceArr = Happy_Data_Array.array (24, 111) [+ (24 , happyReduce_24),+ (25 , happyReduce_25),+ (26 , happyReduce_26),+ (27 , happyReduce_27),+ (28 , happyReduce_28),+ (29 , happyReduce_29),+ (30 , happyReduce_30),+ (31 , happyReduce_31),+ (32 , happyReduce_32),+ (33 , happyReduce_33),+ (34 , happyReduce_34),+ (35 , happyReduce_35),+ (36 , happyReduce_36),+ (37 , happyReduce_37),+ (38 , happyReduce_38),+ (39 , happyReduce_39),+ (40 , happyReduce_40),+ (41 , happyReduce_41),+ (42 , happyReduce_42),+ (43 , happyReduce_43),+ (44 , happyReduce_44),+ (45 , happyReduce_45),+ (46 , happyReduce_46),+ (47 , happyReduce_47),+ (48 , happyReduce_48),+ (49 , happyReduce_49),+ (50 , happyReduce_50),+ (51 , happyReduce_51),+ (52 , happyReduce_52),+ (53 , happyReduce_53),+ (54 , happyReduce_54),+ (55 , happyReduce_55),+ (56 , happyReduce_56),+ (57 , happyReduce_57),+ (58 , happyReduce_58),+ (59 , happyReduce_59),+ (60 , happyReduce_60),+ (61 , happyReduce_61),+ (62 , happyReduce_62),+ (63 , happyReduce_63),+ (64 , happyReduce_64),+ (65 , happyReduce_65),+ (66 , happyReduce_66),+ (67 , happyReduce_67),+ (68 , happyReduce_68),+ (69 , happyReduce_69),+ (70 , happyReduce_70),+ (71 , happyReduce_71),+ (72 , happyReduce_72),+ (73 , happyReduce_73),+ (74 , happyReduce_74),+ (75 , happyReduce_75),+ (76 , happyReduce_76),+ (77 , happyReduce_77),+ (78 , happyReduce_78),+ (79 , happyReduce_79),+ (80 , happyReduce_80),+ (81 , happyReduce_81),+ (82 , happyReduce_82),+ (83 , happyReduce_83),+ (84 , happyReduce_84),+ (85 , happyReduce_85),+ (86 , happyReduce_86),+ (87 , happyReduce_87),+ (88 , happyReduce_88),+ (89 , happyReduce_89),+ (90 , happyReduce_90),+ (91 , happyReduce_91),+ (92 , happyReduce_92),+ (93 , happyReduce_93),+ (94 , happyReduce_94),+ (95 , happyReduce_95),+ (96 , happyReduce_96),+ (97 , happyReduce_97),+ (98 , happyReduce_98),+ (99 , happyReduce_99),+ (100 , happyReduce_100),+ (101 , happyReduce_101),+ (102 , happyReduce_102),+ (103 , happyReduce_103),+ (104 , happyReduce_104),+ (105 , happyReduce_105),+ (106 , happyReduce_106),+ (107 , happyReduce_107),+ (108 , happyReduce_108),+ (109 , happyReduce_109),+ (110 , happyReduce_110),+ (111 , happyReduce_111)+ ]++happy_n_terms = 46 :: Int+happy_n_nonterms = 29 :: Int++happyReduce_24 = happySpecReduce_1 0# happyReduction_24+happyReduction_24 happy_x_1+ = case happyOutTok happy_x_1 of { (PT _ (TC happy_var_1)) -> + happyIn27+ ((read (happy_var_1)) :: Char+ )}++happyReduce_25 = happySpecReduce_1 1# happyReduction_25+happyReduction_25 happy_x_1+ = case happyOutTok happy_x_1 of { (PT _ (TD happy_var_1)) -> + happyIn28+ ((read (happy_var_1)) :: Double+ )}++happyReduce_26 = happySpecReduce_1 2# happyReduction_26+happyReduction_26 happy_x_1+ = case happyOutTok happy_x_1 of { (PT _ (TI happy_var_1)) -> + happyIn29+ ((read (happy_var_1)) :: Integer+ )}++happyReduce_27 = happySpecReduce_1 3# happyReduction_27+happyReduction_27 happy_x_1+ = case happyOutTok happy_x_1 of { (PT _ (TL happy_var_1)) -> + happyIn30+ (happy_var_1+ )}++happyReduce_28 = happySpecReduce_1 4# happyReduction_28+happyReduction_28 happy_x_1+ = case happyOutTok happy_x_1 of { happy_var_1 -> + happyIn31+ (BNFC.Abs.Identifier (mkPosToken happy_var_1)+ )}++happyReduce_29 = happySpecReduce_1 5# happyReduction_29+happyReduction_29 happy_x_1+ = case happyOut33 happy_x_1 of { (HappyWrap33 happy_var_1) -> + happyIn32+ (BNFC.Abs.Grammar happy_var_1+ )}++happyReduce_30 = happySpecReduce_0 6# happyReduction_30+happyReduction_30 = happyIn33+ ([]+ )++happyReduce_31 = happySpecReduce_1 6# happyReduction_31+happyReduction_31 happy_x_1+ = case happyOut34 happy_x_1 of { (HappyWrap34 happy_var_1) -> + happyIn33+ ((:[]) happy_var_1+ )}++happyReduce_32 = happySpecReduce_3 6# happyReduction_32+happyReduction_32 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut34 happy_x_1 of { (HappyWrap34 happy_var_1) -> + case happyOut33 happy_x_3 of { (HappyWrap33 happy_var_3) -> + happyIn33+ ((:) happy_var_1 happy_var_3+ )}}++happyReduce_33 = happySpecReduce_2 6# happyReduction_33+happyReduction_33 happy_x_2+ happy_x_1+ = case happyOut33 happy_x_2 of { (HappyWrap33 happy_var_2) -> + happyIn33+ (happy_var_2+ )}++happyReduce_34 = happyReduce 5# 7# happyReduction_34+happyReduction_34 (happy_x_5 `HappyStk`+ happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut39 happy_x_1 of { (HappyWrap39 happy_var_1) -> + case happyOut37 happy_x_3 of { (HappyWrap37 happy_var_3) -> + case happyOut36 happy_x_5 of { (HappyWrap36 happy_var_5) -> + happyIn34+ (BNFC.Abs.Rule happy_var_1 happy_var_3 happy_var_5+ ) `HappyStk` happyRest}}}++happyReduce_35 = happySpecReduce_2 7# happyReduction_35+happyReduction_35 happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + happyIn34+ (BNFC.Abs.Comment happy_var_2+ )}++happyReduce_36 = happySpecReduce_3 7# happyReduction_36+happyReduction_36 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + case happyOut30 happy_x_3 of { (HappyWrap30 happy_var_3) -> + happyIn34+ (BNFC.Abs.Comments happy_var_2 happy_var_3+ )}}++happyReduce_37 = happyReduce 6# 7# happyReduction_37+happyReduction_37 (happy_x_6 `HappyStk`+ happy_x_5 `HappyStk`+ happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut39 happy_x_2 of { (HappyWrap39 happy_var_2) -> + case happyOut37 happy_x_4 of { (HappyWrap37 happy_var_4) -> + case happyOut36 happy_x_6 of { (HappyWrap36 happy_var_6) -> + happyIn34+ (BNFC.Abs.Internal happy_var_2 happy_var_4 happy_var_6+ ) `HappyStk` happyRest}}}++happyReduce_38 = happySpecReduce_3 7# happyReduction_38+happyReduction_38 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut31 happy_x_2 of { (HappyWrap31 happy_var_2) -> + case happyOut52 happy_x_3 of { (HappyWrap52 happy_var_3) -> + happyIn34+ (BNFC.Abs.Token happy_var_2 happy_var_3+ )}}++happyReduce_39 = happyReduce 4# 7# happyReduction_39+happyReduction_39 (happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut31 happy_x_3 of { (HappyWrap31 happy_var_3) -> + case happyOut52 happy_x_4 of { (HappyWrap52 happy_var_4) -> + happyIn34+ (BNFC.Abs.PosToken happy_var_3 happy_var_4+ ) `HappyStk` happyRest}}++happyReduce_40 = happySpecReduce_2 7# happyReduction_40+happyReduction_40 happy_x_2+ happy_x_1+ = case happyOut38 happy_x_2 of { (HappyWrap38 happy_var_2) -> + happyIn34+ (BNFC.Abs.Entryp happy_var_2+ )}++happyReduce_41 = happyReduce 4# 7# happyReduction_41+happyReduction_41 (happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut51 happy_x_2 of { (HappyWrap51 happy_var_2) -> + case happyOut37 happy_x_3 of { (HappyWrap37 happy_var_3) -> + case happyOut30 happy_x_4 of { (HappyWrap30 happy_var_4) -> + happyIn34+ (BNFC.Abs.Separator happy_var_2 happy_var_3 happy_var_4+ ) `HappyStk` happyRest}}}++happyReduce_42 = happyReduce 4# 7# happyReduction_42+happyReduction_42 (happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut51 happy_x_2 of { (HappyWrap51 happy_var_2) -> + case happyOut37 happy_x_3 of { (HappyWrap37 happy_var_3) -> + case happyOut30 happy_x_4 of { (HappyWrap30 happy_var_4) -> + happyIn34+ (BNFC.Abs.Terminator happy_var_2 happy_var_3 happy_var_4+ ) `HappyStk` happyRest}}}++happyReduce_43 = happyReduce 6# 7# happyReduction_43+happyReduction_43 (happy_x_6 `HappyStk`+ happy_x_5 `HappyStk`+ happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut37 happy_x_2 of { (HappyWrap37 happy_var_2) -> + case happyOut30 happy_x_3 of { (HappyWrap30 happy_var_3) -> + case happyOut30 happy_x_4 of { (HappyWrap30 happy_var_4) -> + case happyOut42 happy_x_5 of { (HappyWrap42 happy_var_5) -> + case happyOut51 happy_x_6 of { (HappyWrap51 happy_var_6) -> + happyIn34+ (BNFC.Abs.Delimiters happy_var_2 happy_var_3 happy_var_4 happy_var_5 happy_var_6+ ) `HappyStk` happyRest}}}}}++happyReduce_44 = happySpecReduce_3 7# happyReduction_44+happyReduction_44 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut31 happy_x_2 of { (HappyWrap31 happy_var_2) -> + case happyOut29 happy_x_3 of { (HappyWrap29 happy_var_3) -> + happyIn34+ (BNFC.Abs.Coercions happy_var_2 happy_var_3+ )}}++happyReduce_45 = happyReduce 4# 7# happyReduction_45+happyReduction_45 (happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut31 happy_x_2 of { (HappyWrap31 happy_var_2) -> + case happyOut50 happy_x_4 of { (HappyWrap50 happy_var_4) -> + happyIn34+ (BNFC.Abs.Rules happy_var_2 happy_var_4+ ) `HappyStk` happyRest}}++happyReduce_46 = happyReduce 5# 7# happyReduction_46+happyReduction_46 (happy_x_5 `HappyStk`+ happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = case happyOut31 happy_x_2 of { (HappyWrap31 happy_var_2) -> + case happyOut41 happy_x_3 of { (HappyWrap41 happy_var_3) -> + case happyOut44 happy_x_5 of { (HappyWrap44 happy_var_5) -> + happyIn34+ (BNFC.Abs.Function happy_var_2 happy_var_3 happy_var_5+ ) `HappyStk` happyRest}}}++happyReduce_47 = happySpecReduce_2 7# happyReduction_47+happyReduction_47 happy_x_2+ happy_x_1+ = case happyOut43 happy_x_2 of { (HappyWrap43 happy_var_2) -> + happyIn34+ (BNFC.Abs.Layout happy_var_2+ )}++happyReduce_48 = happySpecReduce_3 7# happyReduction_48+happyReduction_48 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut43 happy_x_3 of { (HappyWrap43 happy_var_3) -> + happyIn34+ (BNFC.Abs.LayoutStop happy_var_3+ )}++happyReduce_49 = happySpecReduce_2 7# happyReduction_49+happyReduction_49 happy_x_2+ happy_x_1+ = happyIn34+ (BNFC.Abs.LayoutTop+ )++happyReduce_50 = happySpecReduce_1 8# happyReduction_50+happyReduction_50 happy_x_1+ = case happyOut30 happy_x_1 of { (HappyWrap30 happy_var_1) -> + happyIn35+ (BNFC.Abs.Terminal happy_var_1+ )}++happyReduce_51 = happySpecReduce_1 8# happyReduction_51+happyReduction_51 happy_x_1+ = case happyOut37 happy_x_1 of { (HappyWrap37 happy_var_1) -> + happyIn35+ (BNFC.Abs.NTerminal happy_var_1+ )}++happyReduce_52 = happySpecReduce_0 9# happyReduction_52+happyReduction_52 = happyIn36+ ([]+ )++happyReduce_53 = happySpecReduce_2 9# happyReduction_53+happyReduction_53 happy_x_2+ happy_x_1+ = case happyOut35 happy_x_1 of { (HappyWrap35 happy_var_1) -> + case happyOut36 happy_x_2 of { (HappyWrap36 happy_var_2) -> + happyIn36+ ((:) happy_var_1 happy_var_2+ )}}++happyReduce_54 = happySpecReduce_3 10# happyReduction_54+happyReduction_54 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut37 happy_x_2 of { (HappyWrap37 happy_var_2) -> + happyIn37+ (BNFC.Abs.ListCat happy_var_2+ )}++happyReduce_55 = happySpecReduce_1 10# happyReduction_55+happyReduction_55 happy_x_1+ = case happyOut31 happy_x_1 of { (HappyWrap31 happy_var_1) -> + happyIn37+ (BNFC.Abs.IdCat happy_var_1+ )}++happyReduce_56 = happySpecReduce_0 11# happyReduction_56+happyReduction_56 = happyIn38+ ([]+ )++happyReduce_57 = happySpecReduce_1 11# happyReduction_57+happyReduction_57 happy_x_1+ = case happyOut37 happy_x_1 of { (HappyWrap37 happy_var_1) -> + happyIn38+ ((:[]) happy_var_1+ )}++happyReduce_58 = happySpecReduce_3 11# happyReduction_58+happyReduction_58 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut37 happy_x_1 of { (HappyWrap37 happy_var_1) -> + case happyOut38 happy_x_3 of { (HappyWrap38 happy_var_3) -> + happyIn38+ ((:) happy_var_1 happy_var_3+ )}}++happyReduce_59 = happySpecReduce_1 12# happyReduction_59+happyReduction_59 happy_x_1+ = case happyOut31 happy_x_1 of { (HappyWrap31 happy_var_1) -> + happyIn39+ (BNFC.Abs.Id happy_var_1+ )}++happyReduce_60 = happySpecReduce_1 12# happyReduction_60+happyReduction_60 happy_x_1+ = happyIn39+ (BNFC.Abs.Wild+ )++happyReduce_61 = happySpecReduce_2 12# happyReduction_61+happyReduction_61 happy_x_2+ happy_x_1+ = happyIn39+ (BNFC.Abs.ListE+ )++happyReduce_62 = happySpecReduce_3 12# happyReduction_62+happyReduction_62 happy_x_3+ happy_x_2+ happy_x_1+ = happyIn39+ (BNFC.Abs.ListCons+ )++happyReduce_63 = happyReduce 5# 12# happyReduction_63+happyReduction_63 (happy_x_5 `HappyStk`+ happy_x_4 `HappyStk`+ happy_x_3 `HappyStk`+ happy_x_2 `HappyStk`+ happy_x_1 `HappyStk`+ happyRest)+ = happyIn39+ (BNFC.Abs.ListOne+ ) `HappyStk` happyRest++happyReduce_64 = happySpecReduce_1 13# happyReduction_64+happyReduction_64 happy_x_1+ = case happyOut31 happy_x_1 of { (HappyWrap31 happy_var_1) -> + happyIn40+ (BNFC.Abs.Arg happy_var_1+ )}++happyReduce_65 = happySpecReduce_0 14# happyReduction_65+happyReduction_65 = happyIn41+ ([]+ )++happyReduce_66 = happySpecReduce_2 14# happyReduction_66+happyReduction_66 happy_x_2+ happy_x_1+ = case happyOut40 happy_x_1 of { (HappyWrap40 happy_var_1) -> + case happyOut41 happy_x_2 of { (HappyWrap41 happy_var_2) -> + happyIn41+ ((:) happy_var_1 happy_var_2+ )}}++happyReduce_67 = happySpecReduce_0 15# happyReduction_67+happyReduction_67 = happyIn42+ (BNFC.Abs.SepNone+ )++happyReduce_68 = happySpecReduce_2 15# happyReduction_68+happyReduction_68 happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + happyIn42+ (BNFC.Abs.SepTerm happy_var_2+ )}++happyReduce_69 = happySpecReduce_2 15# happyReduction_69+happyReduction_69 happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + happyIn42+ (BNFC.Abs.SepSepar happy_var_2+ )}++happyReduce_70 = happySpecReduce_1 16# happyReduction_70+happyReduction_70 happy_x_1+ = case happyOut30 happy_x_1 of { (HappyWrap30 happy_var_1) -> + happyIn43+ ((:[]) happy_var_1+ )}++happyReduce_71 = happySpecReduce_3 16# happyReduction_71+happyReduction_71 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut30 happy_x_1 of { (HappyWrap30 happy_var_1) -> + case happyOut43 happy_x_3 of { (HappyWrap43 happy_var_3) -> + happyIn43+ ((:) happy_var_1 happy_var_3+ )}}++happyReduce_72 = happySpecReduce_3 17# happyReduction_72+happyReduction_72 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut45 happy_x_1 of { (HappyWrap45 happy_var_1) -> + case happyOut44 happy_x_3 of { (HappyWrap44 happy_var_3) -> + happyIn44+ (BNFC.Abs.Cons happy_var_1 happy_var_3+ )}}++happyReduce_73 = happySpecReduce_1 17# happyReduction_73+happyReduction_73 happy_x_1+ = case happyOut45 happy_x_1 of { (HappyWrap45 happy_var_1) -> + happyIn44+ (happy_var_1+ )}++happyReduce_74 = happySpecReduce_2 18# happyReduction_74+happyReduction_74 happy_x_2+ happy_x_1+ = case happyOut31 happy_x_1 of { (HappyWrap31 happy_var_1) -> + case happyOut48 happy_x_2 of { (HappyWrap48 happy_var_2) -> + happyIn45+ (BNFC.Abs.App happy_var_1 happy_var_2+ )}}++happyReduce_75 = happySpecReduce_1 18# happyReduction_75+happyReduction_75 happy_x_1+ = case happyOut46 happy_x_1 of { (HappyWrap46 happy_var_1) -> + happyIn45+ (happy_var_1+ )}++happyReduce_76 = happySpecReduce_1 19# happyReduction_76+happyReduction_76 happy_x_1+ = case happyOut31 happy_x_1 of { (HappyWrap31 happy_var_1) -> + happyIn46+ (BNFC.Abs.Var happy_var_1+ )}++happyReduce_77 = happySpecReduce_1 19# happyReduction_77+happyReduction_77 happy_x_1+ = case happyOut29 happy_x_1 of { (HappyWrap29 happy_var_1) -> + happyIn46+ (BNFC.Abs.LitInt happy_var_1+ )}++happyReduce_78 = happySpecReduce_1 19# happyReduction_78+happyReduction_78 happy_x_1+ = case happyOut27 happy_x_1 of { (HappyWrap27 happy_var_1) -> + happyIn46+ (BNFC.Abs.LitChar happy_var_1+ )}++happyReduce_79 = happySpecReduce_1 19# happyReduction_79+happyReduction_79 happy_x_1+ = case happyOut30 happy_x_1 of { (HappyWrap30 happy_var_1) -> + happyIn46+ (BNFC.Abs.LitString happy_var_1+ )}++happyReduce_80 = happySpecReduce_1 19# happyReduction_80+happyReduction_80 happy_x_1+ = case happyOut28 happy_x_1 of { (HappyWrap28 happy_var_1) -> + happyIn46+ (BNFC.Abs.LitDouble happy_var_1+ )}++happyReduce_81 = happySpecReduce_3 19# happyReduction_81+happyReduction_81 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut47 happy_x_2 of { (HappyWrap47 happy_var_2) -> + happyIn46+ (BNFC.Abs.List happy_var_2+ )}++happyReduce_82 = happySpecReduce_3 19# happyReduction_82+happyReduction_82 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut44 happy_x_2 of { (HappyWrap44 happy_var_2) -> + happyIn46+ (happy_var_2+ )}++happyReduce_83 = happySpecReduce_0 20# happyReduction_83+happyReduction_83 = happyIn47+ ([]+ )++happyReduce_84 = happySpecReduce_1 20# happyReduction_84+happyReduction_84 happy_x_1+ = case happyOut44 happy_x_1 of { (HappyWrap44 happy_var_1) -> + happyIn47+ ((:[]) happy_var_1+ )}++happyReduce_85 = happySpecReduce_3 20# happyReduction_85+happyReduction_85 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut44 happy_x_1 of { (HappyWrap44 happy_var_1) -> + case happyOut47 happy_x_3 of { (HappyWrap47 happy_var_3) -> + happyIn47+ ((:) happy_var_1 happy_var_3+ )}}++happyReduce_86 = happySpecReduce_1 21# happyReduction_86+happyReduction_86 happy_x_1+ = case happyOut46 happy_x_1 of { (HappyWrap46 happy_var_1) -> + happyIn48+ ((:[]) happy_var_1+ )}++happyReduce_87 = happySpecReduce_2 21# happyReduction_87+happyReduction_87 happy_x_2+ happy_x_1+ = case happyOut46 happy_x_1 of { (HappyWrap46 happy_var_1) -> + case happyOut48 happy_x_2 of { (HappyWrap48 happy_var_2) -> + happyIn48+ ((:) happy_var_1 happy_var_2+ )}}++happyReduce_88 = happySpecReduce_1 22# happyReduction_88+happyReduction_88 happy_x_1+ = case happyOut36 happy_x_1 of { (HappyWrap36 happy_var_1) -> + happyIn49+ (BNFC.Abs.RHS happy_var_1+ )}++happyReduce_89 = happySpecReduce_1 23# happyReduction_89+happyReduction_89 happy_x_1+ = case happyOut49 happy_x_1 of { (HappyWrap49 happy_var_1) -> + happyIn50+ ((:[]) happy_var_1+ )}++happyReduce_90 = happySpecReduce_3 23# happyReduction_90+happyReduction_90 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut49 happy_x_1 of { (HappyWrap49 happy_var_1) -> + case happyOut50 happy_x_3 of { (HappyWrap50 happy_var_3) -> + happyIn50+ ((:) happy_var_1 happy_var_3+ )}}++happyReduce_91 = happySpecReduce_1 24# happyReduction_91+happyReduction_91 happy_x_1+ = happyIn51+ (BNFC.Abs.MNonempty+ )++happyReduce_92 = happySpecReduce_0 24# happyReduction_92+happyReduction_92 = happyIn51+ (BNFC.Abs.MEmpty+ )++happyReduce_93 = happySpecReduce_3 25# happyReduction_93+happyReduction_93 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut52 happy_x_1 of { (HappyWrap52 happy_var_1) -> + case happyOut53 happy_x_3 of { (HappyWrap53 happy_var_3) -> + happyIn52+ (BNFC.Abs.RAlt happy_var_1 happy_var_3+ )}}++happyReduce_94 = happySpecReduce_1 25# happyReduction_94+happyReduction_94 happy_x_1+ = case happyOut53 happy_x_1 of { (HappyWrap53 happy_var_1) -> + happyIn52+ (happy_var_1+ )}++happyReduce_95 = happySpecReduce_3 26# happyReduction_95+happyReduction_95 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut53 happy_x_1 of { (HappyWrap53 happy_var_1) -> + case happyOut54 happy_x_3 of { (HappyWrap54 happy_var_3) -> + happyIn53+ (BNFC.Abs.RMinus happy_var_1 happy_var_3+ )}}++happyReduce_96 = happySpecReduce_1 26# happyReduction_96+happyReduction_96 happy_x_1+ = case happyOut54 happy_x_1 of { (HappyWrap54 happy_var_1) -> + happyIn53+ (happy_var_1+ )}++happyReduce_97 = happySpecReduce_2 27# happyReduction_97+happyReduction_97 happy_x_2+ happy_x_1+ = case happyOut54 happy_x_1 of { (HappyWrap54 happy_var_1) -> + case happyOut55 happy_x_2 of { (HappyWrap55 happy_var_2) -> + happyIn54+ (BNFC.Abs.RSeq happy_var_1 happy_var_2+ )}}++happyReduce_98 = happySpecReduce_1 27# happyReduction_98+happyReduction_98 happy_x_1+ = case happyOut55 happy_x_1 of { (HappyWrap55 happy_var_1) -> + happyIn54+ (happy_var_1+ )}++happyReduce_99 = happySpecReduce_2 28# happyReduction_99+happyReduction_99 happy_x_2+ happy_x_1+ = case happyOut55 happy_x_1 of { (HappyWrap55 happy_var_1) -> + happyIn55+ (BNFC.Abs.RStar happy_var_1+ )}++happyReduce_100 = happySpecReduce_2 28# happyReduction_100+happyReduction_100 happy_x_2+ happy_x_1+ = case happyOut55 happy_x_1 of { (HappyWrap55 happy_var_1) -> + happyIn55+ (BNFC.Abs.RPlus happy_var_1+ )}++happyReduce_101 = happySpecReduce_2 28# happyReduction_101+happyReduction_101 happy_x_2+ happy_x_1+ = case happyOut55 happy_x_1 of { (HappyWrap55 happy_var_1) -> + happyIn55+ (BNFC.Abs.ROpt happy_var_1+ )}++happyReduce_102 = happySpecReduce_1 28# happyReduction_102+happyReduction_102 happy_x_1+ = happyIn55+ (BNFC.Abs.REps+ )++happyReduce_103 = happySpecReduce_1 28# happyReduction_103+happyReduction_103 happy_x_1+ = case happyOut27 happy_x_1 of { (HappyWrap27 happy_var_1) -> + happyIn55+ (BNFC.Abs.RChar happy_var_1+ )}++happyReduce_104 = happySpecReduce_3 28# happyReduction_104+happyReduction_104 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + happyIn55+ (BNFC.Abs.RAlts happy_var_2+ )}++happyReduce_105 = happySpecReduce_3 28# happyReduction_105+happyReduction_105 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut30 happy_x_2 of { (HappyWrap30 happy_var_2) -> + happyIn55+ (BNFC.Abs.RSeqs happy_var_2+ )}++happyReduce_106 = happySpecReduce_1 28# happyReduction_106+happyReduction_106 happy_x_1+ = happyIn55+ (BNFC.Abs.RDigit+ )++happyReduce_107 = happySpecReduce_1 28# happyReduction_107+happyReduction_107 happy_x_1+ = happyIn55+ (BNFC.Abs.RLetter+ )++happyReduce_108 = happySpecReduce_1 28# happyReduction_108+happyReduction_108 happy_x_1+ = happyIn55+ (BNFC.Abs.RUpper+ )++happyReduce_109 = happySpecReduce_1 28# happyReduction_109+happyReduction_109 happy_x_1+ = happyIn55+ (BNFC.Abs.RLower+ )++happyReduce_110 = happySpecReduce_1 28# happyReduction_110+happyReduction_110 happy_x_1+ = happyIn55+ (BNFC.Abs.RAny+ )++happyReduce_111 = happySpecReduce_3 28# happyReduction_111+happyReduction_111 happy_x_3+ happy_x_2+ happy_x_1+ = case happyOut52 happy_x_2 of { (HappyWrap52 happy_var_2) -> + happyIn55+ (happy_var_2+ )}++happyNewToken action sts stk [] =+ happyDoAction 45# notHappyAtAll action sts stk []++happyNewToken action sts stk (tk:tks) =+ let cont i = happyDoAction i tk action sts stk tks in+ case tk of {+ PT _ (TS _ 1) -> cont 1#;+ PT _ (TS _ 2) -> cont 2#;+ PT _ (TS _ 3) -> cont 3#;+ PT _ (TS _ 4) -> cont 4#;+ PT _ (TS _ 5) -> cont 5#;+ PT _ (TS _ 6) -> cont 6#;+ PT _ (TS _ 7) -> cont 7#;+ PT _ (TS _ 8) -> cont 8#;+ PT _ (TS _ 9) -> cont 9#;+ PT _ (TS _ 10) -> cont 10#;+ PT _ (TS _ 11) -> cont 11#;+ PT _ (TS _ 12) -> cont 12#;+ PT _ (TS _ 13) -> cont 13#;+ PT _ (TS _ 14) -> cont 14#;+ PT _ (TS _ 15) -> cont 15#;+ PT _ (TS _ 16) -> cont 16#;+ PT _ (TS _ 17) -> cont 17#;+ PT _ (TS _ 18) -> cont 18#;+ PT _ (TS _ 19) -> cont 19#;+ PT _ (TS _ 20) -> cont 20#;+ PT _ (TS _ 21) -> cont 21#;+ PT _ (TS _ 22) -> cont 22#;+ PT _ (TS _ 23) -> cont 23#;+ PT _ (TS _ 24) -> cont 24#;+ PT _ (TS _ 25) -> cont 25#;+ PT _ (TS _ 26) -> cont 26#;+ PT _ (TS _ 27) -> cont 27#;+ PT _ (TS _ 28) -> cont 28#;+ PT _ (TS _ 29) -> cont 29#;+ PT _ (TS _ 30) -> cont 30#;+ PT _ (TS _ 31) -> cont 31#;+ PT _ (TS _ 32) -> cont 32#;+ PT _ (TS _ 33) -> cont 33#;+ PT _ (TS _ 34) -> cont 34#;+ PT _ (TS _ 35) -> cont 35#;+ PT _ (TS _ 36) -> cont 36#;+ PT _ (TS _ 37) -> cont 37#;+ PT _ (TS _ 38) -> cont 38#;+ PT _ (TS _ 39) -> cont 39#;+ PT _ (TC happy_dollar_dollar) -> cont 40#;+ PT _ (TD happy_dollar_dollar) -> cont 41#;+ PT _ (TI happy_dollar_dollar) -> cont 42#;+ PT _ (TL happy_dollar_dollar) -> cont 43#;+ PT _ (T_Identifier _) -> cont 44#;+ _ -> happyError' ((tk:tks), [])+ }++happyError_ explist 45# tk tks = happyError' (tks, explist)+happyError_ explist _ tk tks = happyError' ((tk:tks), explist)++happyThen :: () => Either String a -> (a -> Either String b) -> Either String b+happyThen = ((>>=))+happyReturn :: () => a -> Either String a+happyReturn = (return)+happyThen1 m k tks = ((>>=)) m (\a -> k a tks)+happyReturn1 :: () => a -> b -> Either String a+happyReturn1 = \a tks -> (return) a+happyError' :: () => ([(Token)], [String]) -> Either String a+happyError' = (\(tokens, _) -> happyError tokens)+pGrammar tks = happySomeParser where+ happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (let {(HappyWrap32 x') = happyOut32 x} in x'))++pListDef tks = happySomeParser where+ happySomeParser = happyThen (happyParse 1# tks) (\x -> happyReturn (let {(HappyWrap33 x') = happyOut33 x} in x'))++pDef tks = happySomeParser where+ happySomeParser = happyThen (happyParse 2# tks) (\x -> happyReturn (let {(HappyWrap34 x') = happyOut34 x} in x'))++pItem tks = happySomeParser where+ happySomeParser = happyThen (happyParse 3# tks) (\x -> happyReturn (let {(HappyWrap35 x') = happyOut35 x} in x'))++pListItem tks = happySomeParser where+ happySomeParser = happyThen (happyParse 4# tks) (\x -> happyReturn (let {(HappyWrap36 x') = happyOut36 x} in x'))++pCat tks = happySomeParser where+ happySomeParser = happyThen (happyParse 5# tks) (\x -> happyReturn (let {(HappyWrap37 x') = happyOut37 x} in x'))++pListCat tks = happySomeParser where+ happySomeParser = happyThen (happyParse 6# tks) (\x -> happyReturn (let {(HappyWrap38 x') = happyOut38 x} in x'))++pLabel tks = happySomeParser where+ happySomeParser = happyThen (happyParse 7# tks) (\x -> happyReturn (let {(HappyWrap39 x') = happyOut39 x} in x'))++pArg tks = happySomeParser where+ happySomeParser = happyThen (happyParse 8# tks) (\x -> happyReturn (let {(HappyWrap40 x') = happyOut40 x} in x'))++pListArg tks = happySomeParser where+ happySomeParser = happyThen (happyParse 9# tks) (\x -> happyReturn (let {(HappyWrap41 x') = happyOut41 x} in x'))++pSeparation tks = happySomeParser where+ happySomeParser = happyThen (happyParse 10# tks) (\x -> happyReturn (let {(HappyWrap42 x') = happyOut42 x} in x'))++pListString tks = happySomeParser where+ happySomeParser = happyThen (happyParse 11# tks) (\x -> happyReturn (let {(HappyWrap43 x') = happyOut43 x} in x'))++pExp tks = happySomeParser where+ happySomeParser = happyThen (happyParse 12# tks) (\x -> happyReturn (let {(HappyWrap44 x') = happyOut44 x} in x'))++pExp1 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 13# tks) (\x -> happyReturn (let {(HappyWrap45 x') = happyOut45 x} in x'))++pExp2 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 14# tks) (\x -> happyReturn (let {(HappyWrap46 x') = happyOut46 x} in x'))++pListExp tks = happySomeParser where+ happySomeParser = happyThen (happyParse 15# tks) (\x -> happyReturn (let {(HappyWrap47 x') = happyOut47 x} in x'))++pListExp2 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 16# tks) (\x -> happyReturn (let {(HappyWrap48 x') = happyOut48 x} in x'))++pRHS tks = happySomeParser where+ happySomeParser = happyThen (happyParse 17# tks) (\x -> happyReturn (let {(HappyWrap49 x') = happyOut49 x} in x'))++pListRHS tks = happySomeParser where+ happySomeParser = happyThen (happyParse 18# tks) (\x -> happyReturn (let {(HappyWrap50 x') = happyOut50 x} in x'))++pMinimumSize tks = happySomeParser where+ happySomeParser = happyThen (happyParse 19# tks) (\x -> happyReturn (let {(HappyWrap51 x') = happyOut51 x} in x'))++pReg tks = happySomeParser where+ happySomeParser = happyThen (happyParse 20# tks) (\x -> happyReturn (let {(HappyWrap52 x') = happyOut52 x} in x'))++pReg1 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 21# tks) (\x -> happyReturn (let {(HappyWrap53 x') = happyOut53 x} in x'))++pReg2 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 22# tks) (\x -> happyReturn (let {(HappyWrap54 x') = happyOut54 x} in x'))++pReg3 tks = happySomeParser where+ happySomeParser = happyThen (happyParse 23# tks) (\x -> happyReturn (let {(HappyWrap55 x') = happyOut55 x} in x'))++happySeq = happyDontSeq+++happyError :: [Token] -> Either String a+happyError ts = Left $+ "syntax error at " ++ tokenPos ts +++ case ts of+ [] -> []+ [Err _] -> " due to lexer error"+ t:_ -> " before `" ++ (prToken t) ++ "'"++myLexer = tokens+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- $Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp $++++++++++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool)+#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool)+#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool)+#else+#define LT(n,m) (n Happy_GHC_Exts.<# m)+#define GTE(n,m) (n Happy_GHC_Exts.>=# m)+#define EQ(n,m) (n Happy_GHC_Exts.==# m)+#endif++++++++++++++++++++data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList+++++++++++++++++++++++++++++++++++++++++infixr 9 `HappyStk`+data HappyStk a = HappyStk a (HappyStk a)++-----------------------------------------------------------------------------+-- starting the parse++happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll++-----------------------------------------------------------------------------+-- Accepting the parse++-- If the current token is ERROR_TOK, it means we've just accepted a partial+-- parse (a %partial parser). We must ignore the saved token on the top of+-- the stack in this case.+happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =+ happyReturn1 ans+happyAccept j tk st sts (HappyStk ans _) = + (happyTcHack j (happyTcHack st)) (happyReturn1 ans)++-----------------------------------------------------------------------------+-- Arrays only: do the next action++++happyDoAction i tk st+ = {- nothing -}+ case action of+ 0# -> {- nothing -}+ happyFail (happyExpListPerState ((Happy_GHC_Exts.I# (st)) :: Int)) i tk st+ -1# -> {- nothing -}+ happyAccept i tk st+ n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -}+ (happyReduceArr Happy_Data_Array.! rule) i tk st+ where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))+ n -> {- nothing -}+ happyShift new_state i tk st+ where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))+ where off = happyAdjustOffset (indexShortOffAddr happyActOffsets st)+ off_i = (off Happy_GHC_Exts.+# i)+ check = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#))+ then EQ(indexShortOffAddr happyCheck off_i, i)+ else False+ action+ | check = indexShortOffAddr happyTable off_i+ | otherwise = indexShortOffAddr happyDefActions st+++++indexShortOffAddr (HappyA# arr) off =+ Happy_GHC_Exts.narrow16Int# i+ where+ i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low)+ high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))+ low = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off'))+ off' = off Happy_GHC_Exts.*# 2#+++++{-# INLINE happyLt #-}+happyLt x y = LT(x,y)+++readArrayBit arr bit =+ Bits.testBit (Happy_GHC_Exts.I# (indexShortOffAddr arr ((unbox_int bit) `Happy_GHC_Exts.iShiftRA#` 4#))) (bit `mod` 16)+ where unbox_int (Happy_GHC_Exts.I# x) = x+++++++data HappyAddr = HappyA# Happy_GHC_Exts.Addr#+++-----------------------------------------------------------------------------+-- HappyState data type (not arrays)++++++++++++++-----------------------------------------------------------------------------+-- Shifting a token++happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =+ let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+-- trace "shifting the error token" $+ happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)++happyShift new_state i tk st sts stk =+ happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)++-- happyReduce is specialised for the common cases.++happySpecReduce_0 i fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happySpecReduce_0 nt fn j tk st@((action)) sts stk+ = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)++happySpecReduce_1 i fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')+ = let r = fn v1 in+ happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_2 i fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')+ = let r = fn v1 v2 in+ happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_3 i fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')+ = let r = fn v1 v2 v3 in+ happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happyReduce k i fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happyReduce k nt fn j tk st sts stk+ = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of+ sts1@((HappyCons (st1@(action)) (_))) ->+ let r = fn stk in -- it doesn't hurt to always seq here...+ happyDoSeq r (happyGoto nt j tk st1 sts1 r)++happyMonadReduce k nt fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happyMonadReduce k nt fn j tk st sts stk =+ case happyDrop k (HappyCons (st) (sts)) of+ sts1@((HappyCons (st1@(action)) (_))) ->+ let drop_stk = happyDropStk k stk in+ happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))++happyMonad2Reduce k nt fn 0# tk st sts stk+ = happyFail [] 0# tk st sts stk+happyMonad2Reduce k nt fn j tk st sts stk =+ case happyDrop k (HappyCons (st) (sts)) of+ sts1@((HappyCons (st1@(action)) (_))) ->+ let drop_stk = happyDropStk k stk++ off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st1)+ off_i = (off Happy_GHC_Exts.+# nt)+ new_state = indexShortOffAddr happyTable off_i+++++ in+ happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))++happyDrop 0# l = l+happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t++happyDropStk 0# l = l+happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs++-----------------------------------------------------------------------------+-- Moving to a new state after a reduction+++happyGoto nt j tk st = + {- nothing -}+ happyDoAction j tk new_state+ where off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st)+ off_i = (off Happy_GHC_Exts.+# nt)+ new_state = indexShortOffAddr happyTable off_i+++++-----------------------------------------------------------------------------+-- Error recovery (ERROR_TOK is the error token)++-- parse error if we are in recovery and we fail again+happyFail explist 0# tk old_st _ stk@(x `HappyStk` _) =+ let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+-- trace "failing" $ + happyError_ explist i tk++{- We don't need state discarding for our restricted implementation of+ "error". In fact, it can cause some bogus parses, so I've disabled it+ for now --SDM++-- discard a state+happyFail ERROR_TOK tk old_st CONS(HAPPYSTATE(action),sts) + (saved_tok `HappyStk` _ `HappyStk` stk) =+-- trace ("discarding state, depth " ++ show (length stk)) $+ DO_ACTION(action,ERROR_TOK,tk,sts,(saved_tok`HappyStk`stk))+-}++-- Enter error recovery: generate an error token,+-- save the old token and carry on.+happyFail explist i tk (action) sts stk =+-- trace "entering error recovery" $+ happyDoAction 0# tk action sts ((Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk)++-- Internal happy errors:++notHappyAtAll :: a+notHappyAtAll = error "Internal Happy error\n"++-----------------------------------------------------------------------------+-- Hack to get the typechecker to accept our action functions+++happyTcHack :: Happy_GHC_Exts.Int# -> a -> a+happyTcHack x y = y+{-# INLINE happyTcHack #-}+++-----------------------------------------------------------------------------+-- Seq-ing. If the --strict flag is given, then Happy emits +-- happySeq = happyDoSeq+-- otherwise it emits+-- happySeq = happyDontSeq++happyDoSeq, happyDontSeq :: a -> b -> b+happyDoSeq a b = a `seq` b+happyDontSeq a b = b++-----------------------------------------------------------------------------+-- Don't inline any functions from the template. GHC has a nasty habit+-- of deciding to inline happyGoto everywhere, which increases the size of+-- the generated parser quite a bit.+++{-# NOINLINE happyDoAction #-}+{-# NOINLINE happyTable #-}+{-# NOINLINE happyCheck #-}+{-# NOINLINE happyActOffsets #-}+{-# NOINLINE happyGotoOffsets #-}+{-# NOINLINE happyDefActions #-}++{-# NOINLINE happyShift #-}+{-# NOINLINE happySpecReduce_0 #-}+{-# NOINLINE happySpecReduce_1 #-}+{-# NOINLINE happySpecReduce_2 #-}+{-# NOINLINE happySpecReduce_3 #-}+{-# NOINLINE happyReduce #-}+{-# NOINLINE happyMonadReduce #-}+{-# NOINLINE happyGoto #-}+{-# NOINLINE happyFail #-}++-- end of Happy Template.
+ src/BNFC/Par.y view
@@ -0,0 +1,259 @@+-- This Happy file was machine-generated by the BNF converter+{+{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}+module BNFC.Par+ ( happyError+ , myLexer+ , pGrammar+ , pListDef+ , pDef+ , pItem+ , pListItem+ , pCat+ , pListCat+ , pLabel+ , pArg+ , pListArg+ , pSeparation+ , pListString+ , pExp+ , pExp1+ , pExp2+ , pListExp+ , pListExp2+ , pRHS+ , pListRHS+ , pMinimumSize+ , pReg+ , pReg1+ , pReg2+ , pReg3+ ) where+import qualified BNFC.Abs+import BNFC.Lex+}++%name pGrammar Grammar+%name pListDef ListDef+%name pDef Def+%name pItem Item+%name pListItem ListItem+%name pCat Cat+%name pListCat ListCat+%name pLabel Label+%name pArg Arg+%name pListArg ListArg+%name pSeparation Separation+%name pListString ListString+%name pExp Exp+%name pExp1 Exp1+%name pExp2 Exp2+%name pListExp ListExp+%name pListExp2 ListExp2+%name pRHS RHS+%name pListRHS ListRHS+%name pMinimumSize MinimumSize+%name pReg Reg+%name pReg1 Reg1+%name pReg2 Reg2+%name pReg3 Reg3+-- no lexer declaration+%monad { Either String } { (>>=) } { return }+%tokentype {Token}+%token+ '(' { PT _ (TS _ 1) }+ ')' { PT _ (TS _ 2) }+ '*' { PT _ (TS _ 3) }+ '+' { PT _ (TS _ 4) }+ ',' { PT _ (TS _ 5) }+ '-' { PT _ (TS _ 6) }+ '.' { PT _ (TS _ 7) }+ ':' { PT _ (TS _ 8) }+ '::=' { PT _ (TS _ 9) }+ ';' { PT _ (TS _ 10) }+ '=' { PT _ (TS _ 11) }+ '?' { PT _ (TS _ 12) }+ '[' { PT _ (TS _ 13) }+ ']' { PT _ (TS _ 14) }+ '_' { PT _ (TS _ 15) }+ 'char' { PT _ (TS _ 16) }+ 'coercions' { PT _ (TS _ 17) }+ 'comment' { PT _ (TS _ 18) }+ 'define' { PT _ (TS _ 19) }+ 'delimiters' { PT _ (TS _ 20) }+ 'digit' { PT _ (TS _ 21) }+ 'entrypoints' { PT _ (TS _ 22) }+ 'eps' { PT _ (TS _ 23) }+ 'internal' { PT _ (TS _ 24) }+ 'layout' { PT _ (TS _ 25) }+ 'letter' { PT _ (TS _ 26) }+ 'lower' { PT _ (TS _ 27) }+ 'nonempty' { PT _ (TS _ 28) }+ 'position' { PT _ (TS _ 29) }+ 'rules' { PT _ (TS _ 30) }+ 'separator' { PT _ (TS _ 31) }+ 'stop' { PT _ (TS _ 32) }+ 'terminator' { PT _ (TS _ 33) }+ 'token' { PT _ (TS _ 34) }+ 'toplevel' { PT _ (TS _ 35) }+ 'upper' { PT _ (TS _ 36) }+ '{' { PT _ (TS _ 37) }+ '|' { PT _ (TS _ 38) }+ '}' { PT _ (TS _ 39) }+ L_charac { PT _ (TC $$) }+ L_doubl { PT _ (TD $$) }+ L_integ { PT _ (TI $$) }+ L_quoted { PT _ (TL $$) }+ L_Identifier { PT _ (T_Identifier _) }++%%++Char :: { Char }+Char : L_charac { (read ($1)) :: Char }++Double :: { Double }+Double : L_doubl { (read ($1)) :: Double }++Integer :: { Integer }+Integer : L_integ { (read ($1)) :: Integer }++String :: { String }+String : L_quoted { $1 }++Identifier :: { BNFC.Abs.Identifier}+Identifier : L_Identifier { BNFC.Abs.Identifier (mkPosToken $1) }++Grammar :: { BNFC.Abs.Grammar }+Grammar : ListDef { BNFC.Abs.Grammar $1 }++ListDef :: { [BNFC.Abs.Def] }+ListDef : {- empty -} { [] }+ | Def { (:[]) $1 }+ | Def ';' ListDef { (:) $1 $3 }+ | ';' ListDef { $2 }++Def :: { BNFC.Abs.Def }+Def : Label '.' Cat '::=' ListItem { BNFC.Abs.Rule $1 $3 $5 }+ | 'comment' String { BNFC.Abs.Comment $2 }+ | 'comment' String String { BNFC.Abs.Comments $2 $3 }+ | 'internal' Label '.' Cat '::=' ListItem { BNFC.Abs.Internal $2 $4 $6 }+ | 'token' Identifier Reg { BNFC.Abs.Token $2 $3 }+ | 'position' 'token' Identifier Reg { BNFC.Abs.PosToken $3 $4 }+ | 'entrypoints' ListCat { BNFC.Abs.Entryp $2 }+ | 'separator' MinimumSize Cat String { BNFC.Abs.Separator $2 $3 $4 }+ | 'terminator' MinimumSize Cat String { BNFC.Abs.Terminator $2 $3 $4 }+ | 'delimiters' Cat String String Separation MinimumSize { BNFC.Abs.Delimiters $2 $3 $4 $5 $6 }+ | 'coercions' Identifier Integer { BNFC.Abs.Coercions $2 $3 }+ | 'rules' Identifier '::=' ListRHS { BNFC.Abs.Rules $2 $4 }+ | 'define' Identifier ListArg '=' Exp { BNFC.Abs.Function $2 $3 $5 }+ | 'layout' ListString { BNFC.Abs.Layout $2 }+ | 'layout' 'stop' ListString { BNFC.Abs.LayoutStop $3 }+ | 'layout' 'toplevel' { BNFC.Abs.LayoutTop }++Item :: { BNFC.Abs.Item }+Item : String { BNFC.Abs.Terminal $1 }+ | Cat { BNFC.Abs.NTerminal $1 }++ListItem :: { [BNFC.Abs.Item] }+ListItem : {- empty -} { [] } | Item ListItem { (:) $1 $2 }++Cat :: { BNFC.Abs.Cat }+Cat : '[' Cat ']' { BNFC.Abs.ListCat $2 }+ | Identifier { BNFC.Abs.IdCat $1 }++ListCat :: { [BNFC.Abs.Cat] }+ListCat : {- empty -} { [] }+ | Cat { (:[]) $1 }+ | Cat ',' ListCat { (:) $1 $3 }++Label :: { BNFC.Abs.Label }+Label : Identifier { BNFC.Abs.Id $1 }+ | '_' { BNFC.Abs.Wild }+ | '[' ']' { BNFC.Abs.ListE }+ | '(' ':' ')' { BNFC.Abs.ListCons }+ | '(' ':' '[' ']' ')' { BNFC.Abs.ListOne }++Arg :: { BNFC.Abs.Arg }+Arg : Identifier { BNFC.Abs.Arg $1 }++ListArg :: { [BNFC.Abs.Arg] }+ListArg : {- empty -} { [] } | Arg ListArg { (:) $1 $2 }++Separation :: { BNFC.Abs.Separation }+Separation : {- empty -} { BNFC.Abs.SepNone }+ | 'terminator' String { BNFC.Abs.SepTerm $2 }+ | 'separator' String { BNFC.Abs.SepSepar $2 }++ListString :: { [String] }+ListString : String { (:[]) $1 }+ | String ',' ListString { (:) $1 $3 }++Exp :: { BNFC.Abs.Exp }+Exp : Exp1 ':' Exp { BNFC.Abs.Cons $1 $3 } | Exp1 { $1 }++Exp1 :: { BNFC.Abs.Exp }+Exp1 : Identifier ListExp2 { BNFC.Abs.App $1 $2 } | Exp2 { $1 }++Exp2 :: { BNFC.Abs.Exp }+Exp2 : Identifier { BNFC.Abs.Var $1 }+ | Integer { BNFC.Abs.LitInt $1 }+ | Char { BNFC.Abs.LitChar $1 }+ | String { BNFC.Abs.LitString $1 }+ | Double { BNFC.Abs.LitDouble $1 }+ | '[' ListExp ']' { BNFC.Abs.List $2 }+ | '(' Exp ')' { $2 }++ListExp :: { [BNFC.Abs.Exp] }+ListExp : {- empty -} { [] }+ | Exp { (:[]) $1 }+ | Exp ',' ListExp { (:) $1 $3 }++ListExp2 :: { [BNFC.Abs.Exp] }+ListExp2 : Exp2 { (:[]) $1 } | Exp2 ListExp2 { (:) $1 $2 }++RHS :: { BNFC.Abs.RHS }+RHS : ListItem { BNFC.Abs.RHS $1 }++ListRHS :: { [BNFC.Abs.RHS] }+ListRHS : RHS { (:[]) $1 } | RHS '|' ListRHS { (:) $1 $3 }++MinimumSize :: { BNFC.Abs.MinimumSize }+MinimumSize : 'nonempty' { BNFC.Abs.MNonempty }+ | {- empty -} { BNFC.Abs.MEmpty }++Reg :: { BNFC.Abs.Reg }+Reg : Reg '|' Reg1 { BNFC.Abs.RAlt $1 $3 } | Reg1 { $1 }++Reg1 :: { BNFC.Abs.Reg }+Reg1 : Reg1 '-' Reg2 { BNFC.Abs.RMinus $1 $3 } | Reg2 { $1 }++Reg2 :: { BNFC.Abs.Reg }+Reg2 : Reg2 Reg3 { BNFC.Abs.RSeq $1 $2 } | Reg3 { $1 }++Reg3 :: { BNFC.Abs.Reg }+Reg3 : Reg3 '*' { BNFC.Abs.RStar $1 }+ | Reg3 '+' { BNFC.Abs.RPlus $1 }+ | Reg3 '?' { BNFC.Abs.ROpt $1 }+ | 'eps' { BNFC.Abs.REps }+ | Char { BNFC.Abs.RChar $1 }+ | '[' String ']' { BNFC.Abs.RAlts $2 }+ | '{' String '}' { BNFC.Abs.RSeqs $2 }+ | 'digit' { BNFC.Abs.RDigit }+ | 'letter' { BNFC.Abs.RLetter }+ | 'upper' { BNFC.Abs.RUpper }+ | 'lower' { BNFC.Abs.RLower }+ | 'char' { BNFC.Abs.RAny }+ | '(' Reg ')' { $2 }+{++happyError :: [Token] -> Either String a+happyError ts = Left $+ "syntax error at " ++ tokenPos ts +++ case ts of+ [] -> []+ [Err _] -> " due to lexer error"+ t:_ -> " before `" ++ (prToken t) ++ "'"++myLexer = tokens+}+
src/BNFC/PrettyPrint.hs view
@@ -61,15 +61,6 @@ vcat' :: [Doc] -> Doc vcat' = foldl ($+$) empty --- | Pretty print separator with a dot.------ >>> "abc" <.> "py"--- abc.py----(<.>) :: Doc -> Doc -> Doc-a <.> b = hcat [ a , text "." , b ]- -- Andreas A, 2019-02-07: avoiding <> due to clash with Semigroup- -- | Pretty print separator with = (for assignments...). -- -- >>> "a" <=> "123"
+ src/BNFC/Print.hs view
@@ -0,0 +1,230 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ <= 708+{-# LANGUAGE OverlappingInstances #-}+#endif+{-# LANGUAGE FlexibleInstances #-}+{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}++-- | Pretty-printer for BNFC.+-- Generated by the BNF converter.++module BNFC.Print where++import qualified BNFC.Abs+import Data.Char++-- | The top-level printing method.++printTree :: Print a => a -> String+printTree = render . prt 0++type Doc = [ShowS] -> [ShowS]++doc :: ShowS -> Doc+doc = (:)++render :: Doc -> String+render d = rend 0 (map ($ "") $ d []) "" where+ rend i ss = case ss of+ "[" :ts -> showChar '[' . rend i ts+ "(" :ts -> showChar '(' . rend i ts+ "{" :ts -> showChar '{' . new (i+1) . rend (i+1) ts+ "}" : ";":ts -> new (i-1) . space "}" . showChar ';' . new (i-1) . rend (i-1) ts+ "}" :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts+ [";"] -> showChar ';'+ ";" :ts -> showChar ';' . new i . rend i ts+ t : ts@(p:_) | closingOrPunctuation p -> showString t . rend i ts+ t :ts -> space t . rend i ts+ _ -> id+ new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace+ space t s =+ case (all isSpace t', null spc, null rest) of+ (True , _ , True ) -> [] -- remove trailing space+ (False, _ , True ) -> t' -- remove trailing space+ (False, True, False) -> t' ++ ' ' : s -- add space if none+ _ -> t' ++ s+ where+ t' = showString t []+ (spc, rest) = span isSpace s++ closingOrPunctuation :: String -> Bool+ closingOrPunctuation [c] = c `elem` closerOrPunct+ closingOrPunctuation _ = False++ closerOrPunct :: String+ closerOrPunct = ")],;"++parenth :: Doc -> Doc+parenth ss = doc (showChar '(') . ss . doc (showChar ')')++concatS :: [ShowS] -> ShowS+concatS = foldr (.) id++concatD :: [Doc] -> Doc+concatD = foldr (.) id++replicateS :: Int -> ShowS -> ShowS+replicateS n f = concatS (replicate n f)++-- | The printer class does the job.++class Print a where+ prt :: Int -> a -> Doc+ prtList :: Int -> [a] -> Doc+ prtList i = concatD . map (prt i)++instance {-# OVERLAPPABLE #-} Print a => Print [a] where+ prt = prtList++instance Print Char where+ prt _ s = doc (showChar '\'' . mkEsc '\'' s . showChar '\'')+ prtList _ s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"')++mkEsc :: Char -> Char -> ShowS+mkEsc q s = case s of+ _ | s == q -> showChar '\\' . showChar s+ '\\'-> showString "\\\\"+ '\n' -> showString "\\n"+ '\t' -> showString "\\t"+ _ -> showChar s++prPrec :: Int -> Int -> Doc -> Doc+prPrec i j = if j < i then parenth else id++instance Print Integer where+ prt _ x = doc (shows x)++instance Print Double where+ prt _ x = doc (shows x)++instance Print BNFC.Abs.Identifier where+ prt _ (BNFC.Abs.Identifier (_,i)) = doc $ showString $ i++instance Print BNFC.Abs.Grammar where+ prt i e = case e of+ BNFC.Abs.Grammar defs -> prPrec i 0 (concatD [prt 0 defs])++instance Print [BNFC.Abs.Def] where+ prt = prtList++instance Print BNFC.Abs.Def where+ prt i e = case e of+ BNFC.Abs.Rule label cat items -> prPrec i 0 (concatD [prt 0 label, doc (showString "."), prt 0 cat, doc (showString "::="), prt 0 items])+ BNFC.Abs.Comment str -> prPrec i 0 (concatD [doc (showString "comment"), prt 0 str])+ BNFC.Abs.Comments str1 str2 -> prPrec i 0 (concatD [doc (showString "comment"), prt 0 str1, prt 0 str2])+ BNFC.Abs.Internal label cat items -> prPrec i 0 (concatD [doc (showString "internal"), prt 0 label, doc (showString "."), prt 0 cat, doc (showString "::="), prt 0 items])+ BNFC.Abs.Token identifier reg -> prPrec i 0 (concatD [doc (showString "token"), prt 0 identifier, prt 0 reg])+ BNFC.Abs.PosToken identifier reg -> prPrec i 0 (concatD [doc (showString "position"), doc (showString "token"), prt 0 identifier, prt 0 reg])+ BNFC.Abs.Entryp cats -> prPrec i 0 (concatD [doc (showString "entrypoints"), prt 0 cats])+ BNFC.Abs.Separator minimumsize cat str -> prPrec i 0 (concatD [doc (showString "separator"), prt 0 minimumsize, prt 0 cat, prt 0 str])+ BNFC.Abs.Terminator minimumsize cat str -> prPrec i 0 (concatD [doc (showString "terminator"), prt 0 minimumsize, prt 0 cat, prt 0 str])+ BNFC.Abs.Delimiters cat str1 str2 separation minimumsize -> prPrec i 0 (concatD [doc (showString "delimiters"), prt 0 cat, prt 0 str1, prt 0 str2, prt 0 separation, prt 0 minimumsize])+ BNFC.Abs.Coercions identifier n -> prPrec i 0 (concatD [doc (showString "coercions"), prt 0 identifier, prt 0 n])+ BNFC.Abs.Rules identifier rhss -> prPrec i 0 (concatD [doc (showString "rules"), prt 0 identifier, doc (showString "::="), prt 0 rhss])+ BNFC.Abs.Function identifier args exp -> prPrec i 0 (concatD [doc (showString "define"), prt 0 identifier, prt 0 args, doc (showString "="), prt 0 exp])+ BNFC.Abs.Layout strs -> prPrec i 0 (concatD [doc (showString "layout"), prt 0 strs])+ BNFC.Abs.LayoutStop strs -> prPrec i 0 (concatD [doc (showString "layout"), doc (showString "stop"), prt 0 strs])+ BNFC.Abs.LayoutTop -> prPrec i 0 (concatD [doc (showString "layout"), doc (showString "toplevel")])+ prtList _ [] = concatD []+ prtList _ [x] = concatD [prt 0 x]++ prtList _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]++instance Print BNFC.Abs.Item where+ prt i e = case e of+ BNFC.Abs.Terminal str -> prPrec i 0 (concatD [prt 0 str])+ BNFC.Abs.NTerminal cat -> prPrec i 0 (concatD [prt 0 cat])+ prtList _ [] = concatD []+ prtList _ (x:xs) = concatD [prt 0 x, prt 0 xs]++instance Print [BNFC.Abs.Item] where+ prt = prtList++instance Print BNFC.Abs.Cat where+ prt i e = case e of+ BNFC.Abs.ListCat cat -> prPrec i 0 (concatD [doc (showString "["), prt 0 cat, doc (showString "]")])+ BNFC.Abs.IdCat identifier -> prPrec i 0 (concatD [prt 0 identifier])+ prtList _ [] = concatD []+ prtList _ [x] = concatD [prt 0 x]+ prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]++instance Print [BNFC.Abs.Cat] where+ prt = prtList++instance Print BNFC.Abs.Label where+ prt i e = case e of+ BNFC.Abs.Id identifier -> prPrec i 0 (concatD [prt 0 identifier])+ BNFC.Abs.Wild -> prPrec i 0 (concatD [doc (showString "_")])+ BNFC.Abs.ListE -> prPrec i 0 (concatD [doc (showString "["), doc (showString "]")])+ BNFC.Abs.ListCons -> prPrec i 0 (concatD [doc (showString "("), doc (showString ":"), doc (showString ")")])+ BNFC.Abs.ListOne -> prPrec i 0 (concatD [doc (showString "("), doc (showString ":"), doc (showString "["), doc (showString "]"), doc (showString ")")])++instance Print BNFC.Abs.Arg where+ prt i e = case e of+ BNFC.Abs.Arg identifier -> prPrec i 0 (concatD [prt 0 identifier])+ prtList _ [] = concatD []+ prtList _ (x:xs) = concatD [prt 0 x, prt 0 xs]++instance Print [BNFC.Abs.Arg] where+ prt = prtList++instance Print BNFC.Abs.Separation where+ prt i e = case e of+ BNFC.Abs.SepNone -> prPrec i 0 (concatD [])+ BNFC.Abs.SepTerm str -> prPrec i 0 (concatD [doc (showString "terminator"), prt 0 str])+ BNFC.Abs.SepSepar str -> prPrec i 0 (concatD [doc (showString "separator"), prt 0 str])++instance Print [String] where+ prt = prtList++instance Print BNFC.Abs.Exp where+ prt i e = case e of+ BNFC.Abs.Cons exp1 exp2 -> prPrec i 0 (concatD [prt 1 exp1, doc (showString ":"), prt 0 exp2])+ BNFC.Abs.App identifier exps -> prPrec i 1 (concatD [prt 0 identifier, prt 2 exps])+ BNFC.Abs.Var identifier -> prPrec i 2 (concatD [prt 0 identifier])+ BNFC.Abs.LitInt n -> prPrec i 2 (concatD [prt 0 n])+ BNFC.Abs.LitChar c -> prPrec i 2 (concatD [prt 0 c])+ BNFC.Abs.LitString str -> prPrec i 2 (concatD [prt 0 str])+ BNFC.Abs.LitDouble d -> prPrec i 2 (concatD [prt 0 d])+ BNFC.Abs.List exps -> prPrec i 2 (concatD [doc (showString "["), prt 0 exps, doc (showString "]")])+ prtList 2 [x] = concatD [prt 2 x]+ prtList 2 (x:xs) = concatD [prt 2 x, prt 2 xs]+ prtList _ [] = concatD []+ prtList _ [x] = concatD [prt 0 x]+ prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]++instance Print [BNFC.Abs.Exp] where+ prt = prtList++instance Print BNFC.Abs.RHS where+ prt i e = case e of+ BNFC.Abs.RHS items -> prPrec i 0 (concatD [prt 0 items])+ prtList _ [x] = concatD [prt 0 x]+ prtList _ (x:xs) = concatD [prt 0 x, doc (showString "|"), prt 0 xs]++instance Print [BNFC.Abs.RHS] where+ prt = prtList++instance Print BNFC.Abs.MinimumSize where+ prt i e = case e of+ BNFC.Abs.MNonempty -> prPrec i 0 (concatD [doc (showString "nonempty")])+ BNFC.Abs.MEmpty -> prPrec i 0 (concatD [])++instance Print BNFC.Abs.Reg where+ prt i e = case e of+ BNFC.Abs.RAlt reg1 reg2 -> prPrec i 0 (concatD [prt 0 reg1, doc (showString "|"), prt 1 reg2])+ BNFC.Abs.RMinus reg1 reg2 -> prPrec i 1 (concatD [prt 1 reg1, doc (showString "-"), prt 2 reg2])+ BNFC.Abs.RSeq reg1 reg2 -> prPrec i 2 (concatD [prt 2 reg1, prt 3 reg2])+ BNFC.Abs.RStar reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "*")])+ BNFC.Abs.RPlus reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "+")])+ BNFC.Abs.ROpt reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "?")])+ BNFC.Abs.REps -> prPrec i 3 (concatD [doc (showString "eps")])+ BNFC.Abs.RChar c -> prPrec i 3 (concatD [prt 0 c])+ BNFC.Abs.RAlts str -> prPrec i 3 (concatD [doc (showString "["), prt 0 str, doc (showString "]")])+ BNFC.Abs.RSeqs str -> prPrec i 3 (concatD [doc (showString "{"), prt 0 str, doc (showString "}")])+ BNFC.Abs.RDigit -> prPrec i 3 (concatD [doc (showString "digit")])+ BNFC.Abs.RLetter -> prPrec i 3 (concatD [doc (showString "letter")])+ BNFC.Abs.RUpper -> prPrec i 3 (concatD [doc (showString "upper")])+ BNFC.Abs.RLower -> prPrec i 3 (concatD [doc (showString "lower")])+ BNFC.Abs.RAny -> prPrec i 3 (concatD [doc (showString "char")])+
src/BNFC/Regex.hs view
@@ -10,7 +10,7 @@ import qualified Data.Set as Set import qualified Data.List as List -import AbsBNF+import BNFC.Abs -- | Check if a regular expression is nullable (accepts the empty string) nullable :: Reg -> Bool@@ -49,14 +49,14 @@ RPlus r -> Rx $ rPlus $ rloop r ROpt r -> Rx $ rOpt $ rloop r REps -> Rx $ REps- RSeqs "" -> Rx $ REps- RSeqs [c] -> CC $ cChar c- RSeqs s -> Rx $ RSeqs s+ RSeqs [] -> Rx $ REps+ RSeqs s@(_:_:_) -> Rx $ RSeqs s -- Possibly character classes: RSeq r1 r2 -> loop r1 `rcSeq` loop r2 RAlt r1 r2 -> loop r1 `rcAlt` loop r2 RMinus r1 r2 -> loop r1 `rcMinus` loop r2 -- Definitely character classes:+ RSeqs [c] -> CC $ cChar c RChar c -> CC $ cChar c RAlts s -> CC $ cAlts s RDigit -> CC $ cDigit
− src/BNFC/ToCNFCore.hs
@@ -1,315 +0,0 @@-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, CPP #-}-{-# LANGUAGE RecordWildCards #-}-{-- Copyright (C) 2012 Authors:- Jean-Philippe Bernardy.-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}--{-# LANGUAGE OverloadedStrings #-}--module BNFC.ToCNFCore (toCNF, isCat, group', catTag, punctuate', onRules, isUnitRule, splitOptim, second, lookupMulti,- Set, CatDescriptions, UnitRel, RHSEl, Exp(..), prettyExp, appMany, app',after) where--{---Construction of CYK tables. The algorithm follows:--Lange, Martin; Leiß, Hans (2009), "To CNF or not to CNF? An Efficient-Yet Presentable Version of the CYK Algorithm", Informatica Didactica---}--import BNFC.CF hiding (App,Exp)-import Control.Monad.RWS-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative hiding (Const)-#endif--import Data.Bifunctor (second)-import Data.Char (isAlphaNum, ord)-import Data.Function (on)-import Data.Functor (($>))-import Data.List (nub, sortBy, sort)-import Data.Map (Map)-import qualified Data.Map as Map-import Data.Pair--import Text.PrettyPrint.HughesPJ hiding (first, (<>))--onRules ::([Rul f] -> [Rul g]) -> CFG f -> CFG g-onRules f cfg@CFG{..} = cfg { cfgRules = f cfgRules }--toCNF :: IsFun a => CFG a- -> (CFG Exp, CFG Exp, UnitRel Cat, CatDescriptions,- [(Either Cat String, [Either Cat String])])-toCNF cf0 = (cf1,cf2,units,descriptions,neighbors)- where cf01 = funToExp . onRules (filter isParsable) $ cf0- (rules',descriptions) = toBin (cfgRules cf01)- cf1 = cf01 { cfgRules = rules' }- cf2 = delNull cf1- units = unitSet cf2- neighbors = neighborSet cf2--funToExp :: IsFun a => CFG a -> CFG Exp-funToExp = fmap toExp--toExp :: IsFun a => a -> Exp-toExp f | isCoercion f = Id- | otherwise = Con $ funName f--isCat (Right _) = False-isCat (Left _) = True---group0 :: Eq a => [(a,[b])] -> [(a,[b])]-group0 [] = []-group0 ((a,bs):xs) = (a,bs ++ concatMap snd ys) : group0 zs- where (ys,zs) = span (\x -> fst x == a) xs--group' :: Ord a => [(a,[b])] -> [(a,[b])]-group' = group0 . sortBy (compare `on` fst)--catTag :: Either Cat String -> Doc-catTag (Left c) = "CAT_" <> text (concatMap escape (show c))-catTag (Right t) = "TOK_" <> text (concatMap escapeToken t)--escape c | isAlphaNum c || c == '_' = [c]-escape '[' = ""-escape ']' = "_List"-escape '{' = "OPEN_"-escape '}' = "CLOS_"-escape '@' = "BIN_"-escape c = show (ord c) ++ "_"--escapeToken c | isAlphaNum c || c == '_' = [c]-escapeToken '(' = "LPAREN_"-escapeToken ')' = "RPAREN_"-escapeToken '[' = "LBRACKET_"-escapeToken ']' = "RBRACKET_"-escapeToken '{' = "LBRACE_"-escapeToken '}' = "RBRACE_"-escapeToken '~' = "TILDE_"-escapeToken '^' = "CARET_"-escapeToken '*' = "STAR_"-escapeToken '+' = "PLUS_"-escapeToken '-' = "DASH_"-escapeToken '/' = "SLASH_"-escapeToken '.' = "DOT_"-escapeToken ',' = "COMMA_"-escapeToken ';' = "SEMI_"-escapeToken ':' = "COLON_"-escapeToken '=' = "EQ_"-escapeToken '<' = "LT_"-escapeToken '>' = "GT_"-escapeToken '&' = "AMP_"-escapeToken '|' = "BAR_"-escapeToken '%' = "PERCENT_"-escapeToken '?' = "QUESTION_"-escapeToken '!' = "BANG_"--- add more if you have fun--- or fall back to ASCII code:-escapeToken c = show (ord c) ++ "_"--punctuate' p = cat . punctuate p------------------------------------------------------------------ BIN: make sure no rule has more than 2 symbols on the rhs--allocateCatName = do- n <- get- put (1+n)- return $ show n--toBin :: [Rul Exp] -> ([Rul Exp], CatDescriptions)-toBin cf = (a,w)- where (a,_,w) = runRWS (concat <$> forM cf toBinRul) () 0--type CatDescriptions = Map Cat Doc---- | Convert a rule into a number of equivalent rules with at most 2--- symbols on the rhs.--- Also writes an explanation of what new categories are.-toBinRul :: Rul Exp -> RWS () CatDescriptions Int [Rul Exp]-toBinRul (Rule f cat rhs internal) | length rhs > 2 = do- cat' <- liftM Cat allocateCatName- r' <- toBinRul $ Rule f (cat $> cat') p internal- tell $ Map.singleton cat' (int (length p) <> "-prefix of " <> prettyExp f <> " " <> parens (prettyRHS p))- return $ Rule (Con "($)") cat [Left cat',l] internal- : r'- where l = last rhs- p = init rhs-toBinRul r = return [r]--prettyRHS = hcat . punctuate " " . map (either (text . show) (quotes . text))-------------------------------- Fixpoint utilities--x ∪ y = sort $ nub (x ++ y)--lookupMulti cat nullset = maybe [] id (Map.lookup cat nullset)--type Set k x = Map k [x]--fixpointOnGrammar :: (Show k, Show x,Ord k, Ord x) => String -> (Set k x -> Rul f -> Set k x) -> CFG f -> Set k x-fixpointOnGrammar name f cf = case fixn 100 step Map.empty of- Left x -> error $ "Could not find fixpoint of " ++ name ++". Last iteration:\n" ++ show x- Right x -> x- where step curSet = Map.unionsWith (∪) (map (f curSet) (cfgRules cf))--fixn :: Eq a => Int -> (a -> a) -> a -> Either a a-fixn 0 _ x = Left x-fixn n f x = if x' == x then Right x else fixn (n-1) f x'- where x' = f x------------------------------------------------------------ DEL : make sure no rule has 0 symbol on the rhs--type Nullable = Set Cat Exp--cross :: [[a]] -> [[a]]-cross [] = [[]]-cross (x:xs) = [y:ys | y <- x, ys <- cross xs]--nullRule :: Nullable -> Rul Exp -> (Cat,[Exp])-nullRule nullset (Rule f c rhs _) = (wpThing c, map (appMany f) (cross (map nulls rhs)))- where nulls (Right _) = []- nulls (Left cat) = lookupMulti cat nullset--nullSet :: CFG Exp -> Nullable-nullSet = fixpointOnGrammar "nullable" (\s r -> uncurry Map.singleton (nullRule s r))---- | Replace nullable occurences by nothing, and adapt the function consequently.-delNullable :: Nullable -> Rul Exp -> [Rul Exp]-delNullable nullset r@(Rule f cat rhs internal) = case rhs of- [] -> []- [_] -> [r]- [r1,r2] -> [r] ++ [Rule (app' f x) cat [r2] internal | x <- lk' r1]- ++ [Rule (app2 (isCat r1) f x) cat [r1] internal | x <- lk' r2]- _ -> error $ "Panic:" ++ show r ++ "should have at most two elements."- where lk' (Right _) = []- lk' (Left cat) = lookupMulti cat nullset--delNull :: CFG Exp -> CFG Exp-delNull cf = onRules (concatMap (delNullable (nullSet cf))) cf--------------------- UNIT--type UnitRel cat = Set (Either cat String) (Exp,cat)---- (c,(f,c')) ∈ unitSet ⇒ f : c → c'--unitSet :: CFG Exp -> UnitRel Cat-unitSet = fixpointOnGrammar "unit set" unitRule--unitRule unitSet (Rule f (WithPosition _ c) [r] _internal) = Map.singleton r $- (f,c) : [(g `appl` f,c') | (g,c') <- lookupMulti (Left c) unitSet]- where appl = case r of- Left _ -> after- Right _ -> app'-unitRule _ _ = Map.empty--isUnitRule (Rule _ _ [_] _) = True-isUnitRule _ = False------------------------------ Left/Right occurences-type RHSEl = Either Cat String--isOnLeft, isOnRight :: RHSEl -> Rul f -> Bool-isOnLeft c (Rule _ _ [c',_] _) = c == c'-isOnLeft _ _ = False--isOnRight c (Rule _ _ [_,c'] _) = c == c'-isOnRight _ _ = False--isEntryPoint cf el = either (`elem` allEntryPoints cf) (const False) el--occurs :: (RHSEl -> Rul f -> Bool) -> RHSEl -> CFG f -> Bool-occurs where_ el cf = any (where_ el) (cfgRules cf)--splitLROn :: (a -> RHSEl) -> CFG f -> [a] -> Pair [a]-splitLROn f cf xs = filt <*> pure xs- where filt = filter (\c -> occurs isOnLeft (f c) cf || isEntryPoint cf (f c)) :/:- filter (\c -> occurs isOnRight (f c) cf)--isSpecial (Left (Cat ('@':'@':_))) = True-isSpecial _ = False--optim :: (a -> RHSEl) -> Pair [a] -> Pair [(a,Doc -> Doc)]-optim f (x:/:y) = map modif x :/: map modif' y- where modif a | isSpecial (f a) = (a,\x -> "(if not p then (" <> x <> ":) else id)")- | otherwise = (a,rob)- modif' a | isSpecial (f a) = (a,\x -> "(if p then (" <> x <> ":) else id)")- | otherwise = (a,rob)- rob x = "("<> x <> ":)"---splitOptim f cf xs = optim f $ splitLROn f cf $ xs--------------------------------- Error reporting---- leftOf C = ⋃ { {X} ∪ leftOf X | C ::= X B ∈ Grammar or C ::= X ∈ Grammar }-leftRight pos s (Rule _ c rhs _) = Map.singleton (show c) (lkCat x s)- where x = pos rhs--lkCat (Right t) _ = [Right t]-lkCat (Left c) s = Left c:lookupMulti (show c) s---- neighbors A B = ∃ A' B'. P ::= A' B' & A ∈ rightOf A' & B ∈ leftOf B-neighborSet cf = map (second (nub . sort)) $ group' [(x',lkCat y leftSet) | Rule _ _ [x,y] _ <- cfgRules cf, x' <- lkCat x rightSet]- where leftSet = fixpointOnGrammar "left set" (leftRight head) cf- rightSet = fixpointOnGrammar "right set" (leftRight last) cf--data Exp = Id -- identity function- | Con String -- constructor or variable- | App Exp Exp- | Exp `After` Exp- | App2 Exp Exp- deriving (Eq,Ord)--prettyExp Id = "id"-prettyExp (Con x) = text x-prettyExp (App f x) = prettyExp f <+> (parens $ prettyExp x)-prettyExp (App2 f x) = "flip" <+> parens (prettyExp f) <+> parens (prettyExp x)-prettyExp (f `After` g) = parens (prettyExp f) <> "." <> parens (prettyExp g)--instance Show Exp where show = render . prettyExp---- | Apply in 2nd position if the flag is true, otherwise apply normally.-app2 True f x = App2 f x-app2 False f x = app' f x--infixl `app'`-app' :: Exp -> Exp -> Exp-app' (f `After` g) x = app' f (app' g x)-app' Id x = x-app' (App2 f y) x = (f `app'` x) `app'` y-app' (Con "($)") f = f--- app' (Con "const") f = f-app' f x = App f x--after :: Exp -> Exp -> Exp-after Id f = f-after f Id = f-after f g = f `After` g--appMany f args = foldl app' f args
src/BNFC/Utils.hs view
@@ -2,24 +2,12 @@ BNF Converter: Abstract syntax Copyright (C) 2004 Author: Aarne Ranta - This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE PatternSynonyms #-} module BNFC.Utils ( ModuleName@@ -27,15 +15,18 @@ , applyWhen, applyUnless , for , curry3, uncurry3- , mapHead+ , singleton, mapHead, spanEnd , duplicatesOn+ , hasNumericSuffix , (+++), (++++), (+-+), (+.+) , pad, table , mkName, mkNames, NameStyle(..)- , lowerCase, upperCase, mixedCase, camelCase, snakeCase- , replace, prParenth+ , lowerCase, upperCase, mixedCase+ , camelCase, camelCase_+ , snakeCase, snakeCase_+ , replace , writeFileRep- , cstring, cchar+ , cstring , getZonedTimeTruncatedToSeconds ) where @@ -43,32 +34,35 @@ import Control.DeepSeq (rnf) import Data.Char-import Data.List (intercalate)-import Data.Semigroup (Semigroup(..))+import Data.List (intercalate)+import Data.List.NonEmpty (pattern (:|), (<|))+import Data.Semigroup (Semigroup(..)) import Data.Time -import qualified Data.Foldable as Fold-import qualified Data.Map as Map-import qualified Data.Set as Set+import qualified Data.Foldable as Fold+import qualified Data.Map as Map+import qualified Data.Set as Set+import qualified Data.List.NonEmpty as List1 import System.IO (IOMode(ReadMode),hClose,hGetContents,openFile) import System.IO.Error (tryIOError) import BNFC.PrettyPrint hiding ((<>)) +type List1 = List1.NonEmpty+ -- | The name of a module, e.g. "Foo.Abs", "Foo.Print" etc. type ModuleName = String -- * Control flow. --- The following Monoid instance conflicts with Monoid a => Monoid (IO a)--- for ghc >= 8.0+-- ghc 7.10 misses the instance Monoid a => Monoid (IO a) #if __GLASGOW_HASKELL__ <= 710-instance Monad m => Semigroup (m ()) where+instance {-# OVERLAPPING #-} Semigroup (IO ()) where (<>) = (>>) -instance Monad m => Monoid (m ()) where+instance {-# OVERLAPPING #-} Monoid (IO ()) where mempty = return () mappend = (<>) mconcat = sequence_@@ -142,10 +136,6 @@ (+.+) :: String -> String -> String a +.+ b = a ++ "." ++ b --- | Parenthesize a string unless it is empty.-prParenth :: String -> String-prParenth s = if s == "" then "" else "(" ++ s ++ ")"- -- | Pad a string on the right by spaces to reach the desired length. pad :: Int -> String -> String pad n s = s ++ drop (length s) (replicate n ' ')@@ -179,6 +169,20 @@ [] -> [] a:as -> f a : as +-- | @spanEnd p l == reverse (span p (reverse l))@.+--+-- Invariant: @l == front ++ end where (end, front) = spanEnd p l@+--+-- (From package ghc, module Util.)+spanEnd :: (a -> Bool) -> [a] -> ([a], [a])+spanEnd p l = go l [] [] l+ where+ go yes _ rev_no [] = (yes, reverse rev_no)+ go yes rev_yes rev_no (x:xs)+ | p x = go yes (x : rev_yes) rev_no xs+ | otherwise = go xs [] (x : rev_yes ++ rev_no) xs++ -- | Replace all occurences of a value by another value replace :: Eq a => a -- ^ Value to replace@@ -186,21 +190,35 @@ -> [a] -> [a] replace x y xs = [ if z == x then y else z | z <- xs] --- | Returns all elements whose normal form appears more than once.+-- | Returns lists of elements whose normal form appears more than once. ----- E.g. @duplicatesOn abs [5,-5,1] = [-5,5]@.-duplicatesOn :: (Foldable t, Ord a, Ord b) => (a -> b) -> t a -> [a]+-- >>> duplicatesOn id [5,1,2,5,1]+-- [1 :| [1],5 :| [5]]+-- >>> duplicatesOn abs [5,-5,1]+-- [5 :| [-5]]+duplicatesOn :: (Foldable t, Ord b) => (a -> b) -> t a -> [List1 a] duplicatesOn nf- -- Flatten.- = concat -- Keep groups of size >= 2.- . filter ((2 <=) . length)- -- Turn into a list of lists: elements grouped by their normal form.- . map Set.toList+ = filter ((2 <=) . List1.length)+ -- Turn into a list of listss: elements grouped by their normal form. . Map.elems -- Partition elements by their normal form.- . Fold.foldl (\ m a -> Map.insertWith Set.union (nf a) (Set.singleton a) m) Map.empty+ . Fold.foldr (\ a -> Map.insertWith (<>) (nf a) (a :| [])) Map.empty +-- | Get a numeric suffix if it exists.+--+-- >>> hasNumericSuffix "hello world"+-- Nothing+-- >>> hasNumericSuffix "a1b2"+-- Just ("a1b",2)+-- >>> hasNumericSuffix "1234"+-- Just ("",1234)++hasNumericSuffix :: String -> Maybe (String, Integer)+hasNumericSuffix s = case spanEnd isDigit s of+ ([], _) -> Nothing+ (num, front) -> Just (front, read num)+ -- * Time utilities -- | Cut away fractions of a second in time.@@ -422,8 +440,11 @@ -- MyIdent camelCase :: String -> Doc-camelCase = text . mkName [] CamelCase+camelCase = text . camelCase_ +camelCase_ :: String -> String+camelCase_ = mkName [] CamelCase+ -- | To mixed case. -- >>> mixedCase "my_ident" -- myIdent@@ -436,8 +457,11 @@ -- my_ident snakeCase :: String -> Doc-snakeCase = text . mkName [] SnakeCase+snakeCase = text . snakeCase_ +snakeCase_ :: String -> String+snakeCase_ = mkName [] SnakeCase+ -- ESCAPING -- | a function that renders a c-like string with escaped characters.@@ -453,14 +477,3 @@ -- "foobar\"" cstring :: String -> Doc cstring = text . show----- | A function that renders a c-like character.------ >>> cchar 'x'--- 'x'------ >>> cchar '\''--- '\''-cchar :: Char -> Doc-cchar = text . show
− src/Data/Pair.hs
@@ -1,19 +0,0 @@-{-# LANGUAGE CPP #-}-module Data.Pair where--#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif--infixl 2 :/:--data Pair a = (:/:) {leftOf :: a, rightOf :: a}- deriving (Show)--instance Functor Pair where- fmap f (a :/: b) = f a :/: f b--instance Applicative Pair where- pure a = a :/: a- (f :/: g) <*> (a :/: b) = f a :/: g b-
− src/LexBNF.hs
@@ -1,8786 +0,0 @@-{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-missing-signatures #-}-{-# LANGUAGE CPP #-}-{-# LINE 3 "LexBNF.x" #-}-{-# OPTIONS -fno-warn-incomplete-patterns #-}-{-# OPTIONS_GHC -w #-}-module LexBNF where--import qualified Data.Bits-import Data.Word (Word8)-import Data.Char (ord)-#if __GLASGOW_HASKELL__ >= 603-#include "ghcconfig.h"-#elif defined(__GLASGOW_HASKELL__)-#include "config.h"-#endif-#if __GLASGOW_HASKELL__ >= 503-import Data.Array-#else-import Array-#endif-alex_tab_size :: Int-alex_tab_size = 8-alex_base :: Array Int Int-alex_base = listArray (0 :: Int, 63)- [ -8- , 73- , -55- , -32- , 201- , 412- , 45- , 540- , 668- , 796- , 924- , 1052- , 1180- , 1293- , 0- , 1421- , 0- , 1534- , 0- , 1647- , 0- , 267- , 0- , 1712- , 0- , 1777- , 2033- , 1969- , 0- , 0- , 2082- , 2338- , 2274- , 0- , 2491- , 2747- , 2497- , 2683- , 0- , 0- , 2748- , -37- , 71- , 114- , 2994- , 2877- , 3122- , 3314- , 3250- , 0- , 3496- , 0- , 120- , -36- , -35- , 0- , -33- , 3713- , 3812- , 0- , 0- , 126- , 2489- , 140- ]--alex_table :: Array Int Int-alex_table = listArray (0 :: Int, 4067)- [ 0- , 52- , 52- , 52- , 52- , 52- , 55- , 60- , 43- , 50- , 5- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 0- , 0- , 0- , 52- , 2- , 44- , 0- , 0- , 0- , 0- , 34- , 55- , 55- , 55- , 55- , 55- , 53- , 55- , 0- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 56- , 55- , 0- , 55- , 0- , 55- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 55- , 3- , 55- , 0- , 55- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 54- , 55- , 55- , 1- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 52- , 52- , 52- , 52- , 52- , 0- , 0- , 0- , 3- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 3- , 0- , 0- , 0- , 0- , 52- , 0- , 0- , 3- , 0- , 0- , 0- , 3- , 0- , 3- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 42- , 0- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 61- , 0- , 0- , 0- , 46- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 63- , 51- , 0- , 0- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 26- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 27- , 10- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 21- , 15- , 14- , 14- , 14- , 13- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 47- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 1- , 27- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 26- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 27- , 10- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 21- , 15- , 14- , 14- , 14- , 13- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 4- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 35- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 31- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 26- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 28- , 8- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 9- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 21- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 10- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 20- , 23- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 25- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 32- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 37- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 40- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 44- , 0- , 0- , 0- , 0- , 44- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 62- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 6- , 0- , 0- , 0- , 0- , 0- , 44- , 41- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 44- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 44- , 0- , 0- , 0- , 44- , 0- , 44- , 0- , 0- , 0- , 0- , 0- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 31- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 33- , 32- , 9- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 22- , 23- , 12- , 16- , 16- , 16- , 17- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 48- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 59- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 0- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 36- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 35- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 38- , 37- , 8- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 24- , 25- , 11- , 18- , 18- , 18- , 19- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 47- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 49- , 48- , 4- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 39- , 40- , 7- , 29- , 29- , 29- , 30- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 58- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 0- , 0- , 0- , 0- , 57- , 0- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 57- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 58- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 0- , 0- , 0- , 0- , 58- , 46- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 58- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 45- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- , 0- ]--alex_check :: Array Int Int-alex_check = listArray (0 :: Int, 4067)- [ -1- , 9- , 10- , 11- , 12- , 13- , 61- , 39- , 45- , 45- , 45- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , -1- , -1- , -1- , 32- , 58- , 34- , -1- , -1- , -1- , -1- , 39- , 40- , 41- , 42- , 43- , 44- , 45- , 46- , -1- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 58- , 59- , -1- , 61- , -1- , 63- , -1- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , 91- , 39- , 93- , -1- , 95- , -1- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , 123- , 124- , 125- , 45- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 9- , 10- , 11- , 12- , 13- , -1- , -1- , -1- , 92- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 102- , -1- , -1- , -1- , -1- , 32- , -1- , -1- , 110- , -1- , -1- , -1- , 114- , -1- , 116- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 46- , -1- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , -1- , -1- , -1- , 195- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 125- , -1- , -1- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 45- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 0- , 1- , 2- , 3- , 4- , 5- , 6- , 7- , 8- , 9- , 10- , 11- , 12- , 13- , 14- , 15- , 16- , 17- , 18- , 19- , 20- , 21- , 22- , 23- , 24- , 25- , 26- , 27- , 28- , 29- , 30- , 31- , 32- , 33- , 34- , 35- , 36- , 37- , 38- , 39- , 40- , 41- , 42- , 43- , 44- , 45- , 46- , 47- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 58- , 59- , 60- , 61- , 62- , 63- , 64- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , 91- , 92- , 93- , 94- , 95- , 96- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , 123- , 124- , 125- , 126- , 127- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 0- , 1- , 2- , 3- , 4- , 5- , 6- , 7- , 8- , 9- , 10- , 11- , 12- , 13- , 14- , 15- , 16- , 17- , 18- , 19- , 20- , 21- , 22- , 23- , 24- , 25- , 26- , 27- , 28- , 29- , 30- , 31- , 32- , 33- , 34- , 35- , 36- , 37- , 38- , 39- , 40- , 41- , 42- , 43- , 44- , 45- , 46- , 47- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 58- , 59- , 60- , 61- , 62- , 63- , 64- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , 91- , 92- , 93- , 94- , 95- , 96- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , 123- , 124- , 125- , 126- , 127- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 39- , 34- , -1- , -1- , -1- , -1- , 39- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 92- , -1- , -1- , -1- , -1- , -1- , 92- , 101- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 102- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 110- , -1- , -1- , -1- , 114- , -1- , 116- , -1- , -1- , -1- , -1- , -1- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 0- , 1- , 2- , 3- , 4- , 5- , 6- , 7- , 8- , 9- , 10- , 11- , 12- , 13- , 14- , 15- , 16- , 17- , 18- , 19- , 20- , 21- , 22- , 23- , 24- , 25- , 26- , 27- , 28- , 29- , 30- , 31- , 32- , 33- , 34- , 35- , 36- , 37- , 38- , 39- , 40- , 41- , 42- , 43- , 44- , 45- , 46- , 47- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 58- , 59- , 60- , 61- , 62- , 63- , 64- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , 91- , 92- , 93- , 94- , 95- , 96- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , 123- , 124- , 125- , 126- , 127- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 10- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 34- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , -1- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 92- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , -1- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , -1- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 0- , 1- , 2- , 3- , 4- , 5- , 6- , 7- , 8- , 9- , 10- , 11- , 12- , 13- , 14- , 15- , 16- , 17- , 18- , 19- , 20- , 21- , 22- , 23- , 24- , 25- , 26- , 27- , 28- , 29- , 30- , 31- , 32- , 33- , 34- , 35- , 36- , 37- , 38- , 39- , 40- , 41- , 42- , 43- , 44- , 45- , 46- , 47- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , 58- , 59- , 60- , 61- , 62- , 63- , 64- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , 91- , 92- , 93- , 94- , 95- , 96- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , 123- , 124- , 125- , 126- , 127- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 10- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 128- , 129- , 130- , 131- , 132- , 133- , 134- , 135- , 136- , 137- , 138- , 139- , 140- , 141- , 142- , 143- , 144- , 145- , 146- , 147- , 148- , 149- , 150- , 151- , 152- , 153- , 154- , 155- , 156- , 157- , 158- , 159- , 160- , 161- , 162- , 163- , 164- , 165- , 166- , 167- , 168- , 169- , 170- , 171- , 172- , 173- , 174- , 175- , 176- , 177- , 178- , 179- , 180- , 181- , 182- , 183- , 184- , 185- , 186- , 187- , 188- , 189- , 190- , 191- , 192- , 193- , 194- , 195- , 196- , 197- , 198- , 199- , 200- , 201- , 202- , 203- , 204- , 205- , 206- , 207- , 208- , 209- , 210- , 211- , 212- , 213- , 214- , 215- , 216- , 217- , 218- , 219- , 220- , 221- , 222- , 223- , 224- , 225- , 226- , 227- , 228- , 229- , 230- , 231- , 232- , 233- , 234- , 235- , 236- , 237- , 238- , 239- , 240- , 241- , 242- , 243- , 244- , 245- , 246- , 247- , 248- , 249- , 250- , 251- , 252- , 253- , 254- , 255- , 39- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , -1- , -1- , -1- , -1- , 95- , -1- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 39- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 48- , 49- , 50- , 51- , 52- , 53- , 54- , 55- , 56- , 57- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 65- , 66- , 67- , 68- , 69- , 70- , 71- , 72- , 73- , 74- , 75- , 76- , 77- , 78- , 79- , 80- , 81- , 82- , 83- , 84- , 85- , 86- , 87- , 88- , 89- , 90- , -1- , -1- , -1- , -1- , 95- , 195- , 97- , 98- , 99- , 100- , 101- , 102- , 103- , 104- , 105- , 106- , 107- , 108- , 109- , 110- , 111- , 112- , 113- , 114- , 115- , 116- , 117- , 118- , 119- , 120- , 121- , 122- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 195- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- ]--alex_deflt :: Array Int Int-alex_deflt = listArray (0 :: Int, 63)- [ -1- , 5- , -1- , -1- , -1- , 5- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , 20- , 20- , -1- , 22- , 22- , 24- , 24- , 28- , 28- , 33- , 33- , 38- , 38- , 5- , 5- , 5- , 39- , 39- , 3- , 3- , 3- , 3- , 44- , -1- , 44- , 44- , 49- , 49- , -1- , -1- , -1- , 44- , -1- , -1- , 50- , 50- , 50- , 50- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- , -1- ]--alex_accept = listArray (0 :: Int, 63)- [ AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccNone- , AlexAccSkip- , AlexAccSkip- , AlexAccSkip- , AlexAcc 10- , AlexAcc 9- , AlexAcc 8- , AlexAcc 7- , AlexAcc 6- , AlexAcc 5- , AlexAcc 4- , AlexAcc 3- , AlexAcc 2- , AlexAcc 1- , AlexAcc 0- ]--alex_actions = array (0 :: Int, 11)- [ (10,alex_action_3)- , (9,alex_action_3)- , (8,alex_action_3)- , (7,alex_action_3)- , (6,alex_action_4)- , (5,alex_action_5)- , (4,alex_action_6)- , (3,alex_action_7)- , (2,alex_action_8)- , (1,alex_action_9)- , (0,alex_action_9)- ]--{-# LINE 49 "LexBNF.x" #-}-tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)-tok f p s = f p s--share :: String -> String-share = id--data Tok =- TS !String !Int -- reserved words and symbols- | TL !String -- string literals- | TI !String -- integer literals- | TV !String -- identifiers- | TD !String -- double precision float literals- | TC !String -- character literals- | T_Identifier !String-- deriving (Eq,Show,Ord)--data Token =- PT Posn Tok- | Err Posn- deriving (Eq,Show,Ord)--printPosn :: Posn -> String-printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c--tokenPos :: [Token] -> String-tokenPos (t:_) = printPosn (tokenPosn t)-tokenPos [] = "end of file"--tokenPosn :: Token -> Posn-tokenPosn (PT p _) = p-tokenPosn (Err p) = p--tokenLineCol :: Token -> (Int, Int)-tokenLineCol = posLineCol . tokenPosn--posLineCol :: Posn -> (Int, Int)-posLineCol (Pn _ l c) = (l,c)--mkPosToken :: Token -> ((Int, Int), String)-mkPosToken t@(PT p _) = (posLineCol p, tokenText t)--tokenText :: Token -> String-tokenText t = case t of- PT _ (TS s _) -> s- PT _ (TL s) -> show s- PT _ (TI s) -> s- PT _ (TV s) -> s- PT _ (TD s) -> s- PT _ (TC s) -> s- Err _ -> "#error"- PT _ (T_Identifier s) -> s--prToken :: Token -> String-prToken t = tokenText t--data BTree = N | B String Tok BTree BTree deriving (Show)--eitherResIdent :: (String -> Tok) -> String -> Tok-eitherResIdent tv s = treeFind resWords- where- treeFind N = tv s- treeFind (B a t left right) | s < a = treeFind left- | s > a = treeFind right- | s == a = t--resWords :: BTree-resWords = b "digit" 21 (b "=" 11 (b "-" 6 (b "*" 3 (b ")" 2 (b "(" 1 N N) N) (b "," 5 (b "+" 4 N N) N)) (b "::=" 9 (b ":" 8 (b "." 7 N N) N) (b ";" 10 N N))) (b "char" 16 (b "]" 14 (b "[" 13 (b "?" 12 N N) N) (b "_" 15 N N)) (b "define" 19 (b "comment" 18 (b "coercions" 17 N N) N) (b "delimiters" 20 N N)))) (b "separator" 31 (b "letter" 26 (b "internal" 24 (b "eps" 23 (b "entrypoints" 22 N N) N) (b "layout" 25 N N)) (b "position" 29 (b "nonempty" 28 (b "lower" 27 N N) N) (b "rules" 30 N N))) (b "upper" 36 (b "token" 34 (b "terminator" 33 (b "stop" 32 N N) N) (b "toplevel" 35 N N)) (b "|" 39 (b "{" 38 (b "views" 37 N N) N) (b "}" 40 N N))))- where b s n = let bs = s- in B bs (TS bs n)--unescapeInitTail :: String -> String-unescapeInitTail = id . unesc . tail . id- where- unesc s = case s of- '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs- '\\':'n':cs -> '\n' : unesc cs- '\\':'t':cs -> '\t' : unesc cs- '\\':'r':cs -> '\r' : unesc cs- '\\':'f':cs -> '\f' : unesc cs- '"':[] -> []- c:cs -> c : unesc cs- _ -> []------------------------------------------------------------------------ Alex wrapper code.--- A modified "posn" wrapper.----------------------------------------------------------------------data Posn = Pn !Int !Int !Int- deriving (Eq, Show,Ord)--alexStartPos :: Posn-alexStartPos = Pn 0 1 1--alexMove :: Posn -> Char -> Posn-alexMove (Pn a l c) '\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)-alexMove (Pn a l c) '\n' = Pn (a+1) (l+1) 1-alexMove (Pn a l c) _ = Pn (a+1) l (c+1)--type Byte = Word8--type AlexInput = (Posn, -- current position,- Char, -- previous char- [Byte], -- pending bytes on the current char- String) -- current input string--tokens :: String -> [Token]-tokens str = go (alexStartPos, '\n', [], str)- where- go :: AlexInput -> [Token]- go inp@(pos, _, _, str) =- case alexScan inp 0 of- AlexEOF -> []- AlexError (pos, _, _, _) -> [Err pos]- AlexSkip inp' len -> go inp'- AlexToken inp' len act -> act pos (take len str) : (go inp')--alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)-alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))-alexGetByte (p, _, [], s) =- case s of- [] -> Nothing- (c:s) ->- let p' = alexMove p c- (b:bs) = utf8Encode c- in p' `seq` Just (b, (p', c, bs, s))--alexInputPrevChar :: AlexInput -> Char-alexInputPrevChar (p, c, bs, s) = c---- | Encode a Haskell String to a list of Word8 values, in UTF8 format.-utf8Encode :: Char -> [Word8]-utf8Encode = map fromIntegral . go . ord- where- go oc- | oc <= 0x7f = [oc]-- | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)- , 0x80 + oc Data.Bits..&. 0x3f- ]-- | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)- , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)- , 0x80 + oc Data.Bits..&. 0x3f- ]- | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)- , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)- , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)- , 0x80 + oc Data.Bits..&. 0x3f- ]-alex_action_3 = tok (\p s -> PT p (eitherResIdent (TV . share) s))-alex_action_4 = tok (\p s -> PT p (eitherResIdent (T_Identifier . share) s))-alex_action_5 = tok (\p s -> PT p (eitherResIdent (TV . share) s))-alex_action_6 = tok (\p s -> PT p (TL $ share $ unescapeInitTail s))-alex_action_7 = tok (\p s -> PT p (TC $ share s))-alex_action_8 = tok (\p s -> PT p (TI $ share s))-alex_action_9 = tok (\p s -> PT p (TD $ share s))--{-# LINE 1 "templates/GenericTemplate.hs" #-}--- -------------------------------------------------------------------------------- ALEX TEMPLATE------ This code is in the PUBLIC DOMAIN; you may copy it freely and use--- it for any purpose whatsoever.---- -------------------------------------------------------------------------------- INTERNALS and main scanner engine----------------------------------------------------------------alexIndexInt16OffAddr arr off = arr ! off---------------------alexIndexInt32OffAddr arr off = arr ! off------------quickIndex arr i = arr ! i----- -------------------------------------------------------------------------------- Main lexing routines--data AlexReturn a- = AlexEOF- | AlexError !AlexInput- | AlexSkip !AlexInput !Int- | AlexToken !AlexInput !Int a---- alexScan :: AlexInput -> StartCode -> AlexReturn a-alexScan input__ (sc)- = alexScanUser undefined input__ (sc)--alexScanUser user__ input__ (sc)- = case alex_scan_tkn user__ input__ (0) input__ sc AlexNone of- (AlexNone, input__') ->- case alexGetByte input__ of- Nothing ->---- AlexEOF- Just _ ->---- AlexError input__'-- (AlexLastSkip input__'' len, _) ->---- AlexSkip input__'' len-- (AlexLastAcc k input__''' len, _) ->---- AlexToken input__''' len (alex_actions ! k)----- Push the input through the DFA, remembering the most recent accepting--- state it encountered.--alex_scan_tkn user__ orig_input len input__ s last_acc =- input__ `seq` -- strict in the input- let- new_acc = (check_accs (alex_accept `quickIndex` (s)))- in- new_acc `seq`- case alexGetByte input__ of- Nothing -> (new_acc, input__)- Just (c, new_input) ->---- case fromIntegral c of { (ord_c) ->- let- base = alexIndexInt32OffAddr alex_base s- offset = (base + ord_c)- check = alexIndexInt16OffAddr alex_check offset-- new_s = if (offset >= (0)) && (check == ord_c)- then alexIndexInt16OffAddr alex_table offset- else alexIndexInt16OffAddr alex_deflt s- in- case new_s of- (-1) -> (new_acc, input__)- -- on an error, we want to keep the input *before* the- -- character that failed, not after.- _ -> alex_scan_tkn user__ orig_input----- (if c < 0x80 || c >= 0xC0 then (len + (1)) else len)- -- note that the length is increased ONLY if this is the 1st byte in a char encoding)-- new_input new_s new_acc- }- where- check_accs (AlexAccNone) = last_acc- check_accs (AlexAcc a ) = AlexLastAcc a input__ (len)- check_accs (AlexAccSkip) = AlexLastSkip input__ (len)--------------data AlexLastAcc- = AlexNone- | AlexLastAcc !Int !AlexInput !Int- | AlexLastSkip !AlexInput !Int--data AlexAcc user- = AlexAccNone- | AlexAcc Int- | AlexAccSkip-----------------------------
− src/LexBNF.x
@@ -1,202 +0,0 @@--- -*- haskell -*---- This Alex file was machine-generated by the BNF converter-{-{-# OPTIONS -fno-warn-incomplete-patterns #-}-{-# OPTIONS_GHC -w #-}-module LexBNF where--import qualified Data.Bits-import Data.Word (Word8)-import Data.Char (ord)-}---$c = [A-Z\192-\221] # [\215] -- capital isolatin1 letter (215 = \times) FIXME-$s = [a-z\222-\255] # [\247] -- small isolatin1 letter (247 = \div ) FIXME-$l = [$c $s] -- letter-$d = [0-9] -- digit-$i = [$l $d _ '] -- identifier character-$u = [. \n] -- universal: any character--@rsyms = -- symbols and non-identifier-like reserved words- \: | \; | \, | \. | \: \: \= | \[ | \] | \_ | \( | \) | \= | \| | \- | \* | \+ | \? | \{ | \}--:----- Line comments-"--" [.]* ;---- Block comments-\{ \- [$u # \-]* \- ([$u # [\- \}]] [$u # \-]* \- | \-)* \} ;--$white+ ;-@rsyms- { tok (\p s -> PT p (eitherResIdent (TV . share) s)) }-$l (\_ | ($d | $l)) *- { tok (\p s -> PT p (eitherResIdent (T_Identifier . share) s)) }--$l $i*- { tok (\p s -> PT p (eitherResIdent (TV . share) s)) }-\" ([$u # [\" \\ \n]] | (\\ (\" | \\ | \' | n | t | r | f)))* \"- { tok (\p s -> PT p (TL $ share $ unescapeInitTail s)) }-\' ($u # [\' \\] | \\ [\\ \' n t r f]) \'- { tok (\p s -> PT p (TC $ share s)) }-$d+- { tok (\p s -> PT p (TI $ share s)) }-$d+ \. $d+ (e (\-)? $d+)?- { tok (\p s -> PT p (TD $ share s)) }--{--tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)-tok f p s = f p s--share :: String -> String-share = id--data Tok =- TS !String !Int -- reserved words and symbols- | TL !String -- string literals- | TI !String -- integer literals- | TV !String -- identifiers- | TD !String -- double precision float literals- | TC !String -- character literals- | T_Identifier !String-- deriving (Eq,Show,Ord)--data Token =- PT Posn Tok- | Err Posn- deriving (Eq,Show,Ord)--printPosn :: Posn -> String-printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c--tokenPos :: [Token] -> String-tokenPos (t:_) = printPosn (tokenPosn t)-tokenPos [] = "end of file"--tokenPosn :: Token -> Posn-tokenPosn (PT p _) = p-tokenPosn (Err p) = p--tokenLineCol :: Token -> (Int, Int)-tokenLineCol = posLineCol . tokenPosn--posLineCol :: Posn -> (Int, Int)-posLineCol (Pn _ l c) = (l,c)--mkPosToken :: Token -> ((Int, Int), String)-mkPosToken t@(PT p _) = (posLineCol p, tokenText t)--tokenText :: Token -> String-tokenText t = case t of- PT _ (TS s _) -> s- PT _ (TL s) -> show s- PT _ (TI s) -> s- PT _ (TV s) -> s- PT _ (TD s) -> s- PT _ (TC s) -> s- Err _ -> "#error"- PT _ (T_Identifier s) -> s--prToken :: Token -> String-prToken t = tokenText t--data BTree = N | B String Tok BTree BTree deriving (Show)--eitherResIdent :: (String -> Tok) -> String -> Tok-eitherResIdent tv s = treeFind resWords- where- treeFind N = tv s- treeFind (B a t left right) | s < a = treeFind left- | s > a = treeFind right- | s == a = t--resWords :: BTree-resWords = b "digit" 21 (b "=" 11 (b "-" 6 (b "*" 3 (b ")" 2 (b "(" 1 N N) N) (b "," 5 (b "+" 4 N N) N)) (b "::=" 9 (b ":" 8 (b "." 7 N N) N) (b ";" 10 N N))) (b "char" 16 (b "]" 14 (b "[" 13 (b "?" 12 N N) N) (b "_" 15 N N)) (b "define" 19 (b "comment" 18 (b "coercions" 17 N N) N) (b "delimiters" 20 N N)))) (b "separator" 31 (b "letter" 26 (b "internal" 24 (b "eps" 23 (b "entrypoints" 22 N N) N) (b "layout" 25 N N)) (b "position" 29 (b "nonempty" 28 (b "lower" 27 N N) N) (b "rules" 30 N N))) (b "upper" 36 (b "token" 34 (b "terminator" 33 (b "stop" 32 N N) N) (b "toplevel" 35 N N)) (b "|" 39 (b "{" 38 (b "views" 37 N N) N) (b "}" 40 N N))))- where b s n = let bs = s- in B bs (TS bs n)--unescapeInitTail :: String -> String-unescapeInitTail = id . unesc . tail . id- where- unesc s = case s of- '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs- '\\':'n':cs -> '\n' : unesc cs- '\\':'t':cs -> '\t' : unesc cs- '\\':'r':cs -> '\r' : unesc cs- '\\':'f':cs -> '\f' : unesc cs- '"':[] -> []- c:cs -> c : unesc cs- _ -> []------------------------------------------------------------------------ Alex wrapper code.--- A modified "posn" wrapper.----------------------------------------------------------------------data Posn = Pn !Int !Int !Int- deriving (Eq, Show,Ord)--alexStartPos :: Posn-alexStartPos = Pn 0 1 1--alexMove :: Posn -> Char -> Posn-alexMove (Pn a l c) '\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)-alexMove (Pn a l c) '\n' = Pn (a+1) (l+1) 1-alexMove (Pn a l c) _ = Pn (a+1) l (c+1)--type Byte = Word8--type AlexInput = (Posn, -- current position,- Char, -- previous char- [Byte], -- pending bytes on the current char- String) -- current input string--tokens :: String -> [Token]-tokens str = go (alexStartPos, '\n', [], str)- where- go :: AlexInput -> [Token]- go inp@(pos, _, _, str) =- case alexScan inp 0 of- AlexEOF -> []- AlexError (pos, _, _, _) -> [Err pos]- AlexSkip inp' len -> go inp'- AlexToken inp' len act -> act pos (take len str) : (go inp')--alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)-alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))-alexGetByte (p, _, [], s) =- case s of- [] -> Nothing- (c:s) ->- let p' = alexMove p c- (b:bs) = utf8Encode c- in p' `seq` Just (b, (p', c, bs, s))--alexInputPrevChar :: AlexInput -> Char-alexInputPrevChar (p, c, bs, s) = c---- | Encode a Haskell String to a list of Word8 values, in UTF8 format.-utf8Encode :: Char -> [Word8]-utf8Encode = map fromIntegral . go . ord- where- go oc- | oc <= 0x7f = [oc]-- | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)- , 0x80 + oc Data.Bits..&. 0x3f- ]-- | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)- , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)- , 0x80 + oc Data.Bits..&. 0x3f- ]- | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)- , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)- , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)- , 0x80 + oc Data.Bits..&. 0x3f- ]-}
− src/Main.hs
@@ -1,102 +0,0 @@-{-- BNF Converter: Main file- Copyright (C) 2002-2013 Authors:- Jonas Almström Duregård, Krasimir Angelov, Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Paul Callaghan,- Grégoire Détrez, Markus Forsberg, Ola Frid, Peter Gammie, Thomas Hallgren, Patrik Jansson,- Kristofer Johannisson, Antti-Juhani Kaijanaho, Ulf Norell,- Michael Pellauer and Aarne Ranta 2002 - 2013.-- Björn Bringert, Johan Broberg, Markus Forberg, Peter Gammie,- Patrik Jansson, Antti-Juhani Kaijanaho, Ulf Norell,- Michael Pellauer, Aarne Ranta-- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation; either version 2 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA--}---module Main where--import BNFC.Backend.Base-import BNFC.Backend.C-import BNFC.Backend.CPP.NoSTL-import BNFC.Backend.CPP.STL-import BNFC.Backend.CSharp-import BNFC.Backend.Haskell-import BNFC.Backend.HaskellGADT-import BNFC.Backend.HaskellProfile-import BNFC.Backend.Java-import BNFC.Backend.Latex-import BNFC.Backend.OCaml-import BNFC.Backend.Pygments-import BNFC.CF (CF)-import BNFC.GetCF-import BNFC.Options hiding (make, Backend)--import Paths_BNFC ( version )--import Data.Version ( showVersion )-import System.Environment (getArgs)-import System.Exit (exitFailure, exitSuccess)-import System.IO (stderr, hPutStrLn)---- Print an error message and a (short) usage help and exit-printUsageErrors :: [String] -> IO ()-printUsageErrors msg = do- mapM_ (hPutStrLn stderr) msg- hPutStrLn stderr usage- exitFailure--main :: IO ()-main = do- args <- getArgs- let (mode, warnings) = parseMode args-- -- Print command-line argument warnings (if any).- mapM_ (hPutStrLn stderr) warnings-- case mode of-- UsageError e -> printUsageErrors [e]- Help -> putStrLn help >> exitSuccess- Version -> putStrLn (showVersion version) >> exitSuccess-- Target options file- | target options == TargetCheck ->- readFile file- >>= parseCFP options TargetCheck- >> return ()- | target options == TargetProfile ->- readFile file- >>= parseCFP options TargetProfile- >>= writeFiles (outDir options) . makeHaskellProfile options- | otherwise ->- readFile file- >>= parseCF options (target options)- >>= writeFiles (outDir options) . maketarget (target options) options--maketarget :: Target -> SharedOptions -> CF -> Backend-maketarget = \case- TargetC -> makeC- TargetCpp -> makeCppStl- TargetCppNoStl -> makeCppNoStl- TargetCSharp -> makeCSharp- TargetHaskell -> makeHaskell- TargetHaskellGadt -> makeHaskellGadt- TargetLatex -> makeLatex- TargetJava -> makeJava- TargetOCaml -> makeOCaml- TargetProfile -> error "impossible"- TargetPygments -> makePygments- TargetCheck -> error "impossible"
+ src/Makefile view
@@ -0,0 +1,65 @@+# Author: Andreas Abel, 2018-01-01, 2020-12-22++.PHONY : default all++default: lbnf+all: lbnf license++# bnfc's own parser+###################++# BNFC-generated files+gen = BNFC/Abs.hs BNFC/Doc.txt ErrM.hs BNFC/Lex.x BNFC/Par.y BNFC/Print.hs BNFC/Skel.hs BNFC/Test.hs++.PHONY: lbnf++lbnf : BNFC/Abs.hs BNFC/Lex.hs BNFC/Par.hs BNFC/Print.hs++%/Abs.hs %/Doc.txt %/Lex.x %/Par.y %/Print.hs %/Skel.hs %/Test.hs : %.cf+ bnfc --haskell -d $<++%.hs : %.x+ alex -g $<++%.hs : %.y+ happy -gcai $<++# Generate License.hs+#####################++.PHONY: license++license: BNFC/License.hs++BNFC/License.hs : ../LICENSE Makefile+ echo "\+-- This file was autogenerated from LICENSE, do not edit!!\n\n\+{-# LANGUAGE QuasiQuotes #-}\n\n\+module BNFC.License where\n\n\+import Data.String.QQ\n\n\+license :: String\n\+license = [s|" > $@+ cat $< >> $@+ echo "\n|]" >> $@++# Emacs Tags+############++.PHONY : tags++tags :+ hasktags -e .++# Fake cabal file for old version of haskell-mode (emacs)+#########################################################++.PHONY: fake-cabal rm-fake-cabal++fake-cabal :+ touch inferior-haskell-find-project-root.cabal++# Remove this this file confuses tools like cabal and stack.+rm-fake-cabal :+ rm inferior-haskell-find-project-root.cabal++#EOF
− src/ParBNF.hs
@@ -1,3273 +0,0 @@-{-# OPTIONS_GHC -w #-}-{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}-module ParBNF where-import qualified AbsBNF-import LexBNF-import qualified Data.Array as Happy_Data_Array-import qualified Data.Bits as Bits-import Control.Applicative(Applicative(..))-import Control.Monad (ap)---- parser produced by Happy Version 1.20.0--data HappyAbsSyn - = HappyTerminal (Token)- | HappyErrorToken Prelude.Int- | HappyAbsSyn36 (String)- | HappyAbsSyn37 (Integer)- | HappyAbsSyn38 (Char)- | HappyAbsSyn39 (Double)- | HappyAbsSyn40 (AbsBNF.Identifier)- | HappyAbsSyn41 (AbsBNF.LGrammar)- | HappyAbsSyn42 (AbsBNF.LDef)- | HappyAbsSyn43 ([AbsBNF.LDef])- | HappyAbsSyn44 ([AbsBNF.Identifier])- | HappyAbsSyn45 (AbsBNF.Grammar)- | HappyAbsSyn46 ([AbsBNF.Def])- | HappyAbsSyn47 (AbsBNF.Def)- | HappyAbsSyn48 (AbsBNF.Item)- | HappyAbsSyn49 ([AbsBNF.Item])- | HappyAbsSyn50 (AbsBNF.Cat)- | HappyAbsSyn51 (AbsBNF.Label)- | HappyAbsSyn52 (AbsBNF.LabelId)- | HappyAbsSyn53 (AbsBNF.ProfItem)- | HappyAbsSyn54 (AbsBNF.IntList)- | HappyAbsSyn55 ([Integer])- | HappyAbsSyn56 ([AbsBNF.IntList])- | HappyAbsSyn57 ([AbsBNF.ProfItem])- | HappyAbsSyn58 (AbsBNF.Arg)- | HappyAbsSyn59 ([AbsBNF.Arg])- | HappyAbsSyn60 (AbsBNF.Separation)- | HappyAbsSyn61 ([String])- | HappyAbsSyn62 (AbsBNF.Exp)- | HappyAbsSyn65 ([AbsBNF.Exp])- | HappyAbsSyn67 (AbsBNF.RHS)- | HappyAbsSyn68 ([AbsBNF.RHS])- | HappyAbsSyn69 (AbsBNF.MinimumSize)- | HappyAbsSyn70 (AbsBNF.Reg)--{- to allow type-synonyms as our monads (likely- - with explicitly-specified bind and return)- - in Haskell98, it seems that with- - /type M a = .../, then /(HappyReduction M)/- - is not allowed. But Happy is a- - code-generator that can just substitute it.-type HappyReduction m = - Prelude.Int - -> (Token)- -> HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> m HappyAbsSyn)- -> [HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> m HappyAbsSyn)] - -> HappyStk HappyAbsSyn - -> [(Token)] -> m HappyAbsSyn--}--action_0,- action_1,- action_2,- action_3,- action_4,- action_5,- action_6,- action_7,- action_8,- action_9,- action_10,- action_11,- action_12,- action_13,- action_14,- action_15,- action_16,- action_17,- action_18,- action_19,- action_20,- action_21,- action_22,- action_23,- action_24,- action_25,- action_26,- action_27,- action_28,- action_29,- action_30,- action_31,- action_32,- action_33,- action_34,- action_35,- action_36,- action_37,- action_38,- action_39,- action_40,- action_41,- action_42,- action_43,- action_44,- action_45,- action_46,- action_47,- action_48,- action_49,- action_50,- action_51,- action_52,- action_53,- action_54,- action_55,- action_56,- action_57,- action_58,- action_59,- action_60,- action_61,- action_62,- action_63,- action_64,- action_65,- action_66,- action_67,- action_68,- action_69,- action_70,- action_71,- action_72,- action_73,- action_74,- action_75,- action_76,- action_77,- action_78,- action_79,- action_80,- action_81,- action_82,- action_83,- action_84,- action_85,- action_86,- action_87,- action_88,- action_89,- action_90,- action_91,- action_92,- action_93,- action_94,- action_95,- action_96,- action_97,- action_98,- action_99,- action_100,- action_101,- action_102,- action_103,- action_104,- action_105,- action_106,- action_107,- action_108,- action_109,- action_110,- action_111,- action_112,- action_113,- action_114,- action_115,- action_116,- action_117,- action_118,- action_119,- action_120,- action_121,- action_122,- action_123,- action_124,- action_125,- action_126,- action_127,- action_128,- action_129,- action_130,- action_131,- action_132,- action_133,- action_134,- action_135,- action_136,- action_137,- action_138,- action_139,- action_140,- action_141,- action_142,- action_143,- action_144,- action_145,- action_146,- action_147,- action_148,- action_149,- action_150,- action_151,- action_152,- action_153,- action_154,- action_155,- action_156,- action_157,- action_158,- action_159,- action_160,- action_161,- action_162,- action_163,- action_164,- action_165,- action_166,- action_167,- action_168,- action_169,- action_170,- action_171,- action_172,- action_173,- action_174,- action_175,- action_176,- action_177,- action_178,- action_179,- action_180,- action_181,- action_182,- action_183,- action_184,- action_185,- action_186,- action_187,- action_188,- action_189,- action_190,- action_191,- action_192,- action_193,- action_194,- action_195,- action_196,- action_197,- action_198,- action_199,- action_200,- action_201,- action_202,- action_203,- action_204,- action_205,- action_206,- action_207,- action_208,- action_209,- action_210,- action_211,- action_212,- action_213,- action_214,- action_215,- action_216,- action_217,- action_218,- action_219,- action_220,- action_221,- action_222,- action_223,- action_224,- action_225,- action_226,- action_227,- action_228,- action_229,- action_230,- action_231,- action_232,- action_233,- action_234,- action_235,- action_236,- action_237,- action_238,- action_239,- action_240,- action_241,- action_242,- action_243,- action_244,- action_245,- action_246,- action_247,- action_248,- action_249,- action_250,- action_251,- action_252,- action_253,- action_254 :: () => Prelude.Int -> ({-HappyReduction (Either String) = -}- Prelude.Int - -> (Token)- -> HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> (Either String) HappyAbsSyn)- -> [HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> (Either String) HappyAbsSyn)] - -> HappyStk HappyAbsSyn - -> [(Token)] -> (Either String) HappyAbsSyn)--happyReduce_33,- happyReduce_34,- happyReduce_35,- happyReduce_36,- happyReduce_37,- happyReduce_38,- happyReduce_39,- happyReduce_40,- happyReduce_41,- happyReduce_42,- happyReduce_43,- happyReduce_44,- happyReduce_45,- happyReduce_46,- happyReduce_47,- happyReduce_48,- happyReduce_49,- happyReduce_50,- happyReduce_51,- happyReduce_52,- happyReduce_53,- happyReduce_54,- happyReduce_55,- happyReduce_56,- happyReduce_57,- happyReduce_58,- happyReduce_59,- happyReduce_60,- happyReduce_61,- happyReduce_62,- happyReduce_63,- happyReduce_64,- happyReduce_65,- happyReduce_66,- happyReduce_67,- happyReduce_68,- happyReduce_69,- happyReduce_70,- happyReduce_71,- happyReduce_72,- happyReduce_73,- happyReduce_74,- happyReduce_75,- happyReduce_76,- happyReduce_77,- happyReduce_78,- happyReduce_79,- happyReduce_80,- happyReduce_81,- happyReduce_82,- happyReduce_83,- happyReduce_84,- happyReduce_85,- happyReduce_86,- happyReduce_87,- happyReduce_88,- happyReduce_89,- happyReduce_90,- happyReduce_91,- happyReduce_92,- happyReduce_93,- happyReduce_94,- happyReduce_95,- happyReduce_96,- happyReduce_97,- happyReduce_98,- happyReduce_99,- happyReduce_100,- happyReduce_101,- happyReduce_102,- happyReduce_103,- happyReduce_104,- happyReduce_105,- happyReduce_106,- happyReduce_107,- happyReduce_108,- happyReduce_109,- happyReduce_110,- happyReduce_111,- happyReduce_112,- happyReduce_113,- happyReduce_114,- happyReduce_115,- happyReduce_116,- happyReduce_117,- happyReduce_118,- happyReduce_119,- happyReduce_120,- happyReduce_121,- happyReduce_122,- happyReduce_123,- happyReduce_124,- happyReduce_125,- happyReduce_126,- happyReduce_127,- happyReduce_128,- happyReduce_129,- happyReduce_130,- happyReduce_131,- happyReduce_132,- happyReduce_133,- happyReduce_134,- happyReduce_135,- happyReduce_136,- happyReduce_137,- happyReduce_138,- happyReduce_139,- happyReduce_140,- happyReduce_141 :: () => ({-HappyReduction (Either String) = -}- Prelude.Int - -> (Token)- -> HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> (Either String) HappyAbsSyn)- -> [HappyState (Token) (HappyStk HappyAbsSyn -> [(Token)] -> (Either String) HappyAbsSyn)] - -> HappyStk HappyAbsSyn - -> [(Token)] -> (Either String) HappyAbsSyn)--happyExpList :: Happy_Data_Array.Array Prelude.Int Prelude.Int-happyExpList = Happy_Data_Array.listArray (0,638) ([0,0,0,0,512,24228,9955,32,0,0,0,0,20481,29103,4115,0,0,0,0,128,55209,2488,8,0,0,0,0,0,0,1024,0,0,0,0,16416,13802,110,2,0,0,0,4096,62752,14106,256,0,0,0,0,32776,36218,32795,0,0,0,0,0,64,0,68,0,0,0,0,8192,0,8704,0,0,0,0,0,16,0,16,0,0,0,32768,10240,0,2048,0,0,0,0,64,20,0,4,0,0,0,8192,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,16,0,0,0,0,16384,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,8,0,0,0,0,0,20480,0,0,0,0,0,0,0,8192,0,0,0,0,4096,256,0,496,0,0,0,0,32776,0,63488,0,0,0,0,1024,64,0,124,0,0,0,0,8194,0,15872,0,0,0,0,256,16,0,31,0,0,0,0,2048,0,2176,0,0,0,0,0,4,16384,4,0,0,0,0,0,256,0,0,0,0,0,16,25865,17024,0,0,0,0,2048,33920,16434,33,0,0,0,0,16388,6466,4256,0,0,0,0,512,41248,20492,8,0,0,0,0,0,0,256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,384,1,0,0,0,0,0,4096,2304,32869,66,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,0,0,0,0,0,16388,6466,4256,0,0,0,0,6144,16,0,0,0,0,0,0,32,0,0,0,0,0,0,128,10312,5123,2,0,0,0,0,0,0,16,0,0,0,0,1024,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32776,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,8194,0,15872,0,0,0,0,256,16,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,512,0,992,0,0,0,0,256,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16384,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,5,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,1024,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,256,0,0,0,0,32768,0,32768,0,0,0,0,0,0,0,64,0,0,0,0,40962,0,8192,0,0,0,0,0,0,1152,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,4,0,0,0,0,0,256,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,20993,29103,4099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32832,27604,1244,4,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,55208,440,8,0,0,0,16384,54400,56427,1028,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,36872,36218,32795,0,0,0,0,1024,16960,40985,16,0,0,0,0,8192,0,8192,0,0,0,0,0,16,0,16,0,0,0,0,128,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,0,0,0,8,0,0,0,0,0,0,64,0,0,0,0,0,0,16384,0,0,0,0,0,256,0,256,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2049,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,1024,0,0,0,0,0,0,0,1,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,32,2,57344,3,0,0,0,4096,256,0,496,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,4,16384,4,0,0,0,0,0,0,0,0,0,0,0,16,25865,17024,0,0,0,0,2048,33920,16434,33,0,0,0,0,8240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,4,0,0,0,0,0,8192,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,32768,18432,808,532,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,4096,0,0,0,0,0,128,0,128,0,0,0,0,0,0,0,0,0,0,0,512,41248,20492,8,0,0,0,0,4096,0,4352,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,64,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,4096,0,0,0,0,0,0,0,0,2560,0,0,0,0,0,16388,0,31744,0,0,0,0,0,32,0,34,0,0,0,0,2,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,1024,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,8192,0,8704,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,1024,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0- ])--{-# NOINLINE happyExpListPerState #-}-happyExpListPerState st =- token_strs_expected- where token_strs = ["error","%dummy","%start_pLGrammar","%start_pLDef","%start_pListLDef","%start_pListIdentifier","%start_pGrammar","%start_pListDef","%start_pDef","%start_pItem","%start_pListItem","%start_pCat","%start_pLabel","%start_pLabelId","%start_pProfItem","%start_pIntList","%start_pListInteger","%start_pListIntList","%start_pListProfItem","%start_pArg","%start_pListArg","%start_pSeparation","%start_pListString","%start_pExp","%start_pExp1","%start_pExp2","%start_pListExp","%start_pListExp2","%start_pRHS","%start_pListRHS","%start_pMinimumSize","%start_pReg","%start_pReg1","%start_pReg2","%start_pReg3","String","Integer","Char","Double","Identifier","LGrammar","LDef","ListLDef","ListIdentifier","Grammar","ListDef","Def","Item","ListItem","Cat","Label","LabelId","ProfItem","IntList","ListInteger","ListIntList","ListProfItem","Arg","ListArg","Separation","ListString","Exp","Exp1","Exp2","ListExp","ListExp2","RHS","ListRHS","MinimumSize","Reg","Reg1","Reg2","Reg3","'('","')'","'*'","'+'","','","'-'","'.'","':'","'::='","';'","'='","'?'","'['","']'","'_'","'char'","'coercions'","'comment'","'define'","'delimiters'","'digit'","'entrypoints'","'eps'","'internal'","'layout'","'letter'","'lower'","'nonempty'","'position'","'rules'","'separator'","'stop'","'terminator'","'token'","'toplevel'","'upper'","'views'","'{'","'|'","'}'","L_quoted","L_integ","L_charac","L_doubl","L_Identifier","%eof"]- bit_start = st Prelude.* 119- bit_end = (st Prelude.+ 1) Prelude.* 119- read_bit = readArrayBit happyExpList- bits = Prelude.map read_bit [bit_start..bit_end Prelude.- 1]- bits_indexed = Prelude.zip bits [0..118]- token_strs_expected = Prelude.concatMap f bits_indexed- f (Prelude.False, _) = []- f (Prelude.True, nr) = [token_strs Prelude.!! nr]--action_0 (74) = happyShift action_105-action_0 (83) = happyShift action_139-action_0 (86) = happyShift action_106-action_0 (88) = happyShift action_107-action_0 (90) = happyShift action_115-action_0 (91) = happyShift action_116-action_0 (92) = happyShift action_117-action_0 (93) = happyShift action_118-action_0 (95) = happyShift action_119-action_0 (97) = happyShift action_120-action_0 (98) = happyShift action_121-action_0 (102) = happyShift action_122-action_0 (103) = happyShift action_123-action_0 (104) = happyShift action_124-action_0 (106) = happyShift action_125-action_0 (107) = happyShift action_126-action_0 (110) = happyShift action_140-action_0 (118) = happyShift action_63-action_0 (40) = happyGoto action_134-action_0 (41) = happyGoto action_142-action_0 (42) = happyGoto action_135-action_0 (43) = happyGoto action_143-action_0 (44) = happyGoto action_137-action_0 (47) = happyGoto action_138-action_0 (51) = happyGoto action_114-action_0 (52) = happyGoto action_109-action_0 _ = happyReduce_42--action_1 (74) = happyShift action_105-action_1 (86) = happyShift action_106-action_1 (88) = happyShift action_107-action_1 (90) = happyShift action_115-action_1 (91) = happyShift action_116-action_1 (92) = happyShift action_117-action_1 (93) = happyShift action_118-action_1 (95) = happyShift action_119-action_1 (97) = happyShift action_120-action_1 (98) = happyShift action_121-action_1 (102) = happyShift action_122-action_1 (103) = happyShift action_123-action_1 (104) = happyShift action_124-action_1 (106) = happyShift action_125-action_1 (107) = happyShift action_126-action_1 (110) = happyShift action_140-action_1 (118) = happyShift action_63-action_1 (40) = happyGoto action_134-action_1 (42) = happyGoto action_141-action_1 (44) = happyGoto action_137-action_1 (47) = happyGoto action_138-action_1 (51) = happyGoto action_114-action_1 (52) = happyGoto action_109-action_1 _ = happyFail (happyExpListPerState 1)--action_2 (74) = happyShift action_105-action_2 (83) = happyShift action_139-action_2 (86) = happyShift action_106-action_2 (88) = happyShift action_107-action_2 (90) = happyShift action_115-action_2 (91) = happyShift action_116-action_2 (92) = happyShift action_117-action_2 (93) = happyShift action_118-action_2 (95) = happyShift action_119-action_2 (97) = happyShift action_120-action_2 (98) = happyShift action_121-action_2 (102) = happyShift action_122-action_2 (103) = happyShift action_123-action_2 (104) = happyShift action_124-action_2 (106) = happyShift action_125-action_2 (107) = happyShift action_126-action_2 (110) = happyShift action_140-action_2 (118) = happyShift action_63-action_2 (40) = happyGoto action_134-action_2 (42) = happyGoto action_135-action_2 (43) = happyGoto action_136-action_2 (44) = happyGoto action_137-action_2 (47) = happyGoto action_138-action_2 (51) = happyGoto action_114-action_2 (52) = happyGoto action_109-action_2 _ = happyReduce_42--action_3 (118) = happyShift action_63-action_3 (40) = happyGoto action_132-action_3 (44) = happyGoto action_133-action_3 _ = happyFail (happyExpListPerState 3)--action_4 (74) = happyShift action_105-action_4 (83) = happyShift action_129-action_4 (86) = happyShift action_106-action_4 (88) = happyShift action_107-action_4 (90) = happyShift action_115-action_4 (91) = happyShift action_116-action_4 (92) = happyShift action_117-action_4 (93) = happyShift action_118-action_4 (95) = happyShift action_119-action_4 (97) = happyShift action_120-action_4 (98) = happyShift action_121-action_4 (102) = happyShift action_122-action_4 (103) = happyShift action_123-action_4 (104) = happyShift action_124-action_4 (106) = happyShift action_125-action_4 (107) = happyShift action_126-action_4 (118) = happyShift action_63-action_4 (40) = happyGoto action_103-action_4 (45) = happyGoto action_130-action_4 (46) = happyGoto action_131-action_4 (47) = happyGoto action_128-action_4 (51) = happyGoto action_114-action_4 (52) = happyGoto action_109-action_4 _ = happyReduce_49--action_5 (74) = happyShift action_105-action_5 (83) = happyShift action_129-action_5 (86) = happyShift action_106-action_5 (88) = happyShift action_107-action_5 (90) = happyShift action_115-action_5 (91) = happyShift action_116-action_5 (92) = happyShift action_117-action_5 (93) = happyShift action_118-action_5 (95) = happyShift action_119-action_5 (97) = happyShift action_120-action_5 (98) = happyShift action_121-action_5 (102) = happyShift action_122-action_5 (103) = happyShift action_123-action_5 (104) = happyShift action_124-action_5 (106) = happyShift action_125-action_5 (107) = happyShift action_126-action_5 (118) = happyShift action_63-action_5 (40) = happyGoto action_103-action_5 (46) = happyGoto action_127-action_5 (47) = happyGoto action_128-action_5 (51) = happyGoto action_114-action_5 (52) = happyGoto action_109-action_5 _ = happyReduce_49--action_6 (74) = happyShift action_105-action_6 (86) = happyShift action_106-action_6 (88) = happyShift action_107-action_6 (90) = happyShift action_115-action_6 (91) = happyShift action_116-action_6 (92) = happyShift action_117-action_6 (93) = happyShift action_118-action_6 (95) = happyShift action_119-action_6 (97) = happyShift action_120-action_6 (98) = happyShift action_121-action_6 (102) = happyShift action_122-action_6 (103) = happyShift action_123-action_6 (104) = happyShift action_124-action_6 (106) = happyShift action_125-action_6 (107) = happyShift action_126-action_6 (118) = happyShift action_63-action_6 (40) = happyGoto action_103-action_6 (47) = happyGoto action_113-action_6 (51) = happyGoto action_114-action_6 (52) = happyGoto action_109-action_6 _ = happyFail (happyExpListPerState 6)--action_7 (86) = happyShift action_62-action_7 (114) = happyShift action_34-action_7 (118) = happyShift action_63-action_7 (36) = happyGoto action_55-action_7 (40) = happyGoto action_56-action_7 (48) = happyGoto action_112-action_7 (50) = happyGoto action_59-action_7 _ = happyFail (happyExpListPerState 7)--action_8 (86) = happyShift action_62-action_8 (114) = happyShift action_34-action_8 (118) = happyShift action_63-action_8 (36) = happyGoto action_55-action_8 (40) = happyGoto action_56-action_8 (48) = happyGoto action_57-action_8 (49) = happyGoto action_111-action_8 (50) = happyGoto action_59-action_8 _ = happyReduce_71--action_9 (86) = happyShift action_62-action_9 (118) = happyShift action_63-action_9 (40) = happyGoto action_56-action_9 (50) = happyGoto action_110-action_9 _ = happyFail (happyExpListPerState 9)--action_10 (74) = happyShift action_105-action_10 (86) = happyShift action_106-action_10 (88) = happyShift action_107-action_10 (118) = happyShift action_63-action_10 (40) = happyGoto action_103-action_10 (51) = happyGoto action_108-action_10 (52) = happyGoto action_109-action_10 _ = happyFail (happyExpListPerState 10)--action_11 (74) = happyShift action_105-action_11 (86) = happyShift action_106-action_11 (88) = happyShift action_107-action_11 (118) = happyShift action_63-action_11 (40) = happyGoto action_103-action_11 (52) = happyGoto action_104-action_11 _ = happyFail (happyExpListPerState 11)--action_12 (74) = happyShift action_95-action_12 (53) = happyGoto action_102-action_12 _ = happyFail (happyExpListPerState 12)--action_13 (86) = happyShift action_98-action_13 (54) = happyGoto action_101-action_13 _ = happyFail (happyExpListPerState 13)--action_14 (115) = happyShift action_74-action_14 (37) = happyGoto action_99-action_14 (55) = happyGoto action_100-action_14 _ = happyReduce_86--action_15 (86) = happyShift action_98-action_15 (54) = happyGoto action_96-action_15 (56) = happyGoto action_97-action_15 _ = happyReduce_89--action_16 (74) = happyShift action_95-action_16 (53) = happyGoto action_93-action_16 (57) = happyGoto action_94-action_16 _ = happyFail (happyExpListPerState 16)--action_17 (118) = happyShift action_63-action_17 (40) = happyGoto action_89-action_17 (58) = happyGoto action_92-action_17 _ = happyFail (happyExpListPerState 17)--action_18 (118) = happyShift action_63-action_18 (40) = happyGoto action_89-action_18 (58) = happyGoto action_90-action_18 (59) = happyGoto action_91-action_18 _ = happyReduce_95--action_19 (104) = happyShift action_87-action_19 (106) = happyShift action_88-action_19 (60) = happyGoto action_86-action_19 _ = happyReduce_97--action_20 (114) = happyShift action_34-action_20 (36) = happyGoto action_84-action_20 (61) = happyGoto action_85-action_20 _ = happyFail (happyExpListPerState 20)--action_21 (74) = happyShift action_72-action_21 (86) = happyShift action_73-action_21 (114) = happyShift action_34-action_21 (115) = happyShift action_74-action_21 (116) = happyShift action_46-action_21 (117) = happyShift action_75-action_21 (118) = happyShift action_63-action_21 (36) = happyGoto action_65-action_21 (37) = happyGoto action_66-action_21 (38) = happyGoto action_67-action_21 (39) = happyGoto action_68-action_21 (40) = happyGoto action_76-action_21 (62) = happyGoto action_83-action_21 (63) = happyGoto action_78-action_21 (64) = happyGoto action_79-action_21 _ = happyFail (happyExpListPerState 21)--action_22 (74) = happyShift action_72-action_22 (86) = happyShift action_73-action_22 (114) = happyShift action_34-action_22 (115) = happyShift action_74-action_22 (116) = happyShift action_46-action_22 (117) = happyShift action_75-action_22 (118) = happyShift action_63-action_22 (36) = happyGoto action_65-action_22 (37) = happyGoto action_66-action_22 (38) = happyGoto action_67-action_22 (39) = happyGoto action_68-action_22 (40) = happyGoto action_76-action_22 (63) = happyGoto action_82-action_22 (64) = happyGoto action_79-action_22 _ = happyFail (happyExpListPerState 22)--action_23 (74) = happyShift action_72-action_23 (86) = happyShift action_73-action_23 (114) = happyShift action_34-action_23 (115) = happyShift action_74-action_23 (116) = happyShift action_46-action_23 (117) = happyShift action_75-action_23 (118) = happyShift action_63-action_23 (36) = happyGoto action_65-action_23 (37) = happyGoto action_66-action_23 (38) = happyGoto action_67-action_23 (39) = happyGoto action_68-action_23 (40) = happyGoto action_69-action_23 (64) = happyGoto action_81-action_23 _ = happyFail (happyExpListPerState 23)--action_24 (74) = happyShift action_72-action_24 (86) = happyShift action_73-action_24 (114) = happyShift action_34-action_24 (115) = happyShift action_74-action_24 (116) = happyShift action_46-action_24 (117) = happyShift action_75-action_24 (118) = happyShift action_63-action_24 (36) = happyGoto action_65-action_24 (37) = happyGoto action_66-action_24 (38) = happyGoto action_67-action_24 (39) = happyGoto action_68-action_24 (40) = happyGoto action_76-action_24 (62) = happyGoto action_77-action_24 (63) = happyGoto action_78-action_24 (64) = happyGoto action_79-action_24 (65) = happyGoto action_80-action_24 _ = happyReduce_113--action_25 (74) = happyShift action_72-action_25 (86) = happyShift action_73-action_25 (114) = happyShift action_34-action_25 (115) = happyShift action_74-action_25 (116) = happyShift action_46-action_25 (117) = happyShift action_75-action_25 (118) = happyShift action_63-action_25 (36) = happyGoto action_65-action_25 (37) = happyGoto action_66-action_25 (38) = happyGoto action_67-action_25 (39) = happyGoto action_68-action_25 (40) = happyGoto action_69-action_25 (64) = happyGoto action_70-action_25 (66) = happyGoto action_71-action_25 _ = happyFail (happyExpListPerState 25)--action_26 (86) = happyShift action_62-action_26 (114) = happyShift action_34-action_26 (118) = happyShift action_63-action_26 (36) = happyGoto action_55-action_26 (40) = happyGoto action_56-action_26 (48) = happyGoto action_57-action_26 (49) = happyGoto action_58-action_26 (50) = happyGoto action_59-action_26 (67) = happyGoto action_64-action_26 _ = happyReduce_71--action_27 (86) = happyShift action_62-action_27 (114) = happyShift action_34-action_27 (118) = happyShift action_63-action_27 (36) = happyGoto action_55-action_27 (40) = happyGoto action_56-action_27 (48) = happyGoto action_57-action_27 (49) = happyGoto action_58-action_27 (50) = happyGoto action_59-action_27 (67) = happyGoto action_60-action_27 (68) = happyGoto action_61-action_27 _ = happyReduce_71--action_28 (101) = happyShift action_54-action_28 (69) = happyGoto action_53-action_28 _ = happyReduce_122--action_29 (74) = happyShift action_37-action_29 (86) = happyShift action_38-action_29 (89) = happyShift action_39-action_29 (94) = happyShift action_40-action_29 (96) = happyShift action_41-action_29 (99) = happyShift action_42-action_29 (100) = happyShift action_43-action_29 (109) = happyShift action_44-action_29 (111) = happyShift action_45-action_29 (116) = happyShift action_46-action_29 (38) = happyGoto action_35-action_29 (70) = happyGoto action_51-action_29 (71) = happyGoto action_52-action_29 (72) = happyGoto action_50-action_29 (73) = happyGoto action_48-action_29 _ = happyFail (happyExpListPerState 29)--action_30 (74) = happyShift action_37-action_30 (86) = happyShift action_38-action_30 (89) = happyShift action_39-action_30 (94) = happyShift action_40-action_30 (96) = happyShift action_41-action_30 (99) = happyShift action_42-action_30 (100) = happyShift action_43-action_30 (109) = happyShift action_44-action_30 (111) = happyShift action_45-action_30 (116) = happyShift action_46-action_30 (38) = happyGoto action_35-action_30 (71) = happyGoto action_49-action_30 (72) = happyGoto action_50-action_30 (73) = happyGoto action_48-action_30 _ = happyFail (happyExpListPerState 30)--action_31 (74) = happyShift action_37-action_31 (86) = happyShift action_38-action_31 (89) = happyShift action_39-action_31 (94) = happyShift action_40-action_31 (96) = happyShift action_41-action_31 (99) = happyShift action_42-action_31 (100) = happyShift action_43-action_31 (109) = happyShift action_44-action_31 (111) = happyShift action_45-action_31 (116) = happyShift action_46-action_31 (38) = happyGoto action_35-action_31 (72) = happyGoto action_47-action_31 (73) = happyGoto action_48-action_31 _ = happyFail (happyExpListPerState 31)--action_32 (74) = happyShift action_37-action_32 (86) = happyShift action_38-action_32 (89) = happyShift action_39-action_32 (94) = happyShift action_40-action_32 (96) = happyShift action_41-action_32 (99) = happyShift action_42-action_32 (100) = happyShift action_43-action_32 (109) = happyShift action_44-action_32 (111) = happyShift action_45-action_32 (116) = happyShift action_46-action_32 (38) = happyGoto action_35-action_32 (73) = happyGoto action_36-action_32 _ = happyFail (happyExpListPerState 32)--action_33 (114) = happyShift action_34-action_33 _ = happyFail (happyExpListPerState 33)--action_34 _ = happyReduce_33--action_35 _ = happyReduce_133--action_36 (76) = happyShift action_192-action_36 (77) = happyShift action_193-action_36 (85) = happyShift action_194-action_36 (119) = happyAccept-action_36 _ = happyFail (happyExpListPerState 36)--action_37 (74) = happyShift action_37-action_37 (86) = happyShift action_38-action_37 (89) = happyShift action_39-action_37 (94) = happyShift action_40-action_37 (96) = happyShift action_41-action_37 (99) = happyShift action_42-action_37 (100) = happyShift action_43-action_37 (109) = happyShift action_44-action_37 (111) = happyShift action_45-action_37 (116) = happyShift action_46-action_37 (38) = happyGoto action_35-action_37 (70) = happyGoto action_197-action_37 (71) = happyGoto action_52-action_37 (72) = happyGoto action_50-action_37 (73) = happyGoto action_48-action_37 _ = happyFail (happyExpListPerState 37)--action_38 (114) = happyShift action_34-action_38 (36) = happyGoto action_196-action_38 _ = happyFail (happyExpListPerState 38)--action_39 _ = happyReduce_140--action_40 _ = happyReduce_136--action_41 _ = happyReduce_132--action_42 _ = happyReduce_137--action_43 _ = happyReduce_139--action_44 _ = happyReduce_138--action_45 (114) = happyShift action_34-action_45 (36) = happyGoto action_195-action_45 _ = happyFail (happyExpListPerState 45)--action_46 _ = happyReduce_35--action_47 (74) = happyShift action_37-action_47 (86) = happyShift action_38-action_47 (89) = happyShift action_39-action_47 (94) = happyShift action_40-action_47 (96) = happyShift action_41-action_47 (99) = happyShift action_42-action_47 (100) = happyShift action_43-action_47 (109) = happyShift action_44-action_47 (111) = happyShift action_45-action_47 (116) = happyShift action_46-action_47 (119) = happyAccept-action_47 (38) = happyGoto action_35-action_47 (73) = happyGoto action_191-action_47 _ = happyFail (happyExpListPerState 47)--action_48 (76) = happyShift action_192-action_48 (77) = happyShift action_193-action_48 (85) = happyShift action_194-action_48 _ = happyReduce_128--action_49 (79) = happyShift action_189-action_49 (119) = happyAccept-action_49 _ = happyFail (happyExpListPerState 49)--action_50 (74) = happyShift action_37-action_50 (86) = happyShift action_38-action_50 (89) = happyShift action_39-action_50 (94) = happyShift action_40-action_50 (96) = happyShift action_41-action_50 (99) = happyShift action_42-action_50 (100) = happyShift action_43-action_50 (109) = happyShift action_44-action_50 (111) = happyShift action_45-action_50 (116) = happyShift action_46-action_50 (38) = happyGoto action_35-action_50 (73) = happyGoto action_191-action_50 _ = happyReduce_126--action_51 (112) = happyShift action_190-action_51 (119) = happyAccept-action_51 _ = happyFail (happyExpListPerState 51)--action_52 (79) = happyShift action_189-action_52 _ = happyReduce_124--action_53 (119) = happyAccept-action_53 _ = happyFail (happyExpListPerState 53)--action_54 _ = happyReduce_121--action_55 _ = happyReduce_69--action_56 _ = happyReduce_74--action_57 (86) = happyShift action_62-action_57 (114) = happyShift action_34-action_57 (118) = happyShift action_63-action_57 (36) = happyGoto action_55-action_57 (40) = happyGoto action_56-action_57 (48) = happyGoto action_57-action_57 (49) = happyGoto action_188-action_57 (50) = happyGoto action_59-action_57 _ = happyReduce_71--action_58 _ = happyReduce_118--action_59 _ = happyReduce_70--action_60 (112) = happyShift action_187-action_60 _ = happyReduce_119--action_61 (119) = happyAccept-action_61 _ = happyFail (happyExpListPerState 61)--action_62 (86) = happyShift action_62-action_62 (118) = happyShift action_63-action_62 (40) = happyGoto action_56-action_62 (50) = happyGoto action_186-action_62 _ = happyFail (happyExpListPerState 62)--action_63 _ = happyReduce_37--action_64 (119) = happyAccept-action_64 _ = happyFail (happyExpListPerState 64)--action_65 _ = happyReduce_109--action_66 _ = happyReduce_107--action_67 _ = happyReduce_108--action_68 _ = happyReduce_110--action_69 _ = happyReduce_106--action_70 (74) = happyShift action_72-action_70 (86) = happyShift action_73-action_70 (114) = happyShift action_34-action_70 (115) = happyShift action_74-action_70 (116) = happyShift action_46-action_70 (117) = happyShift action_75-action_70 (118) = happyShift action_63-action_70 (36) = happyGoto action_65-action_70 (37) = happyGoto action_66-action_70 (38) = happyGoto action_67-action_70 (39) = happyGoto action_68-action_70 (40) = happyGoto action_69-action_70 (64) = happyGoto action_70-action_70 (66) = happyGoto action_185-action_70 _ = happyReduce_116--action_71 (119) = happyAccept-action_71 _ = happyFail (happyExpListPerState 71)--action_72 (74) = happyShift action_72-action_72 (86) = happyShift action_73-action_72 (114) = happyShift action_34-action_72 (115) = happyShift action_74-action_72 (116) = happyShift action_46-action_72 (117) = happyShift action_75-action_72 (118) = happyShift action_63-action_72 (36) = happyGoto action_65-action_72 (37) = happyGoto action_66-action_72 (38) = happyGoto action_67-action_72 (39) = happyGoto action_68-action_72 (40) = happyGoto action_76-action_72 (62) = happyGoto action_184-action_72 (63) = happyGoto action_78-action_72 (64) = happyGoto action_79-action_72 _ = happyFail (happyExpListPerState 72)--action_73 (74) = happyShift action_72-action_73 (86) = happyShift action_73-action_73 (114) = happyShift action_34-action_73 (115) = happyShift action_74-action_73 (116) = happyShift action_46-action_73 (117) = happyShift action_75-action_73 (118) = happyShift action_63-action_73 (36) = happyGoto action_65-action_73 (37) = happyGoto action_66-action_73 (38) = happyGoto action_67-action_73 (39) = happyGoto action_68-action_73 (40) = happyGoto action_76-action_73 (62) = happyGoto action_77-action_73 (63) = happyGoto action_78-action_73 (64) = happyGoto action_79-action_73 (65) = happyGoto action_183-action_73 _ = happyReduce_113--action_74 _ = happyReduce_34--action_75 _ = happyReduce_36--action_76 (74) = happyShift action_72-action_76 (86) = happyShift action_73-action_76 (114) = happyShift action_34-action_76 (115) = happyShift action_74-action_76 (116) = happyShift action_46-action_76 (117) = happyShift action_75-action_76 (118) = happyShift action_63-action_76 (36) = happyGoto action_65-action_76 (37) = happyGoto action_66-action_76 (38) = happyGoto action_67-action_76 (39) = happyGoto action_68-action_76 (40) = happyGoto action_69-action_76 (64) = happyGoto action_70-action_76 (66) = happyGoto action_182-action_76 _ = happyReduce_106--action_77 (78) = happyShift action_181-action_77 _ = happyReduce_114--action_78 (81) = happyShift action_180-action_78 _ = happyReduce_103--action_79 _ = happyReduce_105--action_80 (119) = happyAccept-action_80 _ = happyFail (happyExpListPerState 80)--action_81 (119) = happyAccept-action_81 _ = happyFail (happyExpListPerState 81)--action_82 (119) = happyAccept-action_82 _ = happyFail (happyExpListPerState 82)--action_83 (119) = happyAccept-action_83 _ = happyFail (happyExpListPerState 83)--action_84 (78) = happyShift action_179-action_84 _ = happyReduce_100--action_85 (119) = happyAccept-action_85 _ = happyFail (happyExpListPerState 85)--action_86 (119) = happyAccept-action_86 _ = happyFail (happyExpListPerState 86)--action_87 (114) = happyShift action_34-action_87 (36) = happyGoto action_178-action_87 _ = happyFail (happyExpListPerState 87)--action_88 (114) = happyShift action_34-action_88 (36) = happyGoto action_177-action_88 _ = happyFail (happyExpListPerState 88)--action_89 _ = happyReduce_94--action_90 (118) = happyShift action_63-action_90 (40) = happyGoto action_89-action_90 (58) = happyGoto action_90-action_90 (59) = happyGoto action_176-action_90 _ = happyReduce_95--action_91 (119) = happyAccept-action_91 _ = happyFail (happyExpListPerState 91)--action_92 (119) = happyAccept-action_92 _ = happyFail (happyExpListPerState 92)--action_93 (74) = happyShift action_95-action_93 (53) = happyGoto action_93-action_93 (57) = happyGoto action_175-action_93 _ = happyReduce_92--action_94 (119) = happyAccept-action_94 _ = happyFail (happyExpListPerState 94)--action_95 (86) = happyShift action_174-action_95 _ = happyFail (happyExpListPerState 95)--action_96 (78) = happyShift action_173-action_96 _ = happyReduce_90--action_97 (119) = happyAccept-action_97 _ = happyFail (happyExpListPerState 97)--action_98 (115) = happyShift action_74-action_98 (37) = happyGoto action_99-action_98 (55) = happyGoto action_172-action_98 _ = happyReduce_86--action_99 (78) = happyShift action_171-action_99 _ = happyReduce_87--action_100 (119) = happyAccept-action_100 _ = happyFail (happyExpListPerState 100)--action_101 (119) = happyAccept-action_101 _ = happyFail (happyExpListPerState 101)--action_102 (119) = happyAccept-action_102 _ = happyFail (happyExpListPerState 102)--action_103 _ = happyReduce_79--action_104 (119) = happyAccept-action_104 _ = happyFail (happyExpListPerState 104)--action_105 (81) = happyShift action_170-action_105 _ = happyFail (happyExpListPerState 105)--action_106 (87) = happyShift action_169-action_106 _ = happyFail (happyExpListPerState 106)--action_107 _ = happyReduce_80--action_108 (119) = happyAccept-action_108 _ = happyFail (happyExpListPerState 108)--action_109 (74) = happyShift action_168-action_109 (86) = happyShift action_106-action_109 (88) = happyShift action_107-action_109 (118) = happyShift action_63-action_109 (40) = happyGoto action_103-action_109 (52) = happyGoto action_166-action_109 (53) = happyGoto action_93-action_109 (57) = happyGoto action_167-action_109 _ = happyReduce_75--action_110 (119) = happyAccept-action_110 _ = happyFail (happyExpListPerState 110)--action_111 (119) = happyAccept-action_111 _ = happyFail (happyExpListPerState 111)--action_112 (119) = happyAccept-action_112 _ = happyFail (happyExpListPerState 112)--action_113 (119) = happyAccept-action_113 _ = happyFail (happyExpListPerState 113)--action_114 (80) = happyShift action_165-action_114 _ = happyFail (happyExpListPerState 114)--action_115 (118) = happyShift action_63-action_115 (40) = happyGoto action_164-action_115 _ = happyFail (happyExpListPerState 115)--action_116 (114) = happyShift action_34-action_116 (36) = happyGoto action_163-action_116 _ = happyFail (happyExpListPerState 116)--action_117 (118) = happyShift action_63-action_117 (40) = happyGoto action_162-action_117 _ = happyFail (happyExpListPerState 117)--action_118 (86) = happyShift action_62-action_118 (118) = happyShift action_63-action_118 (40) = happyGoto action_56-action_118 (50) = happyGoto action_161-action_118 _ = happyFail (happyExpListPerState 118)--action_119 (118) = happyShift action_63-action_119 (40) = happyGoto action_132-action_119 (44) = happyGoto action_160-action_119 _ = happyFail (happyExpListPerState 119)--action_120 (74) = happyShift action_105-action_120 (86) = happyShift action_106-action_120 (88) = happyShift action_107-action_120 (118) = happyShift action_63-action_120 (40) = happyGoto action_103-action_120 (51) = happyGoto action_159-action_120 (52) = happyGoto action_109-action_120 _ = happyFail (happyExpListPerState 120)--action_121 (105) = happyShift action_157-action_121 (108) = happyShift action_158-action_121 (114) = happyShift action_34-action_121 (36) = happyGoto action_84-action_121 (61) = happyGoto action_156-action_121 _ = happyFail (happyExpListPerState 121)--action_122 (107) = happyShift action_155-action_122 _ = happyFail (happyExpListPerState 122)--action_123 (118) = happyShift action_63-action_123 (40) = happyGoto action_154-action_123 _ = happyFail (happyExpListPerState 123)--action_124 (101) = happyShift action_54-action_124 (69) = happyGoto action_153-action_124 _ = happyReduce_122--action_125 (101) = happyShift action_54-action_125 (69) = happyGoto action_152-action_125 _ = happyReduce_122--action_126 (118) = happyShift action_63-action_126 (40) = happyGoto action_151-action_126 _ = happyFail (happyExpListPerState 126)--action_127 (119) = happyAccept-action_127 _ = happyFail (happyExpListPerState 127)--action_128 (83) = happyShift action_150-action_128 _ = happyReduce_50--action_129 (74) = happyShift action_105-action_129 (83) = happyShift action_129-action_129 (86) = happyShift action_106-action_129 (88) = happyShift action_107-action_129 (90) = happyShift action_115-action_129 (91) = happyShift action_116-action_129 (92) = happyShift action_117-action_129 (93) = happyShift action_118-action_129 (95) = happyShift action_119-action_129 (97) = happyShift action_120-action_129 (98) = happyShift action_121-action_129 (102) = happyShift action_122-action_129 (103) = happyShift action_123-action_129 (104) = happyShift action_124-action_129 (106) = happyShift action_125-action_129 (107) = happyShift action_126-action_129 (118) = happyShift action_63-action_129 (40) = happyGoto action_103-action_129 (46) = happyGoto action_149-action_129 (47) = happyGoto action_128-action_129 (51) = happyGoto action_114-action_129 (52) = happyGoto action_109-action_129 _ = happyReduce_49--action_130 (119) = happyAccept-action_130 _ = happyFail (happyExpListPerState 130)--action_131 _ = happyReduce_48--action_132 (78) = happyShift action_148-action_132 _ = happyReduce_46--action_133 (119) = happyAccept-action_133 _ = happyFail (happyExpListPerState 133)--action_134 (78) = happyShift action_148-action_134 (81) = happyReduce_46-action_134 _ = happyReduce_79--action_135 (83) = happyShift action_147-action_135 _ = happyReduce_43--action_136 (119) = happyAccept-action_136 _ = happyFail (happyExpListPerState 136)--action_137 (81) = happyShift action_146-action_137 _ = happyFail (happyExpListPerState 137)--action_138 _ = happyReduce_39--action_139 (74) = happyShift action_105-action_139 (83) = happyShift action_139-action_139 (86) = happyShift action_106-action_139 (88) = happyShift action_107-action_139 (90) = happyShift action_115-action_139 (91) = happyShift action_116-action_139 (92) = happyShift action_117-action_139 (93) = happyShift action_118-action_139 (95) = happyShift action_119-action_139 (97) = happyShift action_120-action_139 (98) = happyShift action_121-action_139 (102) = happyShift action_122-action_139 (103) = happyShift action_123-action_139 (104) = happyShift action_124-action_139 (106) = happyShift action_125-action_139 (107) = happyShift action_126-action_139 (110) = happyShift action_140-action_139 (118) = happyShift action_63-action_139 (40) = happyGoto action_134-action_139 (42) = happyGoto action_135-action_139 (43) = happyGoto action_145-action_139 (44) = happyGoto action_137-action_139 (47) = happyGoto action_138-action_139 (51) = happyGoto action_114-action_139 (52) = happyGoto action_109-action_139 _ = happyReduce_42--action_140 (118) = happyShift action_63-action_140 (40) = happyGoto action_132-action_140 (44) = happyGoto action_144-action_140 _ = happyFail (happyExpListPerState 140)--action_141 (119) = happyAccept-action_141 _ = happyFail (happyExpListPerState 141)--action_142 (119) = happyAccept-action_142 _ = happyFail (happyExpListPerState 142)--action_143 _ = happyReduce_38--action_144 _ = happyReduce_41--action_145 _ = happyReduce_45--action_146 (74) = happyShift action_105-action_146 (86) = happyShift action_106-action_146 (88) = happyShift action_107-action_146 (90) = happyShift action_115-action_146 (91) = happyShift action_116-action_146 (92) = happyShift action_117-action_146 (93) = happyShift action_118-action_146 (95) = happyShift action_119-action_146 (97) = happyShift action_120-action_146 (98) = happyShift action_121-action_146 (102) = happyShift action_122-action_146 (103) = happyShift action_123-action_146 (104) = happyShift action_124-action_146 (106) = happyShift action_125-action_146 (107) = happyShift action_126-action_146 (118) = happyShift action_63-action_146 (40) = happyGoto action_103-action_146 (47) = happyGoto action_232-action_146 (51) = happyGoto action_114-action_146 (52) = happyGoto action_109-action_146 _ = happyFail (happyExpListPerState 146)--action_147 (74) = happyShift action_105-action_147 (83) = happyShift action_139-action_147 (86) = happyShift action_106-action_147 (88) = happyShift action_107-action_147 (90) = happyShift action_115-action_147 (91) = happyShift action_116-action_147 (92) = happyShift action_117-action_147 (93) = happyShift action_118-action_147 (95) = happyShift action_119-action_147 (97) = happyShift action_120-action_147 (98) = happyShift action_121-action_147 (102) = happyShift action_122-action_147 (103) = happyShift action_123-action_147 (104) = happyShift action_124-action_147 (106) = happyShift action_125-action_147 (107) = happyShift action_126-action_147 (110) = happyShift action_140-action_147 (118) = happyShift action_63-action_147 (40) = happyGoto action_134-action_147 (42) = happyGoto action_135-action_147 (43) = happyGoto action_231-action_147 (44) = happyGoto action_137-action_147 (47) = happyGoto action_138-action_147 (51) = happyGoto action_114-action_147 (52) = happyGoto action_109-action_147 _ = happyReduce_42--action_148 (118) = happyShift action_63-action_148 (40) = happyGoto action_132-action_148 (44) = happyGoto action_230-action_148 _ = happyFail (happyExpListPerState 148)--action_149 _ = happyReduce_52--action_150 (74) = happyShift action_105-action_150 (83) = happyShift action_129-action_150 (86) = happyShift action_106-action_150 (88) = happyShift action_107-action_150 (90) = happyShift action_115-action_150 (91) = happyShift action_116-action_150 (92) = happyShift action_117-action_150 (93) = happyShift action_118-action_150 (95) = happyShift action_119-action_150 (97) = happyShift action_120-action_150 (98) = happyShift action_121-action_150 (102) = happyShift action_122-action_150 (103) = happyShift action_123-action_150 (104) = happyShift action_124-action_150 (106) = happyShift action_125-action_150 (107) = happyShift action_126-action_150 (118) = happyShift action_63-action_150 (40) = happyGoto action_103-action_150 (46) = happyGoto action_229-action_150 (47) = happyGoto action_128-action_150 (51) = happyGoto action_114-action_150 (52) = happyGoto action_109-action_150 _ = happyReduce_49--action_151 (74) = happyShift action_37-action_151 (86) = happyShift action_38-action_151 (89) = happyShift action_39-action_151 (94) = happyShift action_40-action_151 (96) = happyShift action_41-action_151 (99) = happyShift action_42-action_151 (100) = happyShift action_43-action_151 (109) = happyShift action_44-action_151 (111) = happyShift action_45-action_151 (116) = happyShift action_46-action_151 (38) = happyGoto action_35-action_151 (70) = happyGoto action_228-action_151 (71) = happyGoto action_52-action_151 (72) = happyGoto action_50-action_151 (73) = happyGoto action_48-action_151 _ = happyFail (happyExpListPerState 151)--action_152 (86) = happyShift action_62-action_152 (118) = happyShift action_63-action_152 (40) = happyGoto action_56-action_152 (50) = happyGoto action_227-action_152 _ = happyFail (happyExpListPerState 152)--action_153 (86) = happyShift action_62-action_153 (118) = happyShift action_63-action_153 (40) = happyGoto action_56-action_153 (50) = happyGoto action_226-action_153 _ = happyFail (happyExpListPerState 153)--action_154 (82) = happyShift action_225-action_154 _ = happyFail (happyExpListPerState 154)--action_155 (118) = happyShift action_63-action_155 (40) = happyGoto action_224-action_155 _ = happyFail (happyExpListPerState 155)--action_156 _ = happyReduce_66--action_157 (114) = happyShift action_34-action_157 (36) = happyGoto action_84-action_157 (61) = happyGoto action_223-action_157 _ = happyFail (happyExpListPerState 157)--action_158 _ = happyReduce_68--action_159 (80) = happyShift action_222-action_159 _ = happyFail (happyExpListPerState 159)--action_160 _ = happyReduce_59--action_161 (114) = happyShift action_34-action_161 (36) = happyGoto action_221-action_161 _ = happyFail (happyExpListPerState 161)--action_162 (118) = happyShift action_63-action_162 (40) = happyGoto action_89-action_162 (58) = happyGoto action_90-action_162 (59) = happyGoto action_220-action_162 _ = happyReduce_95--action_163 (114) = happyShift action_34-action_163 (36) = happyGoto action_219-action_163 _ = happyReduce_54--action_164 (115) = happyShift action_74-action_164 (37) = happyGoto action_218-action_164 _ = happyFail (happyExpListPerState 164)--action_165 (86) = happyShift action_62-action_165 (118) = happyShift action_63-action_165 (40) = happyGoto action_56-action_165 (50) = happyGoto action_217-action_165 _ = happyFail (happyExpListPerState 165)--action_166 (74) = happyShift action_95-action_166 (53) = happyGoto action_93-action_166 (57) = happyGoto action_216-action_166 _ = happyReduce_78--action_167 _ = happyReduce_76--action_168 (81) = happyShift action_170-action_168 (86) = happyShift action_174-action_168 _ = happyFail (happyExpListPerState 168)--action_169 _ = happyReduce_81--action_170 (75) = happyShift action_214-action_170 (86) = happyShift action_215-action_170 _ = happyFail (happyExpListPerState 170)--action_171 (115) = happyShift action_74-action_171 (37) = happyGoto action_99-action_171 (55) = happyGoto action_213-action_171 _ = happyReduce_86--action_172 (87) = happyShift action_212-action_172 _ = happyFail (happyExpListPerState 172)--action_173 (86) = happyShift action_98-action_173 (54) = happyGoto action_96-action_173 (56) = happyGoto action_211-action_173 _ = happyReduce_89--action_174 (86) = happyShift action_98-action_174 (54) = happyGoto action_96-action_174 (56) = happyGoto action_210-action_174 _ = happyReduce_89--action_175 _ = happyReduce_93--action_176 _ = happyReduce_96--action_177 _ = happyReduce_98--action_178 _ = happyReduce_99--action_179 (114) = happyShift action_34-action_179 (36) = happyGoto action_84-action_179 (61) = happyGoto action_209-action_179 _ = happyFail (happyExpListPerState 179)--action_180 (74) = happyShift action_72-action_180 (86) = happyShift action_73-action_180 (114) = happyShift action_34-action_180 (115) = happyShift action_74-action_180 (116) = happyShift action_46-action_180 (117) = happyShift action_75-action_180 (118) = happyShift action_63-action_180 (36) = happyGoto action_65-action_180 (37) = happyGoto action_66-action_180 (38) = happyGoto action_67-action_180 (39) = happyGoto action_68-action_180 (40) = happyGoto action_76-action_180 (62) = happyGoto action_208-action_180 (63) = happyGoto action_78-action_180 (64) = happyGoto action_79-action_180 _ = happyFail (happyExpListPerState 180)--action_181 (74) = happyShift action_72-action_181 (86) = happyShift action_73-action_181 (114) = happyShift action_34-action_181 (115) = happyShift action_74-action_181 (116) = happyShift action_46-action_181 (117) = happyShift action_75-action_181 (118) = happyShift action_63-action_181 (36) = happyGoto action_65-action_181 (37) = happyGoto action_66-action_181 (38) = happyGoto action_67-action_181 (39) = happyGoto action_68-action_181 (40) = happyGoto action_76-action_181 (62) = happyGoto action_77-action_181 (63) = happyGoto action_78-action_181 (64) = happyGoto action_79-action_181 (65) = happyGoto action_207-action_181 _ = happyReduce_113--action_182 _ = happyReduce_104--action_183 (87) = happyShift action_206-action_183 _ = happyFail (happyExpListPerState 183)--action_184 (75) = happyShift action_205-action_184 _ = happyFail (happyExpListPerState 184)--action_185 _ = happyReduce_117--action_186 (87) = happyShift action_204-action_186 _ = happyFail (happyExpListPerState 186)--action_187 (86) = happyShift action_62-action_187 (114) = happyShift action_34-action_187 (118) = happyShift action_63-action_187 (36) = happyGoto action_55-action_187 (40) = happyGoto action_56-action_187 (48) = happyGoto action_57-action_187 (49) = happyGoto action_58-action_187 (50) = happyGoto action_59-action_187 (67) = happyGoto action_60-action_187 (68) = happyGoto action_203-action_187 _ = happyReduce_71--action_188 _ = happyReduce_72--action_189 (74) = happyShift action_37-action_189 (86) = happyShift action_38-action_189 (89) = happyShift action_39-action_189 (94) = happyShift action_40-action_189 (96) = happyShift action_41-action_189 (99) = happyShift action_42-action_189 (100) = happyShift action_43-action_189 (109) = happyShift action_44-action_189 (111) = happyShift action_45-action_189 (116) = happyShift action_46-action_189 (38) = happyGoto action_35-action_189 (72) = happyGoto action_202-action_189 (73) = happyGoto action_48-action_189 _ = happyFail (happyExpListPerState 189)--action_190 (74) = happyShift action_37-action_190 (86) = happyShift action_38-action_190 (89) = happyShift action_39-action_190 (94) = happyShift action_40-action_190 (96) = happyShift action_41-action_190 (99) = happyShift action_42-action_190 (100) = happyShift action_43-action_190 (109) = happyShift action_44-action_190 (111) = happyShift action_45-action_190 (116) = happyShift action_46-action_190 (38) = happyGoto action_35-action_190 (71) = happyGoto action_201-action_190 (72) = happyGoto action_50-action_190 (73) = happyGoto action_48-action_190 _ = happyFail (happyExpListPerState 190)--action_191 (76) = happyShift action_192-action_191 (77) = happyShift action_193-action_191 (85) = happyShift action_194-action_191 _ = happyReduce_127--action_192 _ = happyReduce_129--action_193 _ = happyReduce_130--action_194 _ = happyReduce_131--action_195 (113) = happyShift action_200-action_195 _ = happyFail (happyExpListPerState 195)--action_196 (87) = happyShift action_199-action_196 _ = happyFail (happyExpListPerState 196)--action_197 (75) = happyShift action_198-action_197 (112) = happyShift action_190-action_197 _ = happyFail (happyExpListPerState 197)--action_198 _ = happyReduce_141--action_199 _ = happyReduce_134--action_200 _ = happyReduce_135--action_201 (79) = happyShift action_189-action_201 _ = happyReduce_123--action_202 (74) = happyShift action_37-action_202 (86) = happyShift action_38-action_202 (89) = happyShift action_39-action_202 (94) = happyShift action_40-action_202 (96) = happyShift action_41-action_202 (99) = happyShift action_42-action_202 (100) = happyShift action_43-action_202 (109) = happyShift action_44-action_202 (111) = happyShift action_45-action_202 (116) = happyShift action_46-action_202 (38) = happyGoto action_35-action_202 (73) = happyGoto action_191-action_202 _ = happyReduce_125--action_203 _ = happyReduce_120--action_204 _ = happyReduce_73--action_205 _ = happyReduce_112--action_206 _ = happyReduce_111--action_207 _ = happyReduce_115--action_208 _ = happyReduce_102--action_209 _ = happyReduce_101--action_210 (87) = happyShift action_242-action_210 _ = happyFail (happyExpListPerState 210)--action_211 _ = happyReduce_91--action_212 _ = happyReduce_85--action_213 _ = happyReduce_88--action_214 _ = happyReduce_82--action_215 (87) = happyShift action_241-action_215 _ = happyFail (happyExpListPerState 215)--action_216 _ = happyReduce_77--action_217 (82) = happyShift action_240-action_217 _ = happyFail (happyExpListPerState 217)--action_218 _ = happyReduce_63--action_219 _ = happyReduce_55--action_220 (84) = happyShift action_239-action_220 _ = happyFail (happyExpListPerState 220)--action_221 (114) = happyShift action_34-action_221 (36) = happyGoto action_238-action_221 _ = happyFail (happyExpListPerState 221)--action_222 (86) = happyShift action_62-action_222 (118) = happyShift action_63-action_222 (40) = happyGoto action_56-action_222 (50) = happyGoto action_237-action_222 _ = happyFail (happyExpListPerState 222)--action_223 _ = happyReduce_67--action_224 (74) = happyShift action_37-action_224 (86) = happyShift action_38-action_224 (89) = happyShift action_39-action_224 (94) = happyShift action_40-action_224 (96) = happyShift action_41-action_224 (99) = happyShift action_42-action_224 (100) = happyShift action_43-action_224 (109) = happyShift action_44-action_224 (111) = happyShift action_45-action_224 (116) = happyShift action_46-action_224 (38) = happyGoto action_35-action_224 (70) = happyGoto action_236-action_224 (71) = happyGoto action_52-action_224 (72) = happyGoto action_50-action_224 (73) = happyGoto action_48-action_224 _ = happyFail (happyExpListPerState 224)--action_225 (86) = happyShift action_62-action_225 (114) = happyShift action_34-action_225 (118) = happyShift action_63-action_225 (36) = happyGoto action_55-action_225 (40) = happyGoto action_56-action_225 (48) = happyGoto action_57-action_225 (49) = happyGoto action_58-action_225 (50) = happyGoto action_59-action_225 (67) = happyGoto action_60-action_225 (68) = happyGoto action_235-action_225 _ = happyReduce_71--action_226 (114) = happyShift action_34-action_226 (36) = happyGoto action_234-action_226 _ = happyFail (happyExpListPerState 226)--action_227 (114) = happyShift action_34-action_227 (36) = happyGoto action_233-action_227 _ = happyFail (happyExpListPerState 227)--action_228 (112) = happyShift action_190-action_228 _ = happyReduce_57--action_229 _ = happyReduce_51--action_230 _ = happyReduce_47--action_231 _ = happyReduce_44--action_232 _ = happyReduce_40--action_233 _ = happyReduce_61--action_234 _ = happyReduce_60--action_235 _ = happyReduce_64--action_236 (112) = happyShift action_190-action_236 _ = happyReduce_58--action_237 (82) = happyShift action_248-action_237 _ = happyFail (happyExpListPerState 237)--action_238 (104) = happyShift action_87-action_238 (106) = happyShift action_88-action_238 (60) = happyGoto action_247-action_238 _ = happyReduce_97--action_239 (74) = happyShift action_72-action_239 (86) = happyShift action_73-action_239 (114) = happyShift action_34-action_239 (115) = happyShift action_74-action_239 (116) = happyShift action_46-action_239 (117) = happyShift action_75-action_239 (118) = happyShift action_63-action_239 (36) = happyGoto action_65-action_239 (37) = happyGoto action_66-action_239 (38) = happyGoto action_67-action_239 (39) = happyGoto action_68-action_239 (40) = happyGoto action_76-action_239 (62) = happyGoto action_246-action_239 (63) = happyGoto action_78-action_239 (64) = happyGoto action_79-action_239 _ = happyFail (happyExpListPerState 239)--action_240 (86) = happyShift action_62-action_240 (114) = happyShift action_34-action_240 (118) = happyShift action_63-action_240 (36) = happyGoto action_55-action_240 (40) = happyGoto action_56-action_240 (48) = happyGoto action_57-action_240 (49) = happyGoto action_245-action_240 (50) = happyGoto action_59-action_240 _ = happyReduce_71--action_241 (75) = happyShift action_244-action_241 _ = happyFail (happyExpListPerState 241)--action_242 (78) = happyShift action_243-action_242 _ = happyFail (happyExpListPerState 242)--action_243 (86) = happyShift action_251-action_243 _ = happyFail (happyExpListPerState 243)--action_244 _ = happyReduce_83--action_245 _ = happyReduce_53--action_246 _ = happyReduce_65--action_247 (101) = happyShift action_54-action_247 (69) = happyGoto action_250-action_247 _ = happyReduce_122--action_248 (86) = happyShift action_62-action_248 (114) = happyShift action_34-action_248 (118) = happyShift action_63-action_248 (36) = happyGoto action_55-action_248 (40) = happyGoto action_56-action_248 (48) = happyGoto action_57-action_248 (49) = happyGoto action_249-action_248 (50) = happyGoto action_59-action_248 _ = happyReduce_71--action_249 _ = happyReduce_56--action_250 _ = happyReduce_62--action_251 (115) = happyShift action_74-action_251 (37) = happyGoto action_99-action_251 (55) = happyGoto action_252-action_251 _ = happyReduce_86--action_252 (87) = happyShift action_253-action_252 _ = happyFail (happyExpListPerState 252)--action_253 (75) = happyShift action_254-action_253 _ = happyFail (happyExpListPerState 253)--action_254 _ = happyReduce_84--happyReduce_33 = happySpecReduce_1 36 happyReduction_33-happyReduction_33 (HappyTerminal (PT _ (TL happy_var_1)))- = HappyAbsSyn36- (happy_var_1- )-happyReduction_33 _ = notHappyAtAll --happyReduce_34 = happySpecReduce_1 37 happyReduction_34-happyReduction_34 (HappyTerminal (PT _ (TI happy_var_1)))- = HappyAbsSyn37- ((read (happy_var_1)) :: Integer- )-happyReduction_34 _ = notHappyAtAll --happyReduce_35 = happySpecReduce_1 38 happyReduction_35-happyReduction_35 (HappyTerminal (PT _ (TC happy_var_1)))- = HappyAbsSyn38- ((read (happy_var_1)) :: Char- )-happyReduction_35 _ = notHappyAtAll --happyReduce_36 = happySpecReduce_1 39 happyReduction_36-happyReduction_36 (HappyTerminal (PT _ (TD happy_var_1)))- = HappyAbsSyn39- ((read (happy_var_1)) :: Double- )-happyReduction_36 _ = notHappyAtAll --happyReduce_37 = happySpecReduce_1 40 happyReduction_37-happyReduction_37 (HappyTerminal happy_var_1)- = HappyAbsSyn40- (AbsBNF.Identifier (mkPosToken happy_var_1)- )-happyReduction_37 _ = notHappyAtAll --happyReduce_38 = happySpecReduce_1 41 happyReduction_38-happyReduction_38 (HappyAbsSyn43 happy_var_1)- = HappyAbsSyn41- (AbsBNF.LGr happy_var_1- )-happyReduction_38 _ = notHappyAtAll --happyReduce_39 = happySpecReduce_1 42 happyReduction_39-happyReduction_39 (HappyAbsSyn47 happy_var_1)- = HappyAbsSyn42- (AbsBNF.DefAll happy_var_1- )-happyReduction_39 _ = notHappyAtAll --happyReduce_40 = happySpecReduce_3 42 happyReduction_40-happyReduction_40 (HappyAbsSyn47 happy_var_3)- _- (HappyAbsSyn44 happy_var_1)- = HappyAbsSyn42- (AbsBNF.DefSome happy_var_1 happy_var_3- )-happyReduction_40 _ _ _ = notHappyAtAll --happyReduce_41 = happySpecReduce_2 42 happyReduction_41-happyReduction_41 (HappyAbsSyn44 happy_var_2)- _- = HappyAbsSyn42- (AbsBNF.LDefView happy_var_2- )-happyReduction_41 _ _ = notHappyAtAll --happyReduce_42 = happySpecReduce_0 43 happyReduction_42-happyReduction_42 = HappyAbsSyn43- ([]- )--happyReduce_43 = happySpecReduce_1 43 happyReduction_43-happyReduction_43 (HappyAbsSyn42 happy_var_1)- = HappyAbsSyn43- ((:[]) happy_var_1- )-happyReduction_43 _ = notHappyAtAll --happyReduce_44 = happySpecReduce_3 43 happyReduction_44-happyReduction_44 (HappyAbsSyn43 happy_var_3)- _- (HappyAbsSyn42 happy_var_1)- = HappyAbsSyn43- ((:) happy_var_1 happy_var_3- )-happyReduction_44 _ _ _ = notHappyAtAll --happyReduce_45 = happySpecReduce_2 43 happyReduction_45-happyReduction_45 (HappyAbsSyn43 happy_var_2)- _- = HappyAbsSyn43- (happy_var_2- )-happyReduction_45 _ _ = notHappyAtAll --happyReduce_46 = happySpecReduce_1 44 happyReduction_46-happyReduction_46 (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn44- ((:[]) happy_var_1- )-happyReduction_46 _ = notHappyAtAll --happyReduce_47 = happySpecReduce_3 44 happyReduction_47-happyReduction_47 (HappyAbsSyn44 happy_var_3)- _- (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn44- ((:) happy_var_1 happy_var_3- )-happyReduction_47 _ _ _ = notHappyAtAll --happyReduce_48 = happySpecReduce_1 45 happyReduction_48-happyReduction_48 (HappyAbsSyn46 happy_var_1)- = HappyAbsSyn45- (AbsBNF.Grammar happy_var_1- )-happyReduction_48 _ = notHappyAtAll --happyReduce_49 = happySpecReduce_0 46 happyReduction_49-happyReduction_49 = HappyAbsSyn46- ([]- )--happyReduce_50 = happySpecReduce_1 46 happyReduction_50-happyReduction_50 (HappyAbsSyn47 happy_var_1)- = HappyAbsSyn46- ((:[]) happy_var_1- )-happyReduction_50 _ = notHappyAtAll --happyReduce_51 = happySpecReduce_3 46 happyReduction_51-happyReduction_51 (HappyAbsSyn46 happy_var_3)- _- (HappyAbsSyn47 happy_var_1)- = HappyAbsSyn46- ((:) happy_var_1 happy_var_3- )-happyReduction_51 _ _ _ = notHappyAtAll --happyReduce_52 = happySpecReduce_2 46 happyReduction_52-happyReduction_52 (HappyAbsSyn46 happy_var_2)- _- = HappyAbsSyn46- (happy_var_2- )-happyReduction_52 _ _ = notHappyAtAll --happyReduce_53 = happyReduce 5 47 happyReduction_53-happyReduction_53 ((HappyAbsSyn49 happy_var_5) `HappyStk`- _ `HappyStk`- (HappyAbsSyn50 happy_var_3) `HappyStk`- _ `HappyStk`- (HappyAbsSyn51 happy_var_1) `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Rule happy_var_1 happy_var_3 happy_var_5- ) `HappyStk` happyRest--happyReduce_54 = happySpecReduce_2 47 happyReduction_54-happyReduction_54 (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Comment happy_var_2- )-happyReduction_54 _ _ = notHappyAtAll --happyReduce_55 = happySpecReduce_3 47 happyReduction_55-happyReduction_55 (HappyAbsSyn36 happy_var_3)- (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Comments happy_var_2 happy_var_3- )-happyReduction_55 _ _ _ = notHappyAtAll --happyReduce_56 = happyReduce 6 47 happyReduction_56-happyReduction_56 ((HappyAbsSyn49 happy_var_6) `HappyStk`- _ `HappyStk`- (HappyAbsSyn50 happy_var_4) `HappyStk`- _ `HappyStk`- (HappyAbsSyn51 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Internal happy_var_2 happy_var_4 happy_var_6- ) `HappyStk` happyRest--happyReduce_57 = happySpecReduce_3 47 happyReduction_57-happyReduction_57 (HappyAbsSyn70 happy_var_3)- (HappyAbsSyn40 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Token happy_var_2 happy_var_3- )-happyReduction_57 _ _ _ = notHappyAtAll --happyReduce_58 = happyReduce 4 47 happyReduction_58-happyReduction_58 ((HappyAbsSyn70 happy_var_4) `HappyStk`- (HappyAbsSyn40 happy_var_3) `HappyStk`- _ `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.PosToken happy_var_3 happy_var_4- ) `HappyStk` happyRest--happyReduce_59 = happySpecReduce_2 47 happyReduction_59-happyReduction_59 (HappyAbsSyn44 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Entryp happy_var_2- )-happyReduction_59 _ _ = notHappyAtAll --happyReduce_60 = happyReduce 4 47 happyReduction_60-happyReduction_60 ((HappyAbsSyn36 happy_var_4) `HappyStk`- (HappyAbsSyn50 happy_var_3) `HappyStk`- (HappyAbsSyn69 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Separator happy_var_2 happy_var_3 happy_var_4- ) `HappyStk` happyRest--happyReduce_61 = happyReduce 4 47 happyReduction_61-happyReduction_61 ((HappyAbsSyn36 happy_var_4) `HappyStk`- (HappyAbsSyn50 happy_var_3) `HappyStk`- (HappyAbsSyn69 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Terminator happy_var_2 happy_var_3 happy_var_4- ) `HappyStk` happyRest--happyReduce_62 = happyReduce 6 47 happyReduction_62-happyReduction_62 ((HappyAbsSyn69 happy_var_6) `HappyStk`- (HappyAbsSyn60 happy_var_5) `HappyStk`- (HappyAbsSyn36 happy_var_4) `HappyStk`- (HappyAbsSyn36 happy_var_3) `HappyStk`- (HappyAbsSyn50 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Delimiters happy_var_2 happy_var_3 happy_var_4 happy_var_5 happy_var_6- ) `HappyStk` happyRest--happyReduce_63 = happySpecReduce_3 47 happyReduction_63-happyReduction_63 (HappyAbsSyn37 happy_var_3)- (HappyAbsSyn40 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Coercions happy_var_2 happy_var_3- )-happyReduction_63 _ _ _ = notHappyAtAll --happyReduce_64 = happyReduce 4 47 happyReduction_64-happyReduction_64 ((HappyAbsSyn68 happy_var_4) `HappyStk`- _ `HappyStk`- (HappyAbsSyn40 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Rules happy_var_2 happy_var_4- ) `HappyStk` happyRest--happyReduce_65 = happyReduce 5 47 happyReduction_65-happyReduction_65 ((HappyAbsSyn62 happy_var_5) `HappyStk`- _ `HappyStk`- (HappyAbsSyn59 happy_var_3) `HappyStk`- (HappyAbsSyn40 happy_var_2) `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn47- (AbsBNF.Function happy_var_2 happy_var_3 happy_var_5- ) `HappyStk` happyRest--happyReduce_66 = happySpecReduce_2 47 happyReduction_66-happyReduction_66 (HappyAbsSyn61 happy_var_2)- _- = HappyAbsSyn47- (AbsBNF.Layout happy_var_2- )-happyReduction_66 _ _ = notHappyAtAll --happyReduce_67 = happySpecReduce_3 47 happyReduction_67-happyReduction_67 (HappyAbsSyn61 happy_var_3)- _- _- = HappyAbsSyn47- (AbsBNF.LayoutStop happy_var_3- )-happyReduction_67 _ _ _ = notHappyAtAll --happyReduce_68 = happySpecReduce_2 47 happyReduction_68-happyReduction_68 _- _- = HappyAbsSyn47- (AbsBNF.LayoutTop- )--happyReduce_69 = happySpecReduce_1 48 happyReduction_69-happyReduction_69 (HappyAbsSyn36 happy_var_1)- = HappyAbsSyn48- (AbsBNF.Terminal happy_var_1- )-happyReduction_69 _ = notHappyAtAll --happyReduce_70 = happySpecReduce_1 48 happyReduction_70-happyReduction_70 (HappyAbsSyn50 happy_var_1)- = HappyAbsSyn48- (AbsBNF.NTerminal happy_var_1- )-happyReduction_70 _ = notHappyAtAll --happyReduce_71 = happySpecReduce_0 49 happyReduction_71-happyReduction_71 = HappyAbsSyn49- ([]- )--happyReduce_72 = happySpecReduce_2 49 happyReduction_72-happyReduction_72 (HappyAbsSyn49 happy_var_2)- (HappyAbsSyn48 happy_var_1)- = HappyAbsSyn49- ((:) happy_var_1 happy_var_2- )-happyReduction_72 _ _ = notHappyAtAll --happyReduce_73 = happySpecReduce_3 50 happyReduction_73-happyReduction_73 _- (HappyAbsSyn50 happy_var_2)- _- = HappyAbsSyn50- (AbsBNF.ListCat happy_var_2- )-happyReduction_73 _ _ _ = notHappyAtAll --happyReduce_74 = happySpecReduce_1 50 happyReduction_74-happyReduction_74 (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn50- (AbsBNF.IdCat happy_var_1- )-happyReduction_74 _ = notHappyAtAll --happyReduce_75 = happySpecReduce_1 51 happyReduction_75-happyReduction_75 (HappyAbsSyn52 happy_var_1)- = HappyAbsSyn51- (AbsBNF.LabNoP happy_var_1- )-happyReduction_75 _ = notHappyAtAll --happyReduce_76 = happySpecReduce_2 51 happyReduction_76-happyReduction_76 (HappyAbsSyn57 happy_var_2)- (HappyAbsSyn52 happy_var_1)- = HappyAbsSyn51- (AbsBNF.LabP happy_var_1 happy_var_2- )-happyReduction_76 _ _ = notHappyAtAll --happyReduce_77 = happySpecReduce_3 51 happyReduction_77-happyReduction_77 (HappyAbsSyn57 happy_var_3)- (HappyAbsSyn52 happy_var_2)- (HappyAbsSyn52 happy_var_1)- = HappyAbsSyn51- (AbsBNF.LabPF happy_var_1 happy_var_2 happy_var_3- )-happyReduction_77 _ _ _ = notHappyAtAll --happyReduce_78 = happySpecReduce_2 51 happyReduction_78-happyReduction_78 (HappyAbsSyn52 happy_var_2)- (HappyAbsSyn52 happy_var_1)- = HappyAbsSyn51- (AbsBNF.LabF happy_var_1 happy_var_2- )-happyReduction_78 _ _ = notHappyAtAll --happyReduce_79 = happySpecReduce_1 52 happyReduction_79-happyReduction_79 (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn52- (AbsBNF.Id happy_var_1- )-happyReduction_79 _ = notHappyAtAll --happyReduce_80 = happySpecReduce_1 52 happyReduction_80-happyReduction_80 _- = HappyAbsSyn52- (AbsBNF.Wild- )--happyReduce_81 = happySpecReduce_2 52 happyReduction_81-happyReduction_81 _- _- = HappyAbsSyn52- (AbsBNF.ListE- )--happyReduce_82 = happySpecReduce_3 52 happyReduction_82-happyReduction_82 _- _- _- = HappyAbsSyn52- (AbsBNF.ListCons- )--happyReduce_83 = happyReduce 5 52 happyReduction_83-happyReduction_83 (_ `HappyStk`- _ `HappyStk`- _ `HappyStk`- _ `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn52- (AbsBNF.ListOne- ) `HappyStk` happyRest--happyReduce_84 = happyReduce 9 53 happyReduction_84-happyReduction_84 (_ `HappyStk`- _ `HappyStk`- (HappyAbsSyn55 happy_var_7) `HappyStk`- _ `HappyStk`- _ `HappyStk`- _ `HappyStk`- (HappyAbsSyn56 happy_var_3) `HappyStk`- _ `HappyStk`- _ `HappyStk`- happyRest)- = HappyAbsSyn53- (AbsBNF.ProfIt happy_var_3 happy_var_7- ) `HappyStk` happyRest--happyReduce_85 = happySpecReduce_3 54 happyReduction_85-happyReduction_85 _- (HappyAbsSyn55 happy_var_2)- _- = HappyAbsSyn54- (AbsBNF.Ints happy_var_2- )-happyReduction_85 _ _ _ = notHappyAtAll --happyReduce_86 = happySpecReduce_0 55 happyReduction_86-happyReduction_86 = HappyAbsSyn55- ([]- )--happyReduce_87 = happySpecReduce_1 55 happyReduction_87-happyReduction_87 (HappyAbsSyn37 happy_var_1)- = HappyAbsSyn55- ((:[]) happy_var_1- )-happyReduction_87 _ = notHappyAtAll --happyReduce_88 = happySpecReduce_3 55 happyReduction_88-happyReduction_88 (HappyAbsSyn55 happy_var_3)- _- (HappyAbsSyn37 happy_var_1)- = HappyAbsSyn55- ((:) happy_var_1 happy_var_3- )-happyReduction_88 _ _ _ = notHappyAtAll --happyReduce_89 = happySpecReduce_0 56 happyReduction_89-happyReduction_89 = HappyAbsSyn56- ([]- )--happyReduce_90 = happySpecReduce_1 56 happyReduction_90-happyReduction_90 (HappyAbsSyn54 happy_var_1)- = HappyAbsSyn56- ((:[]) happy_var_1- )-happyReduction_90 _ = notHappyAtAll --happyReduce_91 = happySpecReduce_3 56 happyReduction_91-happyReduction_91 (HappyAbsSyn56 happy_var_3)- _- (HappyAbsSyn54 happy_var_1)- = HappyAbsSyn56- ((:) happy_var_1 happy_var_3- )-happyReduction_91 _ _ _ = notHappyAtAll --happyReduce_92 = happySpecReduce_1 57 happyReduction_92-happyReduction_92 (HappyAbsSyn53 happy_var_1)- = HappyAbsSyn57- ((:[]) happy_var_1- )-happyReduction_92 _ = notHappyAtAll --happyReduce_93 = happySpecReduce_2 57 happyReduction_93-happyReduction_93 (HappyAbsSyn57 happy_var_2)- (HappyAbsSyn53 happy_var_1)- = HappyAbsSyn57- ((:) happy_var_1 happy_var_2- )-happyReduction_93 _ _ = notHappyAtAll --happyReduce_94 = happySpecReduce_1 58 happyReduction_94-happyReduction_94 (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn58- (AbsBNF.Arg happy_var_1- )-happyReduction_94 _ = notHappyAtAll --happyReduce_95 = happySpecReduce_0 59 happyReduction_95-happyReduction_95 = HappyAbsSyn59- ([]- )--happyReduce_96 = happySpecReduce_2 59 happyReduction_96-happyReduction_96 (HappyAbsSyn59 happy_var_2)- (HappyAbsSyn58 happy_var_1)- = HappyAbsSyn59- ((:) happy_var_1 happy_var_2- )-happyReduction_96 _ _ = notHappyAtAll --happyReduce_97 = happySpecReduce_0 60 happyReduction_97-happyReduction_97 = HappyAbsSyn60- (AbsBNF.SepNone- )--happyReduce_98 = happySpecReduce_2 60 happyReduction_98-happyReduction_98 (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn60- (AbsBNF.SepTerm happy_var_2- )-happyReduction_98 _ _ = notHappyAtAll --happyReduce_99 = happySpecReduce_2 60 happyReduction_99-happyReduction_99 (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn60- (AbsBNF.SepSepar happy_var_2- )-happyReduction_99 _ _ = notHappyAtAll --happyReduce_100 = happySpecReduce_1 61 happyReduction_100-happyReduction_100 (HappyAbsSyn36 happy_var_1)- = HappyAbsSyn61- ((:[]) happy_var_1- )-happyReduction_100 _ = notHappyAtAll --happyReduce_101 = happySpecReduce_3 61 happyReduction_101-happyReduction_101 (HappyAbsSyn61 happy_var_3)- _- (HappyAbsSyn36 happy_var_1)- = HappyAbsSyn61- ((:) happy_var_1 happy_var_3- )-happyReduction_101 _ _ _ = notHappyAtAll --happyReduce_102 = happySpecReduce_3 62 happyReduction_102-happyReduction_102 (HappyAbsSyn62 happy_var_3)- _- (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn62- (AbsBNF.Cons happy_var_1 happy_var_3- )-happyReduction_102 _ _ _ = notHappyAtAll --happyReduce_103 = happySpecReduce_1 62 happyReduction_103-happyReduction_103 (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn62- (happy_var_1- )-happyReduction_103 _ = notHappyAtAll --happyReduce_104 = happySpecReduce_2 63 happyReduction_104-happyReduction_104 (HappyAbsSyn65 happy_var_2)- (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn62- (AbsBNF.App happy_var_1 happy_var_2- )-happyReduction_104 _ _ = notHappyAtAll --happyReduce_105 = happySpecReduce_1 63 happyReduction_105-happyReduction_105 (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn62- (happy_var_1- )-happyReduction_105 _ = notHappyAtAll --happyReduce_106 = happySpecReduce_1 64 happyReduction_106-happyReduction_106 (HappyAbsSyn40 happy_var_1)- = HappyAbsSyn62- (AbsBNF.Var happy_var_1- )-happyReduction_106 _ = notHappyAtAll --happyReduce_107 = happySpecReduce_1 64 happyReduction_107-happyReduction_107 (HappyAbsSyn37 happy_var_1)- = HappyAbsSyn62- (AbsBNF.LitInt happy_var_1- )-happyReduction_107 _ = notHappyAtAll --happyReduce_108 = happySpecReduce_1 64 happyReduction_108-happyReduction_108 (HappyAbsSyn38 happy_var_1)- = HappyAbsSyn62- (AbsBNF.LitChar happy_var_1- )-happyReduction_108 _ = notHappyAtAll --happyReduce_109 = happySpecReduce_1 64 happyReduction_109-happyReduction_109 (HappyAbsSyn36 happy_var_1)- = HappyAbsSyn62- (AbsBNF.LitString happy_var_1- )-happyReduction_109 _ = notHappyAtAll --happyReduce_110 = happySpecReduce_1 64 happyReduction_110-happyReduction_110 (HappyAbsSyn39 happy_var_1)- = HappyAbsSyn62- (AbsBNF.LitDouble happy_var_1- )-happyReduction_110 _ = notHappyAtAll --happyReduce_111 = happySpecReduce_3 64 happyReduction_111-happyReduction_111 _- (HappyAbsSyn65 happy_var_2)- _- = HappyAbsSyn62- (AbsBNF.List happy_var_2- )-happyReduction_111 _ _ _ = notHappyAtAll --happyReduce_112 = happySpecReduce_3 64 happyReduction_112-happyReduction_112 _- (HappyAbsSyn62 happy_var_2)- _- = HappyAbsSyn62- (happy_var_2- )-happyReduction_112 _ _ _ = notHappyAtAll --happyReduce_113 = happySpecReduce_0 65 happyReduction_113-happyReduction_113 = HappyAbsSyn65- ([]- )--happyReduce_114 = happySpecReduce_1 65 happyReduction_114-happyReduction_114 (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn65- ((:[]) happy_var_1- )-happyReduction_114 _ = notHappyAtAll --happyReduce_115 = happySpecReduce_3 65 happyReduction_115-happyReduction_115 (HappyAbsSyn65 happy_var_3)- _- (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn65- ((:) happy_var_1 happy_var_3- )-happyReduction_115 _ _ _ = notHappyAtAll --happyReduce_116 = happySpecReduce_1 66 happyReduction_116-happyReduction_116 (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn65- ((:[]) happy_var_1- )-happyReduction_116 _ = notHappyAtAll --happyReduce_117 = happySpecReduce_2 66 happyReduction_117-happyReduction_117 (HappyAbsSyn65 happy_var_2)- (HappyAbsSyn62 happy_var_1)- = HappyAbsSyn65- ((:) happy_var_1 happy_var_2- )-happyReduction_117 _ _ = notHappyAtAll --happyReduce_118 = happySpecReduce_1 67 happyReduction_118-happyReduction_118 (HappyAbsSyn49 happy_var_1)- = HappyAbsSyn67- (AbsBNF.RHS happy_var_1- )-happyReduction_118 _ = notHappyAtAll --happyReduce_119 = happySpecReduce_1 68 happyReduction_119-happyReduction_119 (HappyAbsSyn67 happy_var_1)- = HappyAbsSyn68- ((:[]) happy_var_1- )-happyReduction_119 _ = notHappyAtAll --happyReduce_120 = happySpecReduce_3 68 happyReduction_120-happyReduction_120 (HappyAbsSyn68 happy_var_3)- _- (HappyAbsSyn67 happy_var_1)- = HappyAbsSyn68- ((:) happy_var_1 happy_var_3- )-happyReduction_120 _ _ _ = notHappyAtAll --happyReduce_121 = happySpecReduce_1 69 happyReduction_121-happyReduction_121 _- = HappyAbsSyn69- (AbsBNF.MNonempty- )--happyReduce_122 = happySpecReduce_0 69 happyReduction_122-happyReduction_122 = HappyAbsSyn69- (AbsBNF.MEmpty- )--happyReduce_123 = happySpecReduce_3 70 happyReduction_123-happyReduction_123 (HappyAbsSyn70 happy_var_3)- _- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RAlt happy_var_1 happy_var_3- )-happyReduction_123 _ _ _ = notHappyAtAll --happyReduce_124 = happySpecReduce_1 70 happyReduction_124-happyReduction_124 (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (happy_var_1- )-happyReduction_124 _ = notHappyAtAll --happyReduce_125 = happySpecReduce_3 71 happyReduction_125-happyReduction_125 (HappyAbsSyn70 happy_var_3)- _- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RMinus happy_var_1 happy_var_3- )-happyReduction_125 _ _ _ = notHappyAtAll --happyReduce_126 = happySpecReduce_1 71 happyReduction_126-happyReduction_126 (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (happy_var_1- )-happyReduction_126 _ = notHappyAtAll --happyReduce_127 = happySpecReduce_2 72 happyReduction_127-happyReduction_127 (HappyAbsSyn70 happy_var_2)- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RSeq happy_var_1 happy_var_2- )-happyReduction_127 _ _ = notHappyAtAll --happyReduce_128 = happySpecReduce_1 72 happyReduction_128-happyReduction_128 (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (happy_var_1- )-happyReduction_128 _ = notHappyAtAll --happyReduce_129 = happySpecReduce_2 73 happyReduction_129-happyReduction_129 _- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RStar happy_var_1- )-happyReduction_129 _ _ = notHappyAtAll --happyReduce_130 = happySpecReduce_2 73 happyReduction_130-happyReduction_130 _- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RPlus happy_var_1- )-happyReduction_130 _ _ = notHappyAtAll --happyReduce_131 = happySpecReduce_2 73 happyReduction_131-happyReduction_131 _- (HappyAbsSyn70 happy_var_1)- = HappyAbsSyn70- (AbsBNF.ROpt happy_var_1- )-happyReduction_131 _ _ = notHappyAtAll --happyReduce_132 = happySpecReduce_1 73 happyReduction_132-happyReduction_132 _- = HappyAbsSyn70- (AbsBNF.REps- )--happyReduce_133 = happySpecReduce_1 73 happyReduction_133-happyReduction_133 (HappyAbsSyn38 happy_var_1)- = HappyAbsSyn70- (AbsBNF.RChar happy_var_1- )-happyReduction_133 _ = notHappyAtAll --happyReduce_134 = happySpecReduce_3 73 happyReduction_134-happyReduction_134 _- (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn70- (AbsBNF.RAlts happy_var_2- )-happyReduction_134 _ _ _ = notHappyAtAll --happyReduce_135 = happySpecReduce_3 73 happyReduction_135-happyReduction_135 _- (HappyAbsSyn36 happy_var_2)- _- = HappyAbsSyn70- (AbsBNF.RSeqs happy_var_2- )-happyReduction_135 _ _ _ = notHappyAtAll --happyReduce_136 = happySpecReduce_1 73 happyReduction_136-happyReduction_136 _- = HappyAbsSyn70- (AbsBNF.RDigit- )--happyReduce_137 = happySpecReduce_1 73 happyReduction_137-happyReduction_137 _- = HappyAbsSyn70- (AbsBNF.RLetter- )--happyReduce_138 = happySpecReduce_1 73 happyReduction_138-happyReduction_138 _- = HappyAbsSyn70- (AbsBNF.RUpper- )--happyReduce_139 = happySpecReduce_1 73 happyReduction_139-happyReduction_139 _- = HappyAbsSyn70- (AbsBNF.RLower- )--happyReduce_140 = happySpecReduce_1 73 happyReduction_140-happyReduction_140 _- = HappyAbsSyn70- (AbsBNF.RAny- )--happyReduce_141 = happySpecReduce_3 73 happyReduction_141-happyReduction_141 _- (HappyAbsSyn70 happy_var_2)- _- = HappyAbsSyn70- (happy_var_2- )-happyReduction_141 _ _ _ = notHappyAtAll --happyNewToken action sts stk [] =- action 119 119 notHappyAtAll (HappyState action) sts stk []--happyNewToken action sts stk (tk:tks) =- let cont i = action i i tk (HappyState action) sts stk tks in- case tk of {- PT _ (TS _ 1) -> cont 74;- PT _ (TS _ 2) -> cont 75;- PT _ (TS _ 3) -> cont 76;- PT _ (TS _ 4) -> cont 77;- PT _ (TS _ 5) -> cont 78;- PT _ (TS _ 6) -> cont 79;- PT _ (TS _ 7) -> cont 80;- PT _ (TS _ 8) -> cont 81;- PT _ (TS _ 9) -> cont 82;- PT _ (TS _ 10) -> cont 83;- PT _ (TS _ 11) -> cont 84;- PT _ (TS _ 12) -> cont 85;- PT _ (TS _ 13) -> cont 86;- PT _ (TS _ 14) -> cont 87;- PT _ (TS _ 15) -> cont 88;- PT _ (TS _ 16) -> cont 89;- PT _ (TS _ 17) -> cont 90;- PT _ (TS _ 18) -> cont 91;- PT _ (TS _ 19) -> cont 92;- PT _ (TS _ 20) -> cont 93;- PT _ (TS _ 21) -> cont 94;- PT _ (TS _ 22) -> cont 95;- PT _ (TS _ 23) -> cont 96;- PT _ (TS _ 24) -> cont 97;- PT _ (TS _ 25) -> cont 98;- PT _ (TS _ 26) -> cont 99;- PT _ (TS _ 27) -> cont 100;- PT _ (TS _ 28) -> cont 101;- PT _ (TS _ 29) -> cont 102;- PT _ (TS _ 30) -> cont 103;- PT _ (TS _ 31) -> cont 104;- PT _ (TS _ 32) -> cont 105;- PT _ (TS _ 33) -> cont 106;- PT _ (TS _ 34) -> cont 107;- PT _ (TS _ 35) -> cont 108;- PT _ (TS _ 36) -> cont 109;- PT _ (TS _ 37) -> cont 110;- PT _ (TS _ 38) -> cont 111;- PT _ (TS _ 39) -> cont 112;- PT _ (TS _ 40) -> cont 113;- PT _ (TL happy_dollar_dollar) -> cont 114;- PT _ (TI happy_dollar_dollar) -> cont 115;- PT _ (TC happy_dollar_dollar) -> cont 116;- PT _ (TD happy_dollar_dollar) -> cont 117;- PT _ (T_Identifier _) -> cont 118;- _ -> happyError' ((tk:tks), [])- }--happyError_ explist 119 tk tks = happyError' (tks, explist)-happyError_ explist _ tk tks = happyError' ((tk:tks), explist)--happyThen :: () => Either String a -> (a -> Either String b) -> Either String b-happyThen = ((>>=))-happyReturn :: () => a -> Either String a-happyReturn = (return)-happyThen1 m k tks = ((>>=)) m (\a -> k a tks)-happyReturn1 :: () => a -> b -> Either String a-happyReturn1 = \a tks -> (return) a-happyError' :: () => ([(Token)], [Prelude.String]) -> Either String a-happyError' = (\(tokens, _) -> happyError tokens)-pLGrammar tks = happySomeParser where- happySomeParser = happyThen (happyParse action_0 tks) (\x -> case x of {HappyAbsSyn41 z -> happyReturn z; _other -> notHappyAtAll })--pLDef tks = happySomeParser where- happySomeParser = happyThen (happyParse action_1 tks) (\x -> case x of {HappyAbsSyn42 z -> happyReturn z; _other -> notHappyAtAll })--pListLDef tks = happySomeParser where- happySomeParser = happyThen (happyParse action_2 tks) (\x -> case x of {HappyAbsSyn43 z -> happyReturn z; _other -> notHappyAtAll })--pListIdentifier tks = happySomeParser where- happySomeParser = happyThen (happyParse action_3 tks) (\x -> case x of {HappyAbsSyn44 z -> happyReturn z; _other -> notHappyAtAll })--pGrammar tks = happySomeParser where- happySomeParser = happyThen (happyParse action_4 tks) (\x -> case x of {HappyAbsSyn45 z -> happyReturn z; _other -> notHappyAtAll })--pListDef tks = happySomeParser where- happySomeParser = happyThen (happyParse action_5 tks) (\x -> case x of {HappyAbsSyn46 z -> happyReturn z; _other -> notHappyAtAll })--pDef tks = happySomeParser where- happySomeParser = happyThen (happyParse action_6 tks) (\x -> case x of {HappyAbsSyn47 z -> happyReturn z; _other -> notHappyAtAll })--pItem tks = happySomeParser where- happySomeParser = happyThen (happyParse action_7 tks) (\x -> case x of {HappyAbsSyn48 z -> happyReturn z; _other -> notHappyAtAll })--pListItem tks = happySomeParser where- happySomeParser = happyThen (happyParse action_8 tks) (\x -> case x of {HappyAbsSyn49 z -> happyReturn z; _other -> notHappyAtAll })--pCat tks = happySomeParser where- happySomeParser = happyThen (happyParse action_9 tks) (\x -> case x of {HappyAbsSyn50 z -> happyReturn z; _other -> notHappyAtAll })--pLabel tks = happySomeParser where- happySomeParser = happyThen (happyParse action_10 tks) (\x -> case x of {HappyAbsSyn51 z -> happyReturn z; _other -> notHappyAtAll })--pLabelId tks = happySomeParser where- happySomeParser = happyThen (happyParse action_11 tks) (\x -> case x of {HappyAbsSyn52 z -> happyReturn z; _other -> notHappyAtAll })--pProfItem tks = happySomeParser where- happySomeParser = happyThen (happyParse action_12 tks) (\x -> case x of {HappyAbsSyn53 z -> happyReturn z; _other -> notHappyAtAll })--pIntList tks = happySomeParser where- happySomeParser = happyThen (happyParse action_13 tks) (\x -> case x of {HappyAbsSyn54 z -> happyReturn z; _other -> notHappyAtAll })--pListInteger tks = happySomeParser where- happySomeParser = happyThen (happyParse action_14 tks) (\x -> case x of {HappyAbsSyn55 z -> happyReturn z; _other -> notHappyAtAll })--pListIntList tks = happySomeParser where- happySomeParser = happyThen (happyParse action_15 tks) (\x -> case x of {HappyAbsSyn56 z -> happyReturn z; _other -> notHappyAtAll })--pListProfItem tks = happySomeParser where- happySomeParser = happyThen (happyParse action_16 tks) (\x -> case x of {HappyAbsSyn57 z -> happyReturn z; _other -> notHappyAtAll })--pArg tks = happySomeParser where- happySomeParser = happyThen (happyParse action_17 tks) (\x -> case x of {HappyAbsSyn58 z -> happyReturn z; _other -> notHappyAtAll })--pListArg tks = happySomeParser where- happySomeParser = happyThen (happyParse action_18 tks) (\x -> case x of {HappyAbsSyn59 z -> happyReturn z; _other -> notHappyAtAll })--pSeparation tks = happySomeParser where- happySomeParser = happyThen (happyParse action_19 tks) (\x -> case x of {HappyAbsSyn60 z -> happyReturn z; _other -> notHappyAtAll })--pListString tks = happySomeParser where- happySomeParser = happyThen (happyParse action_20 tks) (\x -> case x of {HappyAbsSyn61 z -> happyReturn z; _other -> notHappyAtAll })--pExp tks = happySomeParser where- happySomeParser = happyThen (happyParse action_21 tks) (\x -> case x of {HappyAbsSyn62 z -> happyReturn z; _other -> notHappyAtAll })--pExp1 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_22 tks) (\x -> case x of {HappyAbsSyn62 z -> happyReturn z; _other -> notHappyAtAll })--pExp2 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_23 tks) (\x -> case x of {HappyAbsSyn62 z -> happyReturn z; _other -> notHappyAtAll })--pListExp tks = happySomeParser where- happySomeParser = happyThen (happyParse action_24 tks) (\x -> case x of {HappyAbsSyn65 z -> happyReturn z; _other -> notHappyAtAll })--pListExp2 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_25 tks) (\x -> case x of {HappyAbsSyn65 z -> happyReturn z; _other -> notHappyAtAll })--pRHS tks = happySomeParser where- happySomeParser = happyThen (happyParse action_26 tks) (\x -> case x of {HappyAbsSyn67 z -> happyReturn z; _other -> notHappyAtAll })--pListRHS tks = happySomeParser where- happySomeParser = happyThen (happyParse action_27 tks) (\x -> case x of {HappyAbsSyn68 z -> happyReturn z; _other -> notHappyAtAll })--pMinimumSize tks = happySomeParser where- happySomeParser = happyThen (happyParse action_28 tks) (\x -> case x of {HappyAbsSyn69 z -> happyReturn z; _other -> notHappyAtAll })--pReg tks = happySomeParser where- happySomeParser = happyThen (happyParse action_29 tks) (\x -> case x of {HappyAbsSyn70 z -> happyReturn z; _other -> notHappyAtAll })--pReg1 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_30 tks) (\x -> case x of {HappyAbsSyn70 z -> happyReturn z; _other -> notHappyAtAll })--pReg2 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_31 tks) (\x -> case x of {HappyAbsSyn70 z -> happyReturn z; _other -> notHappyAtAll })--pReg3 tks = happySomeParser where- happySomeParser = happyThen (happyParse action_32 tks) (\x -> case x of {HappyAbsSyn70 z -> happyReturn z; _other -> notHappyAtAll })--happySeq = happyDontSeq---happyError :: [Token] -> Either String a-happyError ts = Left $- "syntax error at " ++ tokenPos ts ++- case ts of- [] -> []- [Err _] -> " due to lexer error"- t:_ -> " before `" ++ (prToken t) ++ "'"--myLexer = tokens-{-# LINE 1 "templates/GenericTemplate.hs" #-}--- $Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp $-------------------------------------------data Happy_IntList = HappyCons Prelude.Int Happy_IntList-----------------------------------------infixr 9 `HappyStk`-data HappyStk a = HappyStk a (HappyStk a)---------------------------------------------------------------------------------- starting the parse--happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll---------------------------------------------------------------------------------- Accepting the parse---- If the current token is ERROR_TOK, it means we've just accepted a partial--- parse (a %partial parser). We must ignore the saved token on the top of--- the stack in this case.-happyAccept (1) tk st sts (_ `HappyStk` ans `HappyStk` _) =- happyReturn1 ans-happyAccept j tk st sts (HappyStk ans _) = - (happyReturn1 ans)---------------------------------------------------------------------------------- Arrays only: do the next action------------------------------------------indexShortOffAddr arr off = arr Happy_Data_Array.! off---{-# INLINE happyLt #-}-happyLt x y = (x Prelude.< y)-------readArrayBit arr bit =- Bits.testBit (indexShortOffAddr arr (bit `Prelude.div` 16)) (bit `Prelude.mod` 16)--------------------------------------------------------------------------------------- HappyState data type (not arrays)----newtype HappyState b c = HappyState- (Prelude.Int -> -- token number- Prelude.Int -> -- token number (yes, again)- b -> -- token semantic value- HappyState b c -> -- current state- [HappyState b c] -> -- state stack- c)------------------------------------------------------------------------------------ Shifting a token--happyShift new_state (1) tk st sts stk@(x `HappyStk` _) =- let i = (case x of { HappyErrorToken (i) -> i }) in--- trace "shifting the error token" $- new_state i i tk (HappyState (new_state)) ((st):(sts)) (stk)--happyShift new_state i tk st sts stk =- happyNewToken new_state ((st):(sts)) ((HappyTerminal (tk))`HappyStk`stk)---- happyReduce is specialised for the common cases.--happySpecReduce_0 i fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happySpecReduce_0 nt fn j tk st@((HappyState (action))) sts stk- = action nt j tk st ((st):(sts)) (fn `HappyStk` stk)--happySpecReduce_1 i fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happySpecReduce_1 nt fn j tk _ sts@(((st@(HappyState (action))):(_))) (v1`HappyStk`stk')- = let r = fn v1 in- happySeq r (action nt j tk st sts (r `HappyStk` stk'))--happySpecReduce_2 i fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happySpecReduce_2 nt fn j tk _ ((_):(sts@(((st@(HappyState (action))):(_))))) (v1`HappyStk`v2`HappyStk`stk')- = let r = fn v1 v2 in- happySeq r (action nt j tk st sts (r `HappyStk` stk'))--happySpecReduce_3 i fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happySpecReduce_3 nt fn j tk _ ((_):(((_):(sts@(((st@(HappyState (action))):(_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')- = let r = fn v1 v2 v3 in- happySeq r (action nt j tk st sts (r `HappyStk` stk'))--happyReduce k i fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happyReduce k nt fn j tk st sts stk- = case happyDrop (k Prelude.- ((1) :: Prelude.Int)) sts of- sts1@(((st1@(HappyState (action))):(_))) ->- let r = fn stk in -- it doesn't hurt to always seq here...- happyDoSeq r (action nt j tk st1 sts1 r)--happyMonadReduce k nt fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happyMonadReduce k nt fn j tk st sts stk =- case happyDrop k ((st):(sts)) of- sts1@(((st1@(HappyState (action))):(_))) ->- let drop_stk = happyDropStk k stk in- happyThen1 (fn stk tk) (\r -> action nt j tk st1 sts1 (r `HappyStk` drop_stk))--happyMonad2Reduce k nt fn (1) tk st sts stk- = happyFail [] (1) tk st sts stk-happyMonad2Reduce k nt fn j tk st sts stk =- case happyDrop k ((st):(sts)) of- sts1@(((st1@(HappyState (action))):(_))) ->- let drop_stk = happyDropStk k stk------ _ = nt :: Prelude.Int- new_state = action-- in- happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))--happyDrop (0) l = l-happyDrop n ((_):(t)) = happyDrop (n Prelude.- ((1) :: Prelude.Int)) t--happyDropStk (0) l = l-happyDropStk n (x `HappyStk` xs) = happyDropStk (n Prelude.- ((1)::Prelude.Int)) xs---------------------------------------------------------------------------------- Moving to a new state after a reduction----------happyGoto action j tk st = action j j tk (HappyState action)----------------------------------------------------------------------------------- Error recovery (ERROR_TOK is the error token)---- parse error if we are in recovery and we fail again-happyFail explist (1) tk old_st _ stk@(x `HappyStk` _) =- let i = (case x of { HappyErrorToken (i) -> i }) in--- trace "failing" $ - happyError_ explist i tk--{- We don't need state discarding for our restricted implementation of- "error". In fact, it can cause some bogus parses, so I've disabled it- for now --SDM---- discard a state-happyFail ERROR_TOK tk old_st CONS(HAPPYSTATE(action),sts) - (saved_tok `HappyStk` _ `HappyStk` stk) =--- trace ("discarding state, depth " ++ show (length stk)) $- DO_ACTION(action,ERROR_TOK,tk,sts,(saved_tok`HappyStk`stk))--}---- Enter error recovery: generate an error token,--- save the old token and carry on.-happyFail explist i tk (HappyState (action)) sts stk =--- trace "entering error recovery" $- action (1) (1) tk (HappyState (action)) sts ((HappyErrorToken (i)) `HappyStk` stk)---- Internal happy errors:--notHappyAtAll :: a-notHappyAtAll = Prelude.error "Internal Happy error\n"---------------------------------------------------------------------------------- Hack to get the typechecker to accept our action functions---------------------------------------------------------------------------------------- Seq-ing. If the --strict flag is given, then Happy emits --- happySeq = happyDoSeq--- otherwise it emits--- happySeq = happyDontSeq--happyDoSeq, happyDontSeq :: a -> b -> b-happyDoSeq a b = a `Prelude.seq` b-happyDontSeq a b = b---------------------------------------------------------------------------------- Don't inline any functions from the template. GHC has a nasty habit--- of deciding to inline happyGoto everywhere, which increases the size of--- the generated parser quite a bit.----------{-# NOINLINE happyShift #-}-{-# NOINLINE happySpecReduce_0 #-}-{-# NOINLINE happySpecReduce_1 #-}-{-# NOINLINE happySpecReduce_2 #-}-{-# NOINLINE happySpecReduce_3 #-}-{-# NOINLINE happyReduce #-}-{-# NOINLINE happyMonadReduce #-}-{-# NOINLINE happyGoto #-}-{-# NOINLINE happyFail #-}---- end of Happy Template.
− src/ParBNF.y
@@ -1,280 +0,0 @@--- This Happy file was machine-generated by the BNF converter-{-{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}-module ParBNF where-import qualified AbsBNF-import LexBNF-}--%name pLGrammar LGrammar-%name pLDef LDef-%name pListLDef ListLDef-%name pListIdentifier ListIdentifier-%name pGrammar Grammar-%name pListDef ListDef-%name pDef Def-%name pItem Item-%name pListItem ListItem-%name pCat Cat-%name pLabel Label-%name pLabelId LabelId-%name pProfItem ProfItem-%name pIntList IntList-%name pListInteger ListInteger-%name pListIntList ListIntList-%name pListProfItem ListProfItem-%name pArg Arg-%name pListArg ListArg-%name pSeparation Separation-%name pListString ListString-%name pExp Exp-%name pExp1 Exp1-%name pExp2 Exp2-%name pListExp ListExp-%name pListExp2 ListExp2-%name pRHS RHS-%name pListRHS ListRHS-%name pMinimumSize MinimumSize-%name pReg Reg-%name pReg1 Reg1-%name pReg2 Reg2-%name pReg3 Reg3--- no lexer declaration-%monad { Either String } { (>>=) } { return }-%tokentype {Token}-%token- '(' { PT _ (TS _ 1) }- ')' { PT _ (TS _ 2) }- '*' { PT _ (TS _ 3) }- '+' { PT _ (TS _ 4) }- ',' { PT _ (TS _ 5) }- '-' { PT _ (TS _ 6) }- '.' { PT _ (TS _ 7) }- ':' { PT _ (TS _ 8) }- '::=' { PT _ (TS _ 9) }- ';' { PT _ (TS _ 10) }- '=' { PT _ (TS _ 11) }- '?' { PT _ (TS _ 12) }- '[' { PT _ (TS _ 13) }- ']' { PT _ (TS _ 14) }- '_' { PT _ (TS _ 15) }- 'char' { PT _ (TS _ 16) }- 'coercions' { PT _ (TS _ 17) }- 'comment' { PT _ (TS _ 18) }- 'define' { PT _ (TS _ 19) }- 'delimiters' { PT _ (TS _ 20) }- 'digit' { PT _ (TS _ 21) }- 'entrypoints' { PT _ (TS _ 22) }- 'eps' { PT _ (TS _ 23) }- 'internal' { PT _ (TS _ 24) }- 'layout' { PT _ (TS _ 25) }- 'letter' { PT _ (TS _ 26) }- 'lower' { PT _ (TS _ 27) }- 'nonempty' { PT _ (TS _ 28) }- 'position' { PT _ (TS _ 29) }- 'rules' { PT _ (TS _ 30) }- 'separator' { PT _ (TS _ 31) }- 'stop' { PT _ (TS _ 32) }- 'terminator' { PT _ (TS _ 33) }- 'token' { PT _ (TS _ 34) }- 'toplevel' { PT _ (TS _ 35) }- 'upper' { PT _ (TS _ 36) }- 'views' { PT _ (TS _ 37) }- '{' { PT _ (TS _ 38) }- '|' { PT _ (TS _ 39) }- '}' { PT _ (TS _ 40) }- L_quoted { PT _ (TL $$) }- L_integ { PT _ (TI $$) }- L_charac { PT _ (TC $$) }- L_doubl { PT _ (TD $$) }- L_Identifier { PT _ (T_Identifier _) }--%%--String :: { String }-String : L_quoted { $1 }--Integer :: { Integer }-Integer : L_integ { (read ($1)) :: Integer }--Char :: { Char }-Char : L_charac { (read ($1)) :: Char }--Double :: { Double }-Double : L_doubl { (read ($1)) :: Double }--Identifier :: { AbsBNF.Identifier}-Identifier : L_Identifier { AbsBNF.Identifier (mkPosToken $1) }--LGrammar :: { AbsBNF.LGrammar }-LGrammar : ListLDef { AbsBNF.LGr $1 }--LDef :: { AbsBNF.LDef }-LDef : Def { AbsBNF.DefAll $1 }- | ListIdentifier ':' Def { AbsBNF.DefSome $1 $3 }- | 'views' ListIdentifier { AbsBNF.LDefView $2 }--ListLDef :: { [AbsBNF.LDef] }-ListLDef : {- empty -} { [] }- | LDef { (:[]) $1 }- | LDef ';' ListLDef { (:) $1 $3 }- | ';' ListLDef { $2 }--ListIdentifier :: { [AbsBNF.Identifier] }-ListIdentifier : Identifier { (:[]) $1 }- | Identifier ',' ListIdentifier { (:) $1 $3 }--Grammar :: { AbsBNF.Grammar }-Grammar : ListDef { AbsBNF.Grammar $1 }--ListDef :: { [AbsBNF.Def] }-ListDef : {- empty -} { [] }- | Def { (:[]) $1 }- | Def ';' ListDef { (:) $1 $3 }- | ';' ListDef { $2 }--Def :: { AbsBNF.Def }-Def : Label '.' Cat '::=' ListItem { AbsBNF.Rule $1 $3 $5 }- | 'comment' String { AbsBNF.Comment $2 }- | 'comment' String String { AbsBNF.Comments $2 $3 }- | 'internal' Label '.' Cat '::=' ListItem { AbsBNF.Internal $2 $4 $6 }- | 'token' Identifier Reg { AbsBNF.Token $2 $3 }- | 'position' 'token' Identifier Reg { AbsBNF.PosToken $3 $4 }- | 'entrypoints' ListIdentifier { AbsBNF.Entryp $2 }- | 'separator' MinimumSize Cat String { AbsBNF.Separator $2 $3 $4 }- | 'terminator' MinimumSize Cat String { AbsBNF.Terminator $2 $3 $4 }- | 'delimiters' Cat String String Separation MinimumSize { AbsBNF.Delimiters $2 $3 $4 $5 $6 }- | 'coercions' Identifier Integer { AbsBNF.Coercions $2 $3 }- | 'rules' Identifier '::=' ListRHS { AbsBNF.Rules $2 $4 }- | 'define' Identifier ListArg '=' Exp { AbsBNF.Function $2 $3 $5 }- | 'layout' ListString { AbsBNF.Layout $2 }- | 'layout' 'stop' ListString { AbsBNF.LayoutStop $3 }- | 'layout' 'toplevel' { AbsBNF.LayoutTop }--Item :: { AbsBNF.Item }-Item : String { AbsBNF.Terminal $1 } | Cat { AbsBNF.NTerminal $1 }--ListItem :: { [AbsBNF.Item] }-ListItem : {- empty -} { [] } | Item ListItem { (:) $1 $2 }--Cat :: { AbsBNF.Cat }-Cat : '[' Cat ']' { AbsBNF.ListCat $2 }- | Identifier { AbsBNF.IdCat $1 }--Label :: { AbsBNF.Label }-Label : LabelId { AbsBNF.LabNoP $1 }- | LabelId ListProfItem { AbsBNF.LabP $1 $2 }- | LabelId LabelId ListProfItem { AbsBNF.LabPF $1 $2 $3 }- | LabelId LabelId { AbsBNF.LabF $1 $2 }--LabelId :: { AbsBNF.LabelId }-LabelId : Identifier { AbsBNF.Id $1 }- | '_' { AbsBNF.Wild }- | '[' ']' { AbsBNF.ListE }- | '(' ':' ')' { AbsBNF.ListCons }- | '(' ':' '[' ']' ')' { AbsBNF.ListOne }--ProfItem :: { AbsBNF.ProfItem }-ProfItem : '(' '[' ListIntList ']' ',' '[' ListInteger ']' ')' { AbsBNF.ProfIt $3 $7 }--IntList :: { AbsBNF.IntList }-IntList : '[' ListInteger ']' { AbsBNF.Ints $2 }--ListInteger :: { [Integer] }-ListInteger : {- empty -} { [] }- | Integer { (:[]) $1 }- | Integer ',' ListInteger { (:) $1 $3 }--ListIntList :: { [AbsBNF.IntList] }-ListIntList : {- empty -} { [] }- | IntList { (:[]) $1 }- | IntList ',' ListIntList { (:) $1 $3 }--ListProfItem :: { [AbsBNF.ProfItem] }-ListProfItem : ProfItem { (:[]) $1 }- | ProfItem ListProfItem { (:) $1 $2 }--Arg :: { AbsBNF.Arg }-Arg : Identifier { AbsBNF.Arg $1 }--ListArg :: { [AbsBNF.Arg] }-ListArg : {- empty -} { [] } | Arg ListArg { (:) $1 $2 }--Separation :: { AbsBNF.Separation }-Separation : {- empty -} { AbsBNF.SepNone }- | 'terminator' String { AbsBNF.SepTerm $2 }- | 'separator' String { AbsBNF.SepSepar $2 }--ListString :: { [String] }-ListString : String { (:[]) $1 }- | String ',' ListString { (:) $1 $3 }--Exp :: { AbsBNF.Exp }-Exp : Exp1 ':' Exp { AbsBNF.Cons $1 $3 } | Exp1 { $1 }--Exp1 :: { AbsBNF.Exp }-Exp1 : Identifier ListExp2 { AbsBNF.App $1 $2 } | Exp2 { $1 }--Exp2 :: { AbsBNF.Exp }-Exp2 : Identifier { AbsBNF.Var $1 }- | Integer { AbsBNF.LitInt $1 }- | Char { AbsBNF.LitChar $1 }- | String { AbsBNF.LitString $1 }- | Double { AbsBNF.LitDouble $1 }- | '[' ListExp ']' { AbsBNF.List $2 }- | '(' Exp ')' { $2 }--ListExp :: { [AbsBNF.Exp] }-ListExp : {- empty -} { [] }- | Exp { (:[]) $1 }- | Exp ',' ListExp { (:) $1 $3 }--ListExp2 :: { [AbsBNF.Exp] }-ListExp2 : Exp2 { (:[]) $1 } | Exp2 ListExp2 { (:) $1 $2 }--RHS :: { AbsBNF.RHS }-RHS : ListItem { AbsBNF.RHS $1 }--ListRHS :: { [AbsBNF.RHS] }-ListRHS : RHS { (:[]) $1 } | RHS '|' ListRHS { (:) $1 $3 }--MinimumSize :: { AbsBNF.MinimumSize }-MinimumSize : 'nonempty' { AbsBNF.MNonempty }- | {- empty -} { AbsBNF.MEmpty }--Reg :: { AbsBNF.Reg }-Reg : Reg '|' Reg1 { AbsBNF.RAlt $1 $3 } | Reg1 { $1 }--Reg1 :: { AbsBNF.Reg }-Reg1 : Reg1 '-' Reg2 { AbsBNF.RMinus $1 $3 } | Reg2 { $1 }--Reg2 :: { AbsBNF.Reg }-Reg2 : Reg2 Reg3 { AbsBNF.RSeq $1 $2 } | Reg3 { $1 }--Reg3 :: { AbsBNF.Reg }-Reg3 : Reg3 '*' { AbsBNF.RStar $1 }- | Reg3 '+' { AbsBNF.RPlus $1 }- | Reg3 '?' { AbsBNF.ROpt $1 }- | 'eps' { AbsBNF.REps }- | Char { AbsBNF.RChar $1 }- | '[' String ']' { AbsBNF.RAlts $2 }- | '{' String '}' { AbsBNF.RSeqs $2 }- | 'digit' { AbsBNF.RDigit }- | 'letter' { AbsBNF.RLetter }- | 'upper' { AbsBNF.RUpper }- | 'lower' { AbsBNF.RLower }- | 'char' { AbsBNF.RAny }- | '(' Reg ')' { $2 }-{--happyError :: [Token] -> Either String a-happyError ts = Left $- "syntax error at " ++ tokenPos ts ++- case ts of- [] -> []- [Err _] -> " due to lexer error"- t:_ -> " before `" ++ (prToken t) ++ "'"--myLexer = tokens-}-
− src/PrintBNF.hs
@@ -1,278 +0,0 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ <= 708-{-# LANGUAGE OverlappingInstances #-}-#endif-{-# LANGUAGE FlexibleInstances #-}-{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}---- | Pretty-printer for PrintBNF.--- Generated by the BNF converter.--module PrintBNF where--import qualified AbsBNF-import Data.Char---- | The top-level printing method.--printTree :: Print a => a -> String-printTree = render . prt 0--type Doc = [ShowS] -> [ShowS]--doc :: ShowS -> Doc-doc = (:)--render :: Doc -> String-render d = rend 0 (map ($ "") $ d []) "" where- rend i ss = case ss of- "[" :ts -> showChar '[' . rend i ts- "(" :ts -> showChar '(' . rend i ts- "{" :ts -> showChar '{' . new (i+1) . rend (i+1) ts- "}" : ";":ts -> new (i-1) . space "}" . showChar ';' . new (i-1) . rend (i-1) ts- "}" :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts- [";"] -> showChar ';'- ";" :ts -> showChar ';' . new i . rend i ts- t : ts@(p:_) | closingOrPunctuation p -> showString t . rend i ts- t :ts -> space t . rend i ts- _ -> id- new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace- space t s =- case (all isSpace t', null spc, null rest) of- (True , _ , True ) -> [] -- remove trailing space- (False, _ , True ) -> t' -- remove trailing space- (False, True, False) -> t' ++ ' ' : s -- add space if none- _ -> t' ++ s- where- t' = showString t []- (spc, rest) = span isSpace s-- closingOrPunctuation :: String -> Bool- closingOrPunctuation [c] = c `elem` closerOrPunct- closingOrPunctuation _ = False-- closerOrPunct :: String- closerOrPunct = ")],;"--parenth :: Doc -> Doc-parenth ss = doc (showChar '(') . ss . doc (showChar ')')--concatS :: [ShowS] -> ShowS-concatS = foldr (.) id--concatD :: [Doc] -> Doc-concatD = foldr (.) id--replicateS :: Int -> ShowS -> ShowS-replicateS n f = concatS (replicate n f)---- | The printer class does the job.--class Print a where- prt :: Int -> a -> Doc- prtList :: Int -> [a] -> Doc- prtList i = concatD . map (prt i)--instance {-# OVERLAPPABLE #-} Print a => Print [a] where- prt = prtList--instance Print Char where- prt _ s = doc (showChar '\'' . mkEsc '\'' s . showChar '\'')- prtList _ s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"')--mkEsc :: Char -> Char -> ShowS-mkEsc q s = case s of- _ | s == q -> showChar '\\' . showChar s- '\\'-> showString "\\\\"- '\n' -> showString "\\n"- '\t' -> showString "\\t"- _ -> showChar s--prPrec :: Int -> Int -> Doc -> Doc-prPrec i j = if j < i then parenth else id--instance Print Integer where- prt _ x = doc (shows x)- prtList _ [] = concatD []- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]--instance Print Double where- prt _ x = doc (shows x)--instance Print AbsBNF.Identifier where- prt _ (AbsBNF.Identifier (_,i)) = doc $ showString $ i- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]--instance Print AbsBNF.LGrammar where- prt i e = case e of- AbsBNF.LGr ldefs -> prPrec i 0 (concatD [prt 0 ldefs])--instance Print AbsBNF.LDef where- prt i e = case e of- AbsBNF.DefAll def -> prPrec i 0 (concatD [prt 0 def])- AbsBNF.DefSome identifiers def -> prPrec i 0 (concatD [prt 0 identifiers, doc (showString ":"), prt 0 def])- AbsBNF.LDefView identifiers -> prPrec i 0 (concatD [doc (showString "views"), prt 0 identifiers])- prtList _ [] = concatD []- prtList _ [x] = concatD [prt 0 x]-- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]--instance Print [AbsBNF.LDef] where- prt = prtList--instance Print [AbsBNF.Identifier] where- prt = prtList--instance Print AbsBNF.Grammar where- prt i e = case e of- AbsBNF.Grammar defs -> prPrec i 0 (concatD [prt 0 defs])--instance Print [AbsBNF.Def] where- prt = prtList--instance Print AbsBNF.Def where- prt i e = case e of- AbsBNF.Rule label cat items -> prPrec i 0 (concatD [prt 0 label, doc (showString "."), prt 0 cat, doc (showString "::="), prt 0 items])- AbsBNF.Comment str -> prPrec i 0 (concatD [doc (showString "comment"), prt 0 str])- AbsBNF.Comments str1 str2 -> prPrec i 0 (concatD [doc (showString "comment"), prt 0 str1, prt 0 str2])- AbsBNF.Internal label cat items -> prPrec i 0 (concatD [doc (showString "internal"), prt 0 label, doc (showString "."), prt 0 cat, doc (showString "::="), prt 0 items])- AbsBNF.Token identifier reg -> prPrec i 0 (concatD [doc (showString "token"), prt 0 identifier, prt 0 reg])- AbsBNF.PosToken identifier reg -> prPrec i 0 (concatD [doc (showString "position"), doc (showString "token"), prt 0 identifier, prt 0 reg])- AbsBNF.Entryp identifiers -> prPrec i 0 (concatD [doc (showString "entrypoints"), prt 0 identifiers])- AbsBNF.Separator minimumsize cat str -> prPrec i 0 (concatD [doc (showString "separator"), prt 0 minimumsize, prt 0 cat, prt 0 str])- AbsBNF.Terminator minimumsize cat str -> prPrec i 0 (concatD [doc (showString "terminator"), prt 0 minimumsize, prt 0 cat, prt 0 str])- AbsBNF.Delimiters cat str1 str2 separation minimumsize -> prPrec i 0 (concatD [doc (showString "delimiters"), prt 0 cat, prt 0 str1, prt 0 str2, prt 0 separation, prt 0 minimumsize])- AbsBNF.Coercions identifier n -> prPrec i 0 (concatD [doc (showString "coercions"), prt 0 identifier, prt 0 n])- AbsBNF.Rules identifier rhss -> prPrec i 0 (concatD [doc (showString "rules"), prt 0 identifier, doc (showString "::="), prt 0 rhss])- AbsBNF.Function identifier args exp -> prPrec i 0 (concatD [doc (showString "define"), prt 0 identifier, prt 0 args, doc (showString "="), prt 0 exp])- AbsBNF.Layout strs -> prPrec i 0 (concatD [doc (showString "layout"), prt 0 strs])- AbsBNF.LayoutStop strs -> prPrec i 0 (concatD [doc (showString "layout"), doc (showString "stop"), prt 0 strs])- AbsBNF.LayoutTop -> prPrec i 0 (concatD [doc (showString "layout"), doc (showString "toplevel")])- prtList _ [] = concatD []- prtList _ [x] = concatD [prt 0 x]-- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]--instance Print AbsBNF.Item where- prt i e = case e of- AbsBNF.Terminal str -> prPrec i 0 (concatD [prt 0 str])- AbsBNF.NTerminal cat -> prPrec i 0 (concatD [prt 0 cat])- prtList _ [] = concatD []- prtList _ (x:xs) = concatD [prt 0 x, prt 0 xs]--instance Print [AbsBNF.Item] where- prt = prtList--instance Print AbsBNF.Cat where- prt i e = case e of- AbsBNF.ListCat cat -> prPrec i 0 (concatD [doc (showString "["), prt 0 cat, doc (showString "]")])- AbsBNF.IdCat identifier -> prPrec i 0 (concatD [prt 0 identifier])--instance Print AbsBNF.Label where- prt i e = case e of- AbsBNF.LabNoP labelid -> prPrec i 0 (concatD [prt 0 labelid])- AbsBNF.LabP labelid profitems -> prPrec i 0 (concatD [prt 0 labelid, prt 0 profitems])- AbsBNF.LabPF labelid1 labelid2 profitems -> prPrec i 0 (concatD [prt 0 labelid1, prt 0 labelid2, prt 0 profitems])- AbsBNF.LabF labelid1 labelid2 -> prPrec i 0 (concatD [prt 0 labelid1, prt 0 labelid2])--instance Print AbsBNF.LabelId where- prt i e = case e of- AbsBNF.Id identifier -> prPrec i 0 (concatD [prt 0 identifier])- AbsBNF.Wild -> prPrec i 0 (concatD [doc (showString "_")])- AbsBNF.ListE -> prPrec i 0 (concatD [doc (showString "["), doc (showString "]")])- AbsBNF.ListCons -> prPrec i 0 (concatD [doc (showString "("), doc (showString ":"), doc (showString ")")])- AbsBNF.ListOne -> prPrec i 0 (concatD [doc (showString "("), doc (showString ":"), doc (showString "["), doc (showString "]"), doc (showString ")")])--instance Print AbsBNF.ProfItem where- prt i e = case e of- AbsBNF.ProfIt intlists ns -> prPrec i 0 (concatD [doc (showString "("), doc (showString "["), prt 0 intlists, doc (showString "]"), doc (showString ","), doc (showString "["), prt 0 ns, doc (showString "]"), doc (showString ")")])- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, prt 0 xs]--instance Print AbsBNF.IntList where- prt i e = case e of- AbsBNF.Ints ns -> prPrec i 0 (concatD [doc (showString "["), prt 0 ns, doc (showString "]")])- prtList _ [] = concatD []- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]--instance Print [Integer] where- prt = prtList--instance Print [AbsBNF.IntList] where- prt = prtList--instance Print [AbsBNF.ProfItem] where- prt = prtList--instance Print AbsBNF.Arg where- prt i e = case e of- AbsBNF.Arg identifier -> prPrec i 0 (concatD [prt 0 identifier])- prtList _ [] = concatD []- prtList _ (x:xs) = concatD [prt 0 x, prt 0 xs]--instance Print [AbsBNF.Arg] where- prt = prtList--instance Print AbsBNF.Separation where- prt i e = case e of- AbsBNF.SepNone -> prPrec i 0 (concatD [])- AbsBNF.SepTerm str -> prPrec i 0 (concatD [doc (showString "terminator"), prt 0 str])- AbsBNF.SepSepar str -> prPrec i 0 (concatD [doc (showString "separator"), prt 0 str])--instance Print [String] where- prt = prtList--instance Print AbsBNF.Exp where- prt i e = case e of- AbsBNF.Cons exp1 exp2 -> prPrec i 0 (concatD [prt 1 exp1, doc (showString ":"), prt 0 exp2])- AbsBNF.App identifier exps -> prPrec i 1 (concatD [prt 0 identifier, prt 2 exps])- AbsBNF.Var identifier -> prPrec i 2 (concatD [prt 0 identifier])- AbsBNF.LitInt n -> prPrec i 2 (concatD [prt 0 n])- AbsBNF.LitChar c -> prPrec i 2 (concatD [prt 0 c])- AbsBNF.LitString str -> prPrec i 2 (concatD [prt 0 str])- AbsBNF.LitDouble d -> prPrec i 2 (concatD [prt 0 d])- AbsBNF.List exps -> prPrec i 2 (concatD [doc (showString "["), prt 0 exps, doc (showString "]")])- prtList 2 [x] = concatD [prt 2 x]- prtList 2 (x:xs) = concatD [prt 2 x, prt 2 xs]- prtList _ [] = concatD []- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]--instance Print [AbsBNF.Exp] where- prt = prtList--instance Print AbsBNF.RHS where- prt i e = case e of- AbsBNF.RHS items -> prPrec i 0 (concatD [prt 0 items])- prtList _ [x] = concatD [prt 0 x]- prtList _ (x:xs) = concatD [prt 0 x, doc (showString "|"), prt 0 xs]--instance Print [AbsBNF.RHS] where- prt = prtList--instance Print AbsBNF.MinimumSize where- prt i e = case e of- AbsBNF.MNonempty -> prPrec i 0 (concatD [doc (showString "nonempty")])- AbsBNF.MEmpty -> prPrec i 0 (concatD [])--instance Print AbsBNF.Reg where- prt i e = case e of- AbsBNF.RAlt reg1 reg2 -> prPrec i 0 (concatD [prt 0 reg1, doc (showString "|"), prt 1 reg2])- AbsBNF.RMinus reg1 reg2 -> prPrec i 1 (concatD [prt 1 reg1, doc (showString "-"), prt 2 reg2])- AbsBNF.RSeq reg1 reg2 -> prPrec i 2 (concatD [prt 2 reg1, prt 3 reg2])- AbsBNF.RStar reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "*")])- AbsBNF.RPlus reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "+")])- AbsBNF.ROpt reg -> prPrec i 3 (concatD [prt 3 reg, doc (showString "?")])- AbsBNF.REps -> prPrec i 3 (concatD [doc (showString "eps")])- AbsBNF.RChar c -> prPrec i 3 (concatD [prt 0 c])- AbsBNF.RAlts str -> prPrec i 3 (concatD [doc (showString "["), prt 0 str, doc (showString "]")])- AbsBNF.RSeqs str -> prPrec i 3 (concatD [doc (showString "{"), prt 0 str, doc (showString "}")])- AbsBNF.RDigit -> prPrec i 3 (concatD [doc (showString "digit")])- AbsBNF.RLetter -> prPrec i 3 (concatD [doc (showString "letter")])- AbsBNF.RUpper -> prPrec i 3 (concatD [doc (showString "upper")])- AbsBNF.RLower -> prPrec i 3 (concatD [doc (showString "lower")])- AbsBNF.RAny -> prPrec i 3 (concatD [doc (showString "char")])-
stack-8.10.2.yaml view
@@ -1,35 +1,3 @@-resolver: ghc-8.10.2+resolver: nightly-2020-12-14 compiler: ghc-8.10.2-# compiler-check: match-exact--extra-deps:-- alex-3.2.5-- happy-1.19.12-- semigroups-0.19.1--# For --test:-- HUnit-1.6.0.0-- QuickCheck-2.13.2-- ansi-terminal-0.11-- base-compat-0.11.2-- call-stack-0.2.0-- clock-0.8-- code-page-0.2-- colour-2.3.5-- doctest-0.17-- ghc-paths-0.1.0.12-- hspec-2.7.4-- hspec-core-2.7.4-- hspec-discover-2.7.4-- hspec-expectations-0.8.2-- primitive-0.7.1.0-- quickcheck-io-0.2.0-- random-1.1-- setenv-0.1.1.3-- splitmix-0.0.5-- syb-0.7.1-- temporary-1.3-- tf-random-0.5---+compiler-check: match-exact
+ stack-8.10.3.yaml view
@@ -0,0 +1,34 @@+resolver: ghc-8.10.3+compiler: ghc-8.10.3+# compiler-check: match-exact++extra-deps:+- alex-3.2.5+- cabal-doctest-1.0.8+- happy-1.19.12+- semigroups-0.19.1+- string-qq-0.0.4++# For --test:+- HUnit-1.6.0.0+- QuickCheck-2.13.2+- ansi-terminal-0.11+- base-compat-0.11.2+- call-stack-0.2.0+- clock-0.8+- code-page-0.2+- colour-2.3.5+- doctest-0.17+- ghc-paths-0.1.0.12+- hspec-2.7.4+- hspec-core-2.7.4+- hspec-discover-2.7.4+- hspec-expectations-0.8.2+- primitive-0.7.1.0+- quickcheck-io-0.2.0+- random-1.1+- setenv-0.1.1.3+- splitmix-0.0.5+- syb-0.7.1+- temporary-1.3+- tf-random-0.5
− test/BNFC/Backend/CSharpSpec.hs
@@ -1,26 +0,0 @@-module BNFC.Backend.CSharpSpec where--import BNFC.Options-import BNFC.GetCF--import Test.Hspec-import BNFC.Hspec--import BNFC.Backend.CSharp -- SUT--calcOptions = defaultOptions { lang = "Calc" }-getCalc = parseCF calcOptions TargetCSharp $- unlines [ "EAdd. Exp ::= Exp \"+\" Exp1 ;"- , "ESub. Exp ::= Exp \"-\" Exp1 ;"- , "EMul. Exp1 ::= Exp1 \"*\" Exp2 ;"- , "EDiv. Exp1 ::= Exp1 \"/\" Exp2 ;"- , "EInt. Exp2 ::= Integer ;"- , "coercions Exp 2 ;" ]--spec =- describe "C# backend" $- it "respect the makefile option" $ do- calc <- getCalc- let opts = calcOptions { make = Just "MyMakefile" }- makeCSharp opts calc `shouldGenerate` "MyMakefile"-
test/BNFC/GetCFSpec.hs view
@@ -6,7 +6,7 @@ import BNFC.GetCF import BNFC.CF-import qualified AbsBNF as Abs+import qualified BNFC.Abs as Abs spec :: Spec spec = do@@ -28,9 +28,8 @@ describe "checkRule" $ do it "returns an error if the rule uses an unknown category" $ do- let rulep = Rule ("Foo", ("Foo", [])) (noPosition $ Cat "Bar") [Left (Cat "Baz")] Parsable- rule = npRule "Foo" (Cat "Bar") [Left (Cat "Baz")] Parsable- cf = CFG [] [] [] [] [] [rule] mempty+ let rule = npRule "Foo" (Cat "Bar") [Left (Cat "Baz")] Parsable+ cf = CFG [] mempty [] [] [] [] [rule] mempty expected = "no production for Baz, appearing in rule\n Foo. Bar ::= Baz"- checkRule cf rulep `shouldBe` Just expected+ checkRule cf rule `shouldBe` Just expected
test/doctests.hs view
@@ -1,16 +1,35 @@-import Test.DocTest+-- | @doctest@ main, from https://hackage.haskell.org/package/cabal-doctest -main = doctest- [ "-icompat"- , "-isrc"- , "-idist/build/autogen/"- , "-idist/build/bnfc/bnfc-tmp"- , "-XLambdaCase"- , "-XFlexibleContexts"- , "-XOverloadedStrings"- , "-XRecordWildCards"- , "-XScopedTypeVariables"- , "-XTupleSections"- , "src/PrintBNF.hs"- , "src/Main.hs"- ]+import Build_doctests ( flags, pkgs, module_sources )+import System.Environment ( unsetEnv )+import Test.DocTest ( doctest )++main :: IO ()+main = do+ -- optionally print arguments+ mapM_ putStrLn . concat $+ [ ["Arguments to doctest"]+ , args+ , [""]+ ]+ fixEnv+ doctest args+ where+ args = flags ++ pkgs ++ module_sources++-- | From version 2, Stack sets the GHC_ENVRIONMENT variable, and GHC+-- (as invoked by doctest) will pick that up. This is undesirable:+-- cabal-doctest passes all the necessary information on the command+-- line already, and can lead to ambiguous module errors as GHC will+-- load the environment in addition to what cabal-doctest instructs it+-- to.+--+-- Hence, cabal-doctest tells GHC to ignore package environments+-- altogether on the command line. However, this is only possible+-- since GHC 8.2. If you are using cabal-doctest with Stack 2 and+-- GHC 8.0 or earlier and seeing ambiguous module errors or other+-- mysterious failures, try manually unsetting GHC_ENVIRONMENT before+-- invoking doctest.+--+fixEnv :: IO ()+fixEnv = unsetEnv "GHC_ENVIRONMENT"