diff options
| author | krasimir <krasimir@chalmers.se> | 2016-03-21 13:27:44 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2016-03-21 13:27:44 +0000 |
| commit | c8ebe093150509d9f01d82f0d698ef5df09bd985 (patch) | |
| tree | a35dfd20f40c7461a2fe8809668626c09c9a8a85 /src/compiler/GF/Compile | |
| parent | da10bb33c73e0742d6aa3aa77d71b2804b2ed673 (diff) | |
initial support for BNFC syntax in context-free grammars for GF. Not all features are supported yet. Based on contribution from Gleb Lobanov
Diffstat (limited to 'src/compiler/GF/Compile')
| -rw-r--r-- | src/compiler/GF/Compile/GetGrammar.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs index 4e2523d0b..c8a32ccc6 100644 --- a/src/compiler/GF/Compile/GetGrammar.hs +++ b/src/compiler/GF/Compile/GetGrammar.hs @@ -12,7 +12,7 @@ -- this module builds the internal GF grammar that is sent to the type checker ----------------------------------------------------------------------------- -module GF.Compile.GetGrammar (getSourceModule, getCFRules, getEBNFRules) where +module GF.Compile.GetGrammar (getSourceModule, getBNFCRules, getEBNFRules) where import Prelude hiding (catch) @@ -23,7 +23,7 @@ import GF.Infra.Option(Options,optPreprocessors,addOptions,renameEncoding,optEnc import GF.Grammar.Lexer import GF.Grammar.Parser import GF.Grammar.Grammar -import GF.Grammar.CFG +import GF.Grammar.BNFC import GF.Grammar.EBNF import GF.Compile.ReadFiles(parseSource) @@ -63,10 +63,10 @@ getSourceModule opts file0 = --liftIO $ transcodeModule' (i,mi) -- old lexer return (i,mi) -- new lexer -getCFRules :: Options -> FilePath -> IOE [CFRule] -getCFRules opts fpath = do +getBNFCRules :: Options -> FilePath -> IOE [BNFCRule] +getBNFCRules opts fpath = do raw <- liftIO (BS.readFile fpath) - (optCoding,parsed) <- parseSource opts pCFRules raw + (optCoding,parsed) <- parseSource opts pBNFCRules raw case parsed of Left (Pn l c,msg) -> do cwd <- getCurrentDirectory let location = makeRelative cwd fpath++":"++show l++":"++show c |
