]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Machine.hs
fix: use a global polyfix for defLet and defRef
[haskell/symantic-parser.git] / test / Machine.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# LANGUAGE ExistentialQuantification #-}
3 {-# LANGUAGE FlexibleContexts #-}
4 {-# LANGUAGE RankNTypes #-}
5 {-# LANGUAGE TypeApplications #-}
6 {-# LANGUAGE TypeFamilies #-}
7 module Machine where
8
9 -- import Data.Char (Char)
10 import Data.Text (Text)
11 import Data.Functor ((<$>))
12 import System.IO (IO)
13
14 import qualified Symantic.Parser as P
15 import Grammar
16
17 -- | Existential type to gather machines
18 -- returning different values in the same @('machines')@ list.
19 data M = forall a. M (
20 forall repr inp. inp ~ Text =>
21 P.Machine (P.InputToken inp) repr =>
22 IO (repr inp '[] a)
23 )
24
25 machines :: [M]
26 machines = (\(G g) -> M (P.optimizeMachine g)) <$> grammars
27 {-
28 e1 = P.fixByName (P.analysisByLet (P.machine @[Char] g1))
29 h1 = P.runAnalysis (P.machine @[Char] g1)
30 e13 = P.fixByName (P.analysisByLet (P.machine @[Char] g13))
31 h2 = P.runAnalysis (P.machine @[Char] g2)
32 h3 = P.runAnalysis (P.machine @[Char] g3)
33 h4 = P.runAnalysis (P.machine @[Char] g4)
34 h13 = P.runAnalysis (P.machine @[Char] g13)
35 h14 = P.runGenAnalysis (P.genAnalysisByLet (P.machine @[Char] g14))
36 -}