blob: ab5dcb393bd9f181f537f5250072e79d21aff353 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module GF.Compile.Export where
import PGF.Data (PGF)
import PGF.Raw.Print (printTree)
import PGF.Raw.Convert (fromPGF)
import GF.Compile.GFCCtoHaskell
import GF.Compile.GFCCtoJS
import GF.Infra.Option
import GF.Text.UTF8
-- top-level access to code generation
prPGF :: OutputFormat -> PGF -> String
prPGF fmt gr = case fmt of
FmtPGF -> printPGF gr
FmtJavaScript -> pgf2js gr
FmtHaskell -> grammar2haskell gr
FmtHaskellGADT -> grammar2haskellGADT gr
printPGF :: PGF -> String
printPGF = encodeUTF8 . printTree . fromPGF
|