build: move all Nix config to `flake.nix`
[haskell/symantic-parser.git] / parsers / Parsers / Brainfuck / SymanticParser / Grammar.hs
index a90497f9a7e1844a20e82afbb013ef8e89600a82..87e1782f3b538e2c5171d720bbbd275b327b2d3b 100644 (file)
@@ -7,10 +7,8 @@ module Parsers.Brainfuck.SymanticParser.Grammar where
 
 import Data.Char (Char)
 import Data.Function ((.))
-import qualified Language.Haskell.TH.Syntax as TH
 import qualified Prelude
 
-import Symantic.Univariant.Trans
 import qualified Symantic.Parser as SP
 
 import Parsers.Utils
@@ -31,8 +29,8 @@ grammar = whitespace SP.*> bf
   lexeme p = p SP.<* whitespace
   bf :: repr [Instruction]
   bf = SP.many (lexeme (SP.match (SP.look (SP.item @tok))
-                               (SP.prod . coerceEnum Prelude.<$> "<>+-,.[")
-                               op SP.empty))
+                                 (SP.prod . coerceEnum Prelude.<$> "<>+-,.[")
+                                 op SP.empty))
   op :: SP.Production tok -> repr Instruction
   op prod = case coerceEnum (SP.runValue prod) of
     '<' -> SP.item @tok SP.$> SP.prod Backward
@@ -43,12 +41,5 @@ grammar = whitespace SP.*> bf
     '.' -> SP.item @tok SP.$> SP.prod Output
     '[' -> SP.between (lexeme (SP.item @tok))
                       (SP.token (coerceEnum @_ @tok ']'))
-                      (SP.production Loop [||Loop||] SP.<$> bf)
+                      ($(SP.prodCon 'Loop) SP.<$> bf)
     _ -> Prelude.undefined
-
-reproGrammar :: forall tok repr.
-  CoerceEnum Char tok =>
-  CoerceEnum tok Char =>
-  SP.Grammarable tok repr =>
-  repr [tok]
-reproGrammar = SP.many (SP.item @tok)