language-javascript: Parser for JavaScript

[ bsd3, language, library ] [ Propose Tags ]

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


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
buildtests

Build the executable to run unit tests

Disabled

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

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.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, 0.5.13.1, 0.5.13.2, 0.5.13.3, 0.5.13.4, 0.5.14.0, 0.5.14.1, 0.5.14.2, 0.5.14.3, 0.5.14.4, 0.5.14.5, 0.5.14.6, 0.5.14.7, 0.5.14.8, 0.6.0.0, 0.6.0.1, 0.6.0.2, 0.6.0.3, 0.6.0.4, 0.6.0.5, 0.6.0.6, 0.6.0.7, 0.6.0.8, 0.6.0.9, 0.6.0.10, 0.6.0.11, 0.6.0.12, 0.6.0.13, 0.6.0.14, 0.7.0.0, 0.7.1.0 (info)
Dependencies array (>=0.3 && <0.5), base (>=4 && <5), containers (>=0.2 && <0.5), HUnit, mtl (>=1.1 && <2.9), QuickCheck (>=2 && <3), test-framework, test-framework-hunit, utf8-light (>=0.4 && <1.0) [details]
License BSD-3-Clause
Copyright (c) 2010 Alan Zimmerman
Author Alan Zimmerman
Maintainer alan.zimm@gmail.com
Category Language
Home page http://github.com/alanz/language-javascript
Bug tracker http://github.com/alanz//language-javascript/issues
Source repo head: git clone git://github.com/alanz/language-javascript.git
Uploaded by AlanZimmerman at 2011-01-07T08:26:42Z
Distributions Arch:0.7.1.0, Debian:0.7.1.0, Fedora:0.7.1.0, FreeBSD:0.5.14.2, LTSHaskell:0.7.1.0, NixOS:0.7.1.0, Stackage:0.7.1.0, openSUSE:0.7.1.0
Reverse Dependencies 13 direct, 121 indirect [details]
Executables runtests
Downloads 85200 total (158 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for language-javascript-0.2.2

[back to package description]
Parser for JavaScript
---------------------

Based (loosely) on language-python

How to build
------------

Library:

cabal clean && cabal configure && cabal build

Tests:

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

Running the tests

./dist/build/runtests/runtests


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 https://github.com/jyp/Alex, in particular the utf8
branch, to generate the Lexer.hs file

$ git clone https://github.com/jyp/Alex.git
$ 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

Changes

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

EOF