]> Git — Sourcephile - haskell/symantic-parser.git/blob - src/Symantic/Parser/Machine.hs
set cabal category to Parsing (like megaparsec)
[haskell/symantic-parser.git] / src / Symantic / Parser / Machine.hs
1 module Symantic.Parser.Machine
2 ( module Symantic.Parser.Machine
3 , module Symantic.Parser.Machine.Instructions
4 , module Symantic.Parser.Machine.Dump
5 , module Symantic.Parser.Machine.Generate
6 , module Symantic.Parser.Machine.Input
7 ) where
8 import Data.Function ((.))
9 import Data.Ord (Ord)
10 import Symantic.Parser.Machine.Input
11 import Symantic.Parser.Grammar
12 import Text.Show (Show)
13 import qualified Language.Haskell.TH.Syntax as TH
14
15 import Symantic.Parser.Machine.Instructions
16 import Symantic.Parser.Machine.Dump
17 import Symantic.Parser.Machine.Generate
18
19 -- * Type 'Parser'
20 type Parser inp =
21 ObserveSharing TH.Name
22 (OptimizeComb TH.Name
23 (Machine inp))
24
25 machine :: forall inp repr a.
26 Ord (InputToken inp) =>
27 Show (InputToken inp) =>
28 TH.Lift (InputToken inp) =>
29 -- InputToken inp ~ Char =>
30 Executable repr =>
31 Readable repr (InputToken inp) =>
32 Grammar (Machine inp) =>
33 Parser inp a ->
34 repr inp '[] ('Succ 'Zero) a
35 machine = runMachine . optimizeComb . observeSharing