Parser for JavaScript, in Haskell
  • Haskell 69%
  • Yacc 22.6%
  • Lex 7.9%
  • Shell 0.4%
  • Makefile 0.1%
Find a file
2023-03-07 12:38:32 +11:00
src/Language/JavaScript Add support for async function specifier and await keyword 2020-03-22 18:58:18 +11:00
test Add support for async function specifier and await keyword 2020-03-22 18:58:18 +11:00
unicode Worked in rest of unicode for identifiers as per language spec. Ready for 0.0.3 2010-12-28 14:00:03 +02:00
.ghci Builds and runs tests. Need to make test pass. 2010-11-24 23:30:12 +02:00
.gitignore Minor tweaks 2020-03-22 18:58:18 +11:00
.travis.yml Minor tweaks 2020-03-22 18:58:18 +11:00
cabal.project Minor tweaks 2020-03-22 18:58:18 +11:00
ChangeLog.md Version Version 0.7.1.0 2020-03-22 19:01:56 +11:00
ecmascript3.txt Preparatory work before sweep through Parser to check ECMAScript edition 3 compliance. 2011-01-05 23:06:26 +02:00
ecmascript5.txt Heading toward compliance with edition 5. Trailing commas allowed in array literals too. 2011-01-07 09:44:46 +02:00
language-javascript.cabal Remove dependency on utf8-light. 2023-03-07 12:38:32 +11:00
LICENSE WIP. Aiming at getting parsing infrastructure in place, based on language-python. 2010-11-21 23:49:07 +02:00
Makefile Makefile: Remove profiling, cleanup 2016-05-30 07:37:16 +10:00
README.md Warn about UTF-8 requirement in README.md 2020-03-15 08:51:58 +11:00
Setup.hs WIP. Aiming at getting parsing infrastructure in place, based on language-python. 2010-11-21 23:49:07 +02:00
TODO.txt Working in comment processing. 2012-02-29 23:44:56 +02:00

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.