1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE NoMonomorphismRestriction #-}
3 {-# LANGUAGE TypeApplications #-}
4 {-# LANGUAGE TypeFamilies #-}
5 {-# LANGUAGE TemplateHaskell #-}
6 {-# OPTIONS_GHC -Wno-missing-signatures #-}
8 import Data.Char (Char)
9 import Data.String (String)
10 import Text.Show (Show(..))
11 import qualified Data.Functor as Functor
12 import qualified Parsers.Nandlang
13 import qualified Parsers.Brainfuck.SymanticParser.Grammar
15 import Symantic.Parser
17 rawGrammars :: Grammarable Char repr => [repr String]
19 [ production show [||show||] <$> g1
20 , production show [||show||] <$> g2
21 , production show [||show||] <$> g3
22 , production show [||show||] <$> g4
23 , production show [||show||] <$> g5
24 , production show [||show||] <$> g6
25 , production show [||show||] <$> g7
26 , production show [||show||] <$> g8
27 , production show [||show||] <$> g9
28 , production show [||show||] <$> g10
29 , production show [||show||] <$> g11
30 , production show [||show||] <$> g12
31 , production show [||show||] <$> g13
32 , production show [||show||] <$> g14
33 , production show [||show||] <$> g15
34 , production show [||show||] <$> g16
36 grammars :: Grammarable Char repr => [repr String]
37 grammars = observeSharing Functor.<$> rawGrammars
42 g4 = some (string "abcd")
43 g5 = some (string "abcd") <* eof
44 g6 = traverse char "aa" <|> traverse char "ab"
45 g7 = string "aa" <|> string "ab"
46 g8 = many (char 'r') <* eof
48 g10 = char 'a' <|> char 'b'
49 g11 = many (char 'a') <* char 'b'
50 g12 = many (oneOf ['a', 'b', 'c', 'd']) <* eof
51 g13 = Parsers.Brainfuck.SymanticParser.Grammar.grammar @Char @_
52 g14 = Parsers.Nandlang.grammar
53 g15 = (char 'a' <|> char 'b') <* char 'c'
54 g16 = (char 'a' <|> char 'b' <|> char 'c') <* char 'd'