diff options
Diffstat (limited to 'src-3.0/GF/Compile/Export.hs')
| -rw-r--r-- | src-3.0/GF/Compile/Export.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src-3.0/GF/Compile/Export.hs b/src-3.0/GF/Compile/Export.hs new file mode 100644 index 000000000..2b36b10a9 --- /dev/null +++ b/src-3.0/GF/Compile/Export.hs @@ -0,0 +1,22 @@ +module GF.Compile.Export where + +import PGF.Data (GFCC) +import PGF.Raw.Print (printTree) +import PGF.Raw.Convert (fromGFCC) +import GF.Compile.GFCCtoHaskell +import GF.Compile.GFCCtoJS +import GF.Infra.Option +import GF.Text.UTF8 + +-- top-level access to code generation + +prGFCC :: OutputFormat -> GFCC -> String +prGFCC fmt gr = case fmt of + FmtGFCC -> printGFCC gr + FmtJavaScript -> gfcc2js gr + FmtHaskell -> grammar2haskell gr + FmtHaskellGADT -> grammar2haskellGADT gr + +printGFCC :: GFCC -> String +printGFCC = encodeUTF8 . printTree . fromGFCC + |
