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

Swarm.Language.Parser.Term

Description

Parser for terms of the Swarm language.

Synopsis

Documentation

>>> import qualified Data.Map.Strict as M

parseConst :: Parser Const Source #

Parse Const as reserved words (e.g. Fail <$ reserved "fail")

parseTermAtom :: Parser Syntax Source #

Parse an atomic term, optionally trailed by record projections like t.x.y.z. Record projection binds more tightly than function application.

parseTermAtom2 :: Parser Syntax Source #

Parse an atomic term.

sLet :: LetSyntax -> LocVar -> Maybe Polytype -> Syntax -> Syntax -> Term Source #

Construct an SLet, automatically filling in the Boolean field indicating whether it is recursive.

bindTydef :: [Var] -> Type -> Parser Polytype Source #

Create a polytype from a list of variable binders and a type. Ensure that no binder is repeated, and all type variables in the type are present in the list of binders (i.e. the type contains no free type variables).

parseTerm :: Parser Syntax Source #

Parse a Swarm language term.

data Stmt Source #

Instances

Instances details
Show Stmt Source # 
Instance details

Defined in Swarm.Language.Parser.Term

Methods

showsPrec :: Int -> Stmt -> ShowS #

show :: Stmt -> String #

showList :: [Stmt] -> ShowS #

binOps :: Map Int [Operator Parser Syntax] Source #

Precedences and parsers of binary operators.

>>> M.map length binOps
fromList [(0,1),(2,1),(3,1),(4,6),(6,3),(7,2),(8,1)]

unOps :: Map Int [Operator Parser Syntax] Source #

Precedences and parsers of unary operators (currently only Neg).

>>> M.map length unOps
fromList [(7,1)]