curry.backends.py.currylib.prelude.read module

Functions for parsing literals.

curry.backends.py.currylib.prelude.read.readCharLiteral(rts, s)[source]

Parse a character literal from a Curry string.

The literal begins and ends with a single quote. The body contains a character other than a backslash or single quote, or a backslash followed by one of the following:

  • Any character in “bfnrtv”.

  • A single quote.

  • A backslash.

  • A natural number less than 1114112.

  • A hexadecimal integer less than 0x110000.

Yields:

A list whose head is a pair of the parsed character and remaining string and whose tail is this function applied to the tail.

curry.backends.py.currylib.prelude.read.readFloatLiteral(rts, s)[source]

Parse a floating-point number from a Curry string. Returns a pair consisting of the value and the remaining string.

curry.backends.py.currylib.prelude.read.readNatLiteral(rts, s)[source]

Parse a natural number from a Curry string. Returns a pair consisting of the value and the remaining string.

curry.backends.py.currylib.prelude.read.readStringLiteral(rts, s)[source]

Parse a string literal from a Curry string.

The literal begins and ends with a double quote. The body contains a string of characters and uses the same escape codes as for character literals.

Yields:

A list whose head is a pair of the parsed string and remaining string and whose tail is this function applied to the tail.