Tools for working with ECMAScript 3 (popularly known as JavaScript). Includes a parser, pretty-printer, tools for working with source tree annotations and an arbitrary instance. See CHANGELOG for a summary of changes. The package follows the Haskell Package Versioning Policy since version


Version change log.

Pull request #84: Moved the Arbitrary instance and the testing-feat dependency to the test-suite. Removed tabs from the lexer.

Pull request #83: Updated dependencies, migrated to ansi-wl-pprint.

Issue #82: Tighter lexing of identifiers using Unicode character classes (thanks @berdario).

Dependency version bumps.

Improvements to pretty-printing (Github PR #78) + fixed a bug in quasi-quotation (Github PR #77).

Fixed a bug in the Arbitrary instance: no longer generating empty list expressions. Dependency bounds update.

Dependency bounds update.

Added helper functions for code generation (see Language.ECMAScript3.Syntax.CodeGen). Bug fixes to the Arbitrary instances.

Build fixes for GHC 7.4.2 and 7.8.2.

Removed unicode-escaping of illegal identifier characters in the
pretty-printer. Adjusted the isValid predicate to check for illegal
characters identifiers. Adjusted the Arbitrary instance to only produce
valid identifier names.

Rewritten the Arbitrary instances using 'testing-feat'. Adjusted the
pretty-printer to escape invalid characters in identifier names
automatically, which gives better usability in code generation use-cases.
Added an 'isValid' predicate to check the validity of the AST. Note that the
pretty-printer is guaranteed to produce syntactically correct code only
for valid ASTs.

Fixed haddock build failure.

Ported the pretty printer to use 'wl-pprint' instead of
'pretty'. Pretty-printed code is now more compact and resembles common
formatting conventions. Fixed bugs where the pretty-printer produced
unparseable source representations for expression statements starting with
'{' or "function". Disabled the QuickCheck pretty-printer test.

Fixed an error in the .cabal file that prevented some of the test modules
to be packaged.

Added semicolons after the "return" statement in the pretty printer to
avoid certain class of syntax error when printed code is parsed
again. Changed the pretty-printer to put the IntLit in parenthesis if it's
found on the left-side of the '.' (field access) operator.

Bug fixes in the pretty-printer, the parser and the QuickCheck arbitrary
instance for the AST. Refactored tests to use test-framework. Reorganized
the interface for the parser to make it consistent; see deprecation
warnings for details. Added Language.ECMAScript3.SourceDiff -- a simple
source-based differ for ECMAScript programs, which is now used for
visualizing test failures. Revised package dependencies. Factored the
analyses out in a separate package: language-ecmascript-analysis;
Language.ECMAScript3.Analysis.* are now deprecated.

Refactoring of the pretty-printing module: added class Pretty with a more
comprehensive coverage of AST datatypes and better documentation. Removed
duplicate code and deprecated all old interfaces (everything except class
Pretty). Old interfaces would be removed in 1.0 (still a long way out).

Added class PP for pretty-printing

Added a 'setAnnotation' function to the 'HasAnnotation' class. Added
a 'withAnnotation' helper function to modify the top level annotation.

Fixed binary operator precedence in the parser.

Added a simple quasi-quoter for ECMAScript (see

The ParenExpr constructor was removed from the Expression AST
(WARNING: might break some builds). The pretty printer was rewritten
to automatically parenthesize sub-expressions based on operator
precedence. Added a (beta quality) arbitrary instance for all the
AST's to generate random JavaScript programs (useful for testing).

Increased the upper bound on data-default in dependencies. See
comments powered byDisqus