diff --git a/src/Lox/Expr.hs b/src/Lox/Expr.hs index ea0d3d8..7a6c174 100644 --- a/src/Lox/Expr.hs +++ b/src/Lox/Expr.hs @@ -9,4 +9,4 @@ data Expr = Unary Token Expr | Binary Expr Token Expr | Grouping Expr - + deriving Show diff --git a/src/Lox/Parser.hs b/src/Lox/Parser.hs index 4f1269d..238a3ee 100644 --- a/src/Lox/Parser.hs +++ b/src/Lox/Parser.hs @@ -1,5 +1,5 @@ module Lox.Parser ( - expression + parse ) where import Control.Monad diff --git a/src/Lox/Scanner.hs b/src/Lox/Scanner.hs index 58579a1..cd4e7df 100644 --- a/src/Lox/Scanner.hs +++ b/src/Lox/Scanner.hs @@ -43,7 +43,7 @@ scanTokensFromSource source = evalState scanTokens (emptyScannerState source) scanTokens :: State ScannerState [Token] scanTokens = do atEnd <- isAtEnd - if atEnd then return [] else do + if atEnd then return <$> addToken EOF else do maybeToken <- scanToken case maybeToken of Nothing -> scanTokens