Introduction to JS/CC

JS/CC is the first available parser development system for JavaScript and ECMAScript-derivates. It has been developed, both, with the intention of building a productive compiler development system and with the intention of creating an easy-to-use academic environment for people interested in how parse table generation is done general in bottom-up parsing.

The platform-independent software unions both: A regular expression-based lexical analyzer generator matching individual tokens from the input character stream and a LALR(1) parser generator, computing the parse tables for a given context-free grammar specification and building a stand-alone, working parser. The context-free grammar fed to JS/CC is defined in a Backus-Naur-Form-based meta language, and allows the insertion of individual semantic code to be evaluated on a rule's reduction.

JS/CC itself has been entirely written in ECMAScript so it can be executed in many different ways: as platform-independent, browser-based JavaScript embedded on a Website, as a Windows Script Host Application, as a compiled JScript.NET executable, as a Mozilla/Rhino or Mozilla/Spidermonkey interpreted application, or a V8 shell script on Windows, *nix, Linux and Mac OSX. However, for productive execution, it is recommended to use the command-line versions. These versions are capable of assembling a complete compiler from a JS/CC parser specification, which is then stored to a .js JavaScript source file.

To use JS/CC and for understanding its internals and behavior, some knowledge of context-free grammars, bottom-up parsing techniques and compiler construction theory, in general, is assumed.

Some screenshots

It is really amazing, where JS/CC can be invoked from:

Instant grammar development and testing

JS/CC is capable to compile and run a stand-alone parser for any grammar specification with embedded, semantic code segments entirely in a web browser like Mozilla Firefox, Konqueror or Microsoft® Internet Explorer.

So feel free and check out the online live installation of JS/CC now!

Downloading JS/CC

JS/CC is currently provided in a tarball jscc-0.30.tar.gz, a zipped package and in a Windows setup package jscc-0.30.exe. All three packages come with complete source code, documentation and example code.

To get the latest releases, sources, news and updates on JS/CC, please visit the JS/CC project page on!


The JS/CC user's manual can be obtained as single PDF-file here.

Enhancement requests, bug reports, recommendations

Please feel free to send any enhancement requests, bug reports or recommendations to jscc[-AT-]

Thank you!

Author & License

JS/CC is a non-commercial project of Jan Max Meyer and Phorward Software Technologies (formerly known as J.M.K S.F. Software Technologies), and has been released under the terms and conditions of the BSD license to the public.

Example grammar

A simple four-function expression calculator is defined with the following few lines of augmented grammar definition to be fed to JS/CC.

/~ --- Token definitions --- ~/

/~ Characters to be ignored ~/
!   ' |\t' ;

/~ Non-associative tokens ~/
    '[0-9]+'                        INT   [* %match = parseInt( %match ); *]
    '[0-9]+\.[0-9]*|[0-9]*\.[0-9]+' FLOAT [* %match = parseFloat( %match ); *]

/~ Left-associative tokens, lowest precedence ~/
<  '\+'

/~ Left-associative tokens, highest precedence ~/
<  '\*'


/~ --- Grammar specification --- ~/

p:      e              [* alert( %1 ); *]

e:      e '+' e        [* %% = %1 + %3; *]
        | e '-' e      [* %% = %1 - %3; *]
        | e '*' e      [* %% = %1 * %3; *]
        | e '/' e      [* %% = %1 / %3; *]
        | '-' e &'*'   [* %% = %2 * -1; *]
        | '(' e ')'    [* %% = %2; *]
        | INT
        | FLOAT


JS/CC has already been used in the following projects.