]> Git — Sourcephile - haskell/symantic-parser.git/blob - src/Symantic/Parser.hs
add join-points
[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.Ord (Ord)
10 import Language.Haskell.TH (CodeQ)
11 import Text.Show (Show)
12 import qualified Language.Haskell.TH.Syntax as TH
13
14 import Symantic.Parser.Grammar
15 import Symantic.Parser.Machine
16
17 runParser :: forall inp a.
18 Ord (InputToken inp) =>
19 Show (InputToken inp) =>
20 TH.Lift (InputToken inp) =>
21 -- InputToken inp ~ Char =>
22 Input inp =>
23 Readable Gen (InputToken inp) =>
24 Parser inp a ->
25 CodeQ (inp -> Either (ParsingError inp) a)
26 runParser p = [|| \input -> $$(generate [||input||] (machine p)) ||]