futhark-0.21.1: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Futhark.Parser

Description

Interface to the Futhark parser.

Synopsis

Documentation

parseFuthark :: FilePath -> Text -> Either ParseError UncheckedProg Source #

Parse an entire Futhark program from the given Text, using the FilePath as the source name for error messages.

parseExp :: FilePath -> Text -> Either ParseError UncheckedExp Source #

Parse an Futhark expression from the given String, using the FilePath as the source name for error messages.

parseModExp :: FilePath -> Text -> Either ParseError (ModExpBase NoInfo Name) Source #

Parse a Futhark module expression from the given String, using the FilePath as the source name for error messages.

parseType :: FilePath -> Text -> Either ParseError UncheckedTypeExp Source #

Parse an Futhark type from the given String, using the FilePath as the source name for error messages.

parseValue :: FilePath -> Text -> Either ParseError Value Source #

Parse any Futhark value from the given String, using the FilePath as the source name for error messages.

parseValues :: FilePath -> Text -> Either ParseError [Value] Source #

Parse several Futhark values (separated by anything) from the given String, using the FilePath as the source name for error messages.

parseDecOrExpIncrM :: Monad m => m Text -> FilePath -> Text -> m (Either ParseError (Either UncheckedDec UncheckedExp)) Source #

Parse either an expression or a declaration incrementally; favouring declarations in case of ambiguity.

data ParseError Source #

A parse error. Use show to get a human-readable description.

Constructors

ParseError String 

Instances

Instances details
Show ParseError Source # 
Instance details

Defined in Language.Futhark.Parser.Parser

scanTokensText :: Pos -> Text -> Either String ([L Token], Pos) Source #

Given a starting position, produce tokens from the given text (or a lexer error). Returns the final position.

data L a Source #

A value tagged with a source location.

Constructors

L SrcLoc a 

Instances

Instances details
Eq a => Eq (L a) Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

(==) :: L a -> L a -> Bool #

(/=) :: L a -> L a -> Bool #

Show a => Show (L a) Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

showsPrec :: Int -> L a -> ShowS #

show :: L a -> String #

showList :: [L a] -> ShowS #

Located (L a) Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

locOf :: L a -> Loc #

locOfList :: [L a] -> Loc #

data Token Source #

A lexical token. It does not itself contain position information, so in practice the parser will consume tokens tagged with a source position.

Instances

Instances details
Eq Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

Ord Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

compare :: Token -> Token -> Ordering #

(<) :: Token -> Token -> Bool #

(<=) :: Token -> Token -> Bool #

(>) :: Token -> Token -> Bool #

(>=) :: Token -> Token -> Bool #

max :: Token -> Token -> Token #

min :: Token -> Token -> Token #

Show Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #