futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Language.Futhark.Primitive.Parse

Contents

- Building blocks

Description

Parsers for primitive values and types.

Synopsis

- pPrimValue :: Parsec Void Text PrimValue
- pPrimType :: Parsec Void Text PrimType
- pFloatType :: Parsec Void Text FloatType
- pIntType :: Parsec Void Text IntType
- constituent :: Char -> Bool
- lexeme :: Parsec Void Text a -> Parsec Void Text a
- keyword :: Text -> Parsec Void Text ()
- whitespace :: Parsec Void Text ()

# Documentation

pPrimValue :: Parsec Void Text PrimValue Source #

Defined in this module for convenience.

pPrimType :: Parsec Void Text PrimType Source #

Parse a primitive type.

pFloatType :: Parsec Void Text FloatType Source #

Parse a floating-point type.

pIntType :: Parsec Void Text IntType Source #

Parse an integer type.

# Building blocks

constituent :: Char -> Bool Source #

Is this character a valid member of an identifier?

lexeme :: Parsec Void Text a -> Parsec Void Text a Source #

Consume whitespace after the provided parser, if it succeeds.

keyword :: Text -> Parsec Void Text () Source #

`keyword k` parses `k`, which must not be immediately followed by a `constituent` character. This ensures that `iff` is not seen as the `if` keyword followed by `f`. Sometimes called the "maximum munch" rule.

whitespace :: Parsec Void Text () Source #

Consume whitespace (including skipping line comments).