From c8ebe093150509d9f01d82f0d698ef5df09bd985 Mon Sep 17 00:00:00 2001 From: krasimir Date: Mon, 21 Mar 2016 13:27:44 +0000 Subject: initial support for BNFC syntax in context-free grammars for GF. Not all features are supported yet. Based on contribution from Gleb Lobanov --- src/compiler/GF/Compile/GetGrammar.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/compiler/GF/Compile') 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 -- cgit v1.2.3