egison-pattern-src

Manipulating Egison patterns: abstract syntax, parser, and pretty-printer https://github.com/egison/egison-pattern-src#readme

Version on this page:0.2.1.0
LTS Haskell 16.19:0.2.1.0
Stackage Nightly 2020-10-20:0.2.1.0
Latest on Hackage:0.2.1.1

See all snapshots egison-pattern-src appears in

BSD-3-Clause licensed by coord_e
Maintained by coord_e, Satoshi Egi

Module documentation for 0.2.1.0

This version can be pinned in stack with:egison-pattern-src-0.2.1.0@sha256:8f4e72f25abb4f6cf8f1283774ae0d5030c44dad32838de2423c8f9644529c78,4197

Egison Pattern Source

Actions Status Actions Status Hackage Hackage Deps

The egison-pattern-src provides a standalone syntax definition for patterns in Egison programming language. This package enables you to embed Egison’s patterns in your parser (pretty-printer) by supplying expression and name parsers (printers) externally.

Syntax

The following is a simplified syntax of pattern expressions where x, v, op and e are respectively names, variable names, user-defined infix operators and expressions in host language.

p ::= _                     (wildcard pattern)
    | $v                    (pattern variable)
    | #e                    (value pattern)
    | ?e                    (predicate pattern)
    | (p_1, p_2, ..., p_n)  (tuple pattern)
    | [p_1, p_2, ..., p_n]  (collection pattern)
    | p & p                 (and pattern)
    | p | p                 (or pattern)
    | !p                    (not pattern)
    | p op p                (user-defined infix pattern)
    | x p_1 p_2 ... p_n     (constructor pattern)

License

egison-pattern-src is distributed as open source software under the terms of the 3 clause BSD License. See LICENSE for details.

Changes

0.2.1.0

  • Fix use of external parsers to delimit input with ,, ), or ]
  • Enable to parse value expression in the form of #[1, 2, 3] without parentheses

0.2.0.0

Breaking changes:

  • Add a tuple pattern #12
  • Add a collection pattern #17
  • UnexpectedEndOfFile error variant is added for greedy parsers (change in #19)
  • The name of parsing file is passed in ParseMode, not in the argument of parseExpr (change in #19)
  • Fix syntax of constructor patterns #18
    • We do not require constructor patterns to be parenthaized

Non-breacking changes:

  • Add non-greedy parsers #19
    • Variants of parsers are provided via Parsable class
  • not patterns are now parsed as atom patterns (change in #18)
  • Source type constraint is now just a type class providing few additional methods to Stream (change in #19)

0.1.1.0

Nothing changed (updated as other two adaptor packages)

0.1.0.0

  • Initial Release