The language-javascript package

[Tags: bsd3, library]

Parses Javascript into an Abstract Syntax Tree (AST). Initially intended as frontend to hjsmin.

[Skip to ReadMe]


Versions0.0.1, 0.0.2, 0.0.3, 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.4.8, 0.4.9, 0.4.10, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.5.8, 0.5.9, 0.5.11, 0.5.12, 0.5.13,,,,,,,
Change logNone available
Dependenciesarray (>=0.3 && <0.5), base (==4.*), containers (>=0.2 && <0.5), HUnit, mtl (>=1.1 && <2.9), QuickCheck (==2.*), test-framework, test-framework-hunit, utf8-light (>=0.4 && <1.0) [details]
Copyright(c) 2010 Alan Zimmerman
AuthorAlan Zimmerman
Home page
Bug tracker
Source repositoryhead: git clone git://
UploadedSun Jan 23 13:41:05 UTC 2011 by AlanZimmerman
DistributionsDebian:, Fedora:0.5.13, FreeBSD:, LTSHaskell:, NixOS:, Stackage:
Downloads30573 total (535 in last 30 days)
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]




buildtestsBuild the executable to run unit testsDisabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainers' corner

For package maintainers and hackage trustees

Readme for language-javascript-0.4.0

Parser for JavaScript

Based (loosely) on language-python

How to build


cabal clean && cabal configure && cabal build


cabal clean && cabal configure -fbuildtests && cabal build

Running the tests


To debug the grammar

happy -iparse.txt -g -a  -d src/Language/JavaScript/Parser/Grammar.y 

This generates src/Language/JavaScript/Parser/Grammar.hs, delete this
when done with the debug version

UTF8/Unicode version 

This requires, in particular the utf8
branch, to generate the Lexer.hs file

$ git clone
$ cd Alex
$ git checkout utf8
$ cabal install

This will put a utf8 enabled alex in ~/.cabal/bin

To switch back to the standard version, 

$ cabal install --reinstall alex


0.4.0 Updated JSNode to include location information, and made the parse more true to the original by leaving blocks as such, not replacing with ';'.

0.3.0 ECMA-262 edition 5 compliance.  Required adding JSFunctionExpression and JSPropertyAccessor to the AST.

0.2.2 Heading toward compliance with edition 5. Trailing commas allowed in array literals too.

0.2.1 Allow trailing comma in object literal

0.2.0 ECMAScript 3 allows function expressions to have names, AST.JSFunctionExpression now reflects this

0.1.0 Simplified AST by removing JSElement and JSElementList components

0.0.3 Support for unicode in source. At the moment it only supports
UTF8 encoding, does not recognise byte order marks or UTF-16/UTF-32

0.0.2 Multiline comments were processed in greedy form, now end of
comment recognised properly. Thanks to Tony Morris for reporting this.

0.0.1 Initial release