curry.utility.readcurry.parse_ module

class curry.utility.readcurry.parse_.Parser(text)[source]

Bases: object

Parses the tokens on a stack of frames of its own, so a nesting of any depth needs no recursion (issue #125: a literal list of 1200 elements failed at import). A comma ends an expression, and the closing delimiter ends the frame, whose value becomes a term of the frame below.

parse()[source]
curry.utility.readcurry.parse_.parse(curry_text, **kwds)[source]

Parse the output of a Curry system.

This is a parser for Curry values, not source code. It reads tuples, lists, numbers, strings, character constants, free variables, constructor symbols, and function symbols. As such, is is suitable for reading certain Curry-like data formats, such as FlatCurry and ICurry. It is also useful in testing, as it provides a way to load the results (i.e., values) of Curry programs. This way, one can compare the output of different Curry systems.

It is assumed that functions begin with lowercase letters, data constructors begin with uppercase letters, and free variables are represented as an underscore followed by one or more lowercase letters, followed by zero or more digits.