https://github.com/egison/egison-pattern-src
Manipulating Egison patterns: abstract syntax, parser, and pretty-printer
https://github.com/egison/egison-pattern-src
egison parser pattern pretty-printer programming-language syntax-tree
Last synced: 9 months ago
JSON representation
Manipulating Egison patterns: abstract syntax, parser, and pretty-printer
- Host: GitHub
- URL: https://github.com/egison/egison-pattern-src
- Owner: egison
- License: bsd-3-clause
- Created: 2020-02-12T10:28:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-03T05:44:55.000Z (about 5 years ago)
- Last Synced: 2025-04-18T22:20:25.426Z (9 months ago)
- Topics: egison, parser, pattern, pretty-printer, programming-language, syntax-tree
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/egison-pattern-src
- Size: 221 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Egison Pattern Source
[](https://github.com/egison/egison-pattern-src/actions?workflow=latest)
[](https://github.com/egison/egison-pattern-src/actions?workflow=release)
[](https://hackage.haskell.org/package/egison-pattern-src)
[](http://packdeps.haskellers.com/reverse/egison-pattern-src)
The [egison-pattern-src](https://hackage.haskell.org/package/egison-pattern-src) provides a standalone syntax definition for patterns in [the Egison programming language](https://www.egison.org/).
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](https://hackage.haskell.org/package/haskell-src-exts) and [template-haskell](https://hackage.haskell.org/package/template-haskell) are also available as [egison-pattern-src-haskell-mode](https://hackage.haskell.org/package/egison-pattern-src-haskell-mode) and [egison-pattern-src-th-mode](https://hackage.haskell.org/package/egison-pattern-src-th-mode), respectively.
## Syntax
The following is a simplified syntax of pattern expressions where `v`, `c`, `op` and `e` are meta-variables for variable names, constructor names, user-defined infix operators, and expressions in host language, respectively.
```
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)
| c p_1 p_2 ... p_n (constructor pattern)
```
## 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](https://hackage.haskell.org/package/egison-pattern-src) is distributed as open source software under the terms of the 3 clause BSD License. See [LICENSE](/LICENSE) for details.