language-pig: Pig parser in haskell.

[ language, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

Parser and pretty printer for the Apache Pig scripting language (http:/pig.apache.org). The current version is implemented using Parsec parser combinators.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.3.0.1
Dependencies base (>=4.6 && <4.7), Cabal (>=1.16.0), containers, parsec (>=3.1.3), pretty-tree [details]
License MIT
Author Elise Huard
Maintainer elise@jabberwocky.eu
Category Language
Source repo head: git clone https://github.com/elisehuard/language-pig
Uploaded by elisehuard at 2013-12-16T13:38:36Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4365 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]

Readme for language-pig-0.3.0.1

[back to package description]

language-pig

Parser and pretty printer for the Apache Pig scripting language (http://pig.apache.org/). The current version is implemented using Parsec parser combinators.

Install

Cabal project, now on hackage, so the usual

cabal install language-pig

Or from source

git clone ...
cd language-pig
cabal install

Use

Parse an expression:

parseString :: [Char] -> Root

Returns an AST (type Root is the root node).

Parse a file:

parseFile :: FilePath -> IO PigFile

PigFile contains the Root (of AST) and the file name. If you want just the AST, parseFileForAST would do it.

Pretty print the produced tree:

putStrLn $ prettyPrint tree

So to round it up, if you want to parse and pretty print the parsed AST of a Pig file (using Control.Applicative (<$>))

prettyPrint <$> parseFileForAST "example.pig" >>= putStrLn