swarm-0.6.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Language.Parser

Description

Parser for the Swarm language. Note, you probably don't want to use this directly, unless there is a good reason to parse a term without also type checking it; use processTerm instead, which parses, typechecks, elaborates, and capability checks a term all at once.

Synopsis

Documentation

readTerm :: Text -> Either Text (Maybe Syntax) Source #

Parse some input Text completely as a Term, consuming leading whitespace and ensuring the parsing extends all the way to the end of the input Text. Returns either the resulting Term (or Nothing if the input was only whitespace) or a pretty-printed parse error message.

readTerm' :: ParserConfig -> Text -> Either ParserError (Maybe Syntax) Source #

A lower-level readTerm which allow configuring the parser and returns the megaparsec bundle error for precise error reporting.