An interpreted, lazy lisp.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
710 B

||| Core definitions for the rose language parser
module Rose.Parser.Core
import Text.Lexer
import Text.Parser
import Rose.Lexer
infixl 6 </>
||| Abstracts over our representation of tokens
public export
ParseToken : Type
ParseToken = (TokenData Token)
||| Produces a Grammar that consumes a ParseToken
public export
Rule : Type -> Type
Rule ty = Grammar ParseToken True ty
||| Alternative failure.
||| Helper combinator for failing with a message when the Grammar
||| `g` doesn't succeed.
(</>) : Grammar tok c a -> String -> Grammar tok (c && c) a
g </> s = g <|> fail s
Show (ParseError ParseToken) where
show (Error e (tok::rest)) =
"Parsing error: " ++ show tok ++ "\n\t" ++ e