language-javascript: Parser for JavaScript

[ bsd3, language, library ] [ Propose Tags ]

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

Note: Version 0.5.0 breaks compatibility with prior versions, the AST has been reworked to allow round trip processing of JavaScript.


[Skip to Readme]

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)
Change log ChangeLog.md
Dependencies array (>=0.3), base (>=4 && <5), blaze-builder (>=0.2), bytestring (>=0.9.1), containers (>=0.2), mtl (>=1.1), semigroups (>=0.16.1), text (>=1.2), utf8-string (>=0.3.7 && <2) [details]
License BSD-3-Clause
Copyright (c) 2010-2015 Alan Zimmerman (c) 2015-2019 Erik de Castro Lopo (c) 2018 Daniel Gasienica
Author Alan Zimmerman
Maintainer Erik de Castro Lopo <erikd@mega-nerd.com>
Category Language
Home page https://github.com/erikd/language-javascript
Bug tracker https://github.com/erikd/language-javascript/issues
Source repo head: git clone https://github.com/erikd/language-javascript.git
Uploaded by ErikDeCastroLopo at 2020-03-22T08:02:52Z
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]
Downloads 85200 total (158 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-03-22 [all 1 reports]

Readme for language-javascript-0.7.1.0

[back to package description]

Parser for JavaScript

Build Status

Based (loosely) on language-python

Two Versions

There are currently two versions:

  • 0.5 series : Is a continuation of the 0.5.X.Y series, from the [master] (https://github.com/erikd/language-javascript/tree/master) branch of this github repository.

  • 0.6 and 0.7 series : This has a vastly different and improved AST which makes if far more difficult to build an non-sensical Javascript AST. This code is in the new-ast branch of this github repository.

How to build

Make sure your locale supports UTF-8. For example, on most Unix-like platforms, you can type:

export LC_ALL=en_US.UTF-8

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/Grammar5.y

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

UTF8/Unicode version

Alex 3.0 now supports unicode natively, and has been included as a dependency in the cabal file.

Note: The generation of the lexical analyser has been separated out, to remove the install-time dependency on Alex. If any changes need to be made to the lexer, the Lexer.x source lies in src-dev, and the runalex.sh script will invoke Alex with the appropriate directories.