]> Git — Sourcephile - haskell/symantic-parser.git/blob - src/Symantic/Parser.hs
machine: renames trying to clarify
[haskell/symantic-parser.git] / src / Symantic / Parser.hs
1 {-# LANGUAGE TemplateHaskell #-}
2 module Symantic.Parser
3 ( module Symantic.Parser.Grammar
4 , module Symantic.Parser.Machine
5 , module Symantic.Parser
6 ) where
7
8 import Data.Either (Either(..))
9 import Data.Function ((.))
10 import Data.Ord (Ord)
11 import Language.Haskell.TH (CodeQ)
12 import Text.Show (Show)
13 import Type.Reflection (Typeable)
14 import qualified Language.Haskell.TH.Syntax as TH
15
16 import Symantic.Parser.Grammar
17 import Symantic.Parser.Machine
18
19 runParser :: forall inp a.
20 Ord (InputToken inp) =>
21 Show (InputToken inp) =>
22 TH.Lift (InputToken inp) =>
23 Typeable (InputToken inp) =>
24 -- InputToken inp ~ Char =>
25 Input inp =>
26 InstrReadable (InputToken inp) Gen =>
27 Parser inp a ->
28 CodeQ (inp -> Either (ParsingError inp) a)
29 runParser = generateCode . machine