Created
May 5, 2018 13:59
-
-
Save yanok/816f6f904baeefe562b09813eda9c61e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System.Environment | |
import System.Exit | |
import Text.Parsec | |
main :: IO () | |
main = do | |
args <- getArgs | |
case args of | |
[fileName] -> do | |
contents <- readFile fileName | |
case parse parseGrammar fileName contents of | |
Left err -> do | |
print err | |
exitFailure | |
Right gr -> do | |
let gr' = augmentGrammar gr | |
print gr' -- this requires Show instance for grammar | |
let states = grammarToLRStates gr' | |
mapM_ print states -- this assumes states in a list and there is a Show instance for state | |
_ -> do | |
putStrLn "Usage: ..." | |
exitFailure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment