forked from GitHub/gf-core
"Committed_by_peb"
This commit is contained in:
@@ -9,16 +9,14 @@
|
||||
-- > CVS $Author $
|
||||
-- > CVS $Revision $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-- translate OCL, etc, files in batch mode
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module BatchTranslate where
|
||||
module BatchTranslate (translate) where
|
||||
|
||||
import API
|
||||
import GetMyTree (file2tree)
|
||||
|
||||
-- translate OCL, etc, files in batch mode
|
||||
|
||||
translate :: FilePath -> FilePath -> IO ()
|
||||
translate fgr txt = do
|
||||
gr <- file2grammar fgr
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
-- > CVS $Author $
|
||||
-- > CVS $Revision $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-- to write a GF abstract grammar into a Haskell module with translations from
|
||||
-- data objects into GF trees. Example: GSyntax for Agda.
|
||||
-- AR 11/11/1999 -- 7/12/2000 -- 18/5/2004
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GrammarToHaskell (grammar2haskell) where
|
||||
@@ -20,17 +22,13 @@ import Macros
|
||||
import Modules
|
||||
import Operations
|
||||
|
||||
-- to write a GF abstract grammar into a Haskell module with translations from
|
||||
-- data objects into GF trees. Example: GSyntax for Agda.
|
||||
-- AR 11/11/1999 -- 7/12/2000 -- 18/5/2004
|
||||
|
||||
-- the main function
|
||||
-- | the main function
|
||||
grammar2haskell :: GFC.CanonGrammar -> String
|
||||
grammar2haskell gr = foldr (++++) [] $
|
||||
haskPreamble ++ [datatypes gr', gfinstances gr', fginstances gr']
|
||||
where gr' = hSkeleton gr
|
||||
|
||||
-- by this you can prefix all identifiers with stg; the default is 'G'
|
||||
-- | by this you can prefix all identifiers with stg; the default is 'G'
|
||||
gId :: OIdent -> OIdent
|
||||
gId i = 'G':i
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-- > CVS $Author $
|
||||
-- > CVS $Revision $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-- for reading grammars and terms from strings and files
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module IOGrammar where
|
||||
@@ -30,9 +30,7 @@ import Arch
|
||||
|
||||
import Monad (liftM)
|
||||
|
||||
-- for reading grammars and terms from strings and files
|
||||
|
||||
--- a heuristic way of renaming constants is used
|
||||
-- | a heuristic way of renaming constants is used
|
||||
string2absTerm :: String -> String -> Term
|
||||
string2absTerm m = renameTermIn m . pTrm
|
||||
|
||||
|
||||
@@ -9,18 +9,16 @@
|
||||
-- > CVS $Author $
|
||||
-- > CVS $Revision $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-- template to define your own parser
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module MyParser where
|
||||
module MyParser (myParser) where
|
||||
|
||||
import ShellState
|
||||
import CFIdent
|
||||
import CF
|
||||
import Operations
|
||||
|
||||
-- template to define your own parser
|
||||
|
||||
-- type CFParser = [CFTok] -> ([(CFTree,[CFTok])],String)
|
||||
|
||||
myParser :: StateGrammar -> CFCat -> CFParser
|
||||
|
||||
Reference in New Issue
Block a user