]> Git — Sourcephile - haskell/symantic-parser.git/blob - src/Symantic/Parser/Machine.hs
iface: remove `satisfyOrFail`
[haskell/symantic-parser.git] / src / Symantic / Parser / Machine.hs
1 module Symantic.Parser.Machine
2 ( module Symantic.Parser.Machine
3 , module Symantic.Parser.Machine.Generate
4 , module Symantic.Parser.Machine.Input
5 , module Symantic.Parser.Machine.Instructions
6 , module Symantic.Parser.Machine.Optimize
7 , module Symantic.Parser.Machine.Program
8 , module Symantic.Parser.Machine.View
9 ) where
10
11 import System.IO (IO)
12 import Data.Function ((.))
13
14 import Symantic.Parser.Grammar
15 import Symantic.Parser.Machine.Generate
16 import Symantic.Parser.Machine.Input
17 import Symantic.Parser.Machine.Instructions
18 import Symantic.Parser.Machine.Optimize
19 import Symantic.Parser.Machine.Program
20 import Symantic.Parser.Machine.View
21
22 -- * Type 'Machine'
23 type Machine repr inp = Grammar (Program repr inp)
24
25 -- | Build a 'Machine' able to 'generateCode' for the given 'Parser'.
26 machine :: forall inp repr a.
27 Grammarable (InputToken inp) (Program repr inp) =>
28 Machinable (InputToken inp) repr =>
29 Machine repr inp a ->
30 IO (repr inp '[] a)
31 machine = optimizeMachine . grammar @(InputToken inp)