1 {-# LANGUAGE TemplateHaskell #-}
3 ( module Symantic.Parser.Grammar
4 , module Symantic.Parser.Machine
5 , module Symantic.Parser
8 import Data.Either (Either(..))
10 import Language.Haskell.TH (CodeQ)
11 import Text.Show (Show)
12 import qualified Language.Haskell.TH.Syntax as TH
14 import Symantic.Parser.Grammar
15 import Symantic.Parser.Machine
17 runParser :: forall inp a.
18 Ord (InputToken inp) =>
19 Show (InputToken inp) =>
20 TH.Lift (InputToken inp) =>
21 -- InputToken inp ~ Char =>
23 Readable Gen (InputToken inp) =>
25 CodeQ (inp -> Either (ParsingError inp) a)
26 runParser p = [|| \input -> $$(generate [||input||] (machine p)) ||]