Finish being able to parse the first example file.

This commit is contained in:
2011-02-03 20:27:05 -05:00
parent 17ca2f7899
commit a64b8aa81c
4 changed files with 65 additions and 39 deletions

View File

@@ -28,14 +28,15 @@ main = do
Right ress -> do
mapM_ putStrLn ress
putStrLn "Successful lex."
_ -> fail "Unacceptable arguments."
pullTokens :: Parser [String]
pullTokens = do
tok <- scan
case tok of
Lexeme pos tok -> do
let res = show pos ++ " " ++ show tok
if tok == TokEOF
Lexeme pos tok' -> do
let res = show pos ++ " " ++ show tok'
if tok' == TokEOF
then return [res]
else return (res :) `ap` pullTokens