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