tidy up
This commit is contained in:
parent
6f4a835e54
commit
ef7dc3603d
5 changed files with 50 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
module Lox.Parser (
|
||||
SyntaxError (..),
|
||||
parse
|
||||
parse,
|
||||
parseExpression
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
|
|
@ -55,6 +56,9 @@ data SyntaxError = SyntaxError String deriving Show
|
|||
parse :: [Token] -> Either SyntaxError [Stmt]
|
||||
parse tokens = evalState program (ParserState {tokens=tokens})
|
||||
|
||||
parseExpression :: [Token] -> Either SyntaxError Expr
|
||||
parseExpression tokens = evalState expression (ParserState {tokens=tokens})
|
||||
|
||||
program :: State ParserState (Either SyntaxError [Stmt])
|
||||
program = do
|
||||
atEnd <- isAtEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue