Make minor improvements to parser
parent
ff7fe0a1d3
commit
a58bb2bab0
|
@ -2,6 +2,7 @@ module Main (main) where
|
||||||
|
|
||||||
import Control.Monad.Combinators.Expr
|
import Control.Monad.Combinators.Expr
|
||||||
import Data.Void (Void)
|
import Data.Void (Void)
|
||||||
|
import System.Environment
|
||||||
import Text.Megaparsec
|
import Text.Megaparsec
|
||||||
import Text.Megaparsec.Char as C
|
import Text.Megaparsec.Char as C
|
||||||
import Text.Megaparsec.Char.Lexer as L
|
import Text.Megaparsec.Char.Lexer as L
|
||||||
|
@ -46,6 +47,7 @@ expr = makeExprParser term table
|
||||||
parseExpr :: String -> Either (ParseErrorBundle String Void) Expr
|
parseExpr :: String -> Either (ParseErrorBundle String Void) Expr
|
||||||
parseExpr = parse (C.space *> expr <* eof) ""
|
parseExpr = parse (C.space *> expr <* eof) ""
|
||||||
|
|
||||||
main :: IO ()
|
-- main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
print $ parseExpr "2+3* 4"
|
input <- fmap head getArgs
|
||||||
|
parseTest expr input
|
Reference in New Issue