syntax/syntax.cabal
2014-12-13 00:27:06 +01:00

53 lines
2.7 KiB
Plaintext

name: syntax
version: 1.0.0.0
synopsis: Reversible parsing and pretty-printing.
description:
"syntax" allows you to write a single syntax description and instantiate is both as a parser and a pretty printer.
.
Syntax descriptions are written in applicative or arrow style. The library uses a custom typeclass hierarchy, provided
by the "semi-iso" package. Most of the time you will be using operators like '/$/', '/*/' and '/+/' (= '<|>'), just
like parser combinators. When more power is needed - e.g. when the syntax depends on the parsed or printed value -
you turn to arrows.
.
Semi-isomorphisms from "semi-iso" are the basic building block of syntax descriptions. I recommend reading
the hackage page of "semi-iso" first, as it contains much more information.
.
Once you write a syntax description (polymorphic in the syntax category) you can instantiate it both as a parser or as
a pretty-printer. The library "syntax-attoparsec" gives you the ability to extract an Attoparsec parser. Pretty-printing
is implemented by the "syntax-printer" library, which uses Text and ByteString builders. (Note that formatting is handled
by "syntax" itself, not by the printer library)
.
Advanced formatting and parsing (for example indentation, haskell layout rule) is implemented as category transformers
(similar to monad transformers). Currently only simple indentation is implemented (in "Data.Syntax.Indent") - basically
a reader category transformer that tracks current indentation level. I plan on implementing Haskell layout rule in the
future.
.
The library can work with both text and binary data. Alas, there are no binary combinators implemented yet.
I will implement them when i have the time (but these category transformers look so much more interesting for now ;).
.
EXAMPLES! See @syntax-example@ and @syntax-example-json@ for examples.
.
* "syntax-example" implements a simple lambda calculus.
.
* "syntax-example-json" implements a json parser and pretty printer.
license: MIT
license-file: LICENSE
author: Paweł Nowak
maintainer: Paweł Nowak <pawel834@gmail.com>
copyright: Paweł Nowak 2014
category: Data
build-type: Simple
cabal-version: >=1.10
source-repository head
type: git
location: git@github.com:Pawel834/syntax.git
library
exposed-modules: Data.Syntax
Data.Syntax.Char
Data.Syntax.Combinator
Data.Syntax.Indent
build-depends: base >= 4 && < 5, mono-traversable, lens >= 4, semi-iso >= 1, scientific >= 0.3, text, vector
default-language: Haskell2010