Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

JS-compatible regular expressions implemented in JS.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 generated
Octocat-spinner-32 lib
Octocat-spinner-32 metadata
Octocat-spinner-32 test
Octocat-spinner-32 tools
Octocat-spinner-32 web
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.rst
README.rst

cdlre: JS-compatible regular expressions implemented in JS

This library is intended to help check the ECMAScript specification conformity of regular expression evaluations.

There are a bunch of potential applications:

  • Regression testing the specification against host implementations.
  • Use in understanding why regular expressions succeed/fail to match.
  • Use in a metacircular interpreter.
  • Use as a staging ground for regular expression optimizations and/or a regular expression compiler. (Such a compiler could target eval as a backend or a JIT code execution foreign function.)

Goals

  • Be capable of visualizing (or at least dumping out) the ECMAScript standard steps taken in matching a regular expression.
  • Be capable of enabling/disabling the de-facto quirks from various browsers which are not yet part of the standard.
  • Be capable of running a thorough regression suite against the host regular expression engine (presumably with a set of permitted quirk options).
  • Keep the JS code a direct translation from the spec where possible and practical.

Usage

Simple usage is as follows:

$ JS_SHELL=d8 make

Make targets

make test
Runs the entire test suite. Right now this is parser and evaluation (matcher) tests.
make hosted

Creates a directory structure that can be used for in-browser testing. If you subsequently run:

$ make hosted
...
$ cd hosted/
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

You can navigate to the local testing site in your browser.

Directory structure

lib/
The regular expression library
test/
The regular expression library test suites
tools/
For automatically generating unicode bitmaps from the specification
generated/
Latest version of the generated unicode bitmaps
web/
The page that gets installed via the make hosted target
Something went wrong with that request. Please try again.