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 Type.Reflection (Typeable)
13 import qualified Language.Haskell.TH.Syntax as TH
15 import Symantic.Parser.Grammar
16 import Symantic.Parser.Machine
18 runParser :: forall inp a.
19 Ord (InputToken inp) =>
20 Show (InputToken inp) =>
21 TH.Lift (InputToken inp) =>
22 Typeable (InputToken inp) =>
23 -- InputToken inp ~ Char =>
25 Readable (InputToken inp) Gen =>
27 CodeQ (inp -> Either (ParsingError inp) a)
28 runParser p = [|| \input -> $$(generateCode [||input||] (machine p)) ||]