Permalink
Browse files

Rename CFG.CNFHelpers to CFG.Helpers.CNF.

  • Loading branch information...
1 parent 387be04 commit 3d8af0cc5736b8f1de9bdf87ff1ee5d5c9ea29db @23Skidoo committed Apr 9, 2013
View
@@ -1,8 +1,8 @@
module CFG.Examples (balancedParentheses, sillyGrammar, sillyGrammar2)
where
+import CFG.Helpers.CNF
import CFG.Types
-import CFG.CNFHelpers
-- | Example grammar: balanced parenthese.
balancedParentheses :: CompiledCNFGrammar
View
@@ -0,0 +1,14 @@
+-- | Helpers for working with general context-free grammars.
+module CFG.Helpers.CFG (
+ -- * Helpers for constructing the grammar.
+ ruleTerminal, ruleNonTerminal
+ )
+ where
+
+import CFG.Types
+
+ruleTerminal :: RuleName -> Char -> NamedCFGRule
+ruleTerminal name prod = CFGTerminalRule name (charToSymbol prod)
+
+ruleNonTerminal :: RuleName -> [[RuleName]] -> NamedCFGRule
+ruleNonTerminal name prods = CFGNonTerminalRule name prods
@@ -1,4 +1,5 @@
-module CFG.CNFHelpers (
+-- | Helpers for working with context-free grammars in Chomsky normal form.
+module CFG.Helpers.CNF (
-- * Helpers for constructing the grammar.
ruleTerminal, ruleNonTerminal
,compileGrammar, listToGrammar
@@ -10,12 +11,11 @@ module CFG.CNFHelpers (
)
where
-import CFG.Types
+import CFG.Types
import qualified Data.Map as M
import Data.Maybe (fromJust)
--- Helpers for constructing the grammar.
ruleTerminal :: RuleName -> Char -> NamedCNFRule
ruleTerminal name prod = CNFTerminalRule name (charToSymbol prod)
View
@@ -7,8 +7,8 @@ import Data.Array.IArray
import Data.Array.MArray
import Data.Array.ST
+import CFG.Helpers.CNF
import CFG.Types
-import CFG.CNFHelpers
-- The CYK algorithm.
cykAlgorithm :: CompiledCNFGrammar -> String -> Bool
View
@@ -1,8 +1,8 @@
module CFG.Read (readCFGrammar, readCNFGrammar)
where
+import CFG.Helpers.CNF
import CFG.Types
-import CFG.CNFHelpers
import Control.Applicative hiding (many, (<|>))
import Control.Monad (unless)
View
@@ -16,11 +16,12 @@ cabal-version: >=1.8
library
exposed-modules: CFG.Types,
+ CFG.Helpers.CNF,
+ CFG.Helpers.CFG,
CFG.Read,
CFG.Parse,
CFG.Decide
CFG.CNF,
- CFG.CNFHelpers,
CFG.Examples
-- other-modules:
build-depends: base < 5,
@@ -3,8 +3,8 @@ module Main
import System.Environment (getArgs)
-import CFG.CNFHelpers (compileGrammar)
import CFG.Examples
+import CFG.Helpers.CNF (compileGrammar)
import CFG.Parse
import CFG.Read
View
@@ -8,8 +8,8 @@ import Test.Framework.Providers.QuickCheck2 as TF
import Test.HUnit
import Test.QuickCheck
-import CFG.CNFHelpers (compileGrammar)
import CFG.Examples
+import CFG.Helpers.CNF (compileGrammar)
import CFG.Parse
import CFG.Read

0 comments on commit 3d8af0c

Please sign in to comment.