egison / egison-pattern-src

Manipulating Egison patterns: abstract syntax, parser, and pretty-printer
https://hackage.haskell.org/package/egison-pattern-src
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

add readme #4

Closed coord-e closed 4 years ago

coord-e commented 4 years ago

draft

Egison Pattern Source

Actions Status

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. For the uses in Haskell source code, such adaptors for haskell-src-exts and template-haskell are also available here.

Syntax

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

p ::= _                     (wildcard pattern)
    | $v                    (pattern variable)
    | #e                    (value pattern)
    | ?e                    (predicate pattern)
    | p & p                 (and pattern)
    | p | p                 (or pattern)
    | !p                    (not pattern)
    | p op p                (user-defined infix pattern)
    | x                     (constructor pattern without argument)
    | (x p_1 p_2 ... p_n)   (constructor pattern with arguments)

Development

To build and test egison-pattern-src locally, run:

$ make test    # or just `cabal new-test all`

You can use make watch to watch for file changes and re-run tests.

License

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

coord-e commented 4 years ago