using SML for the ES4 spec

Stephen Weeks sweeks at
Mon Oct 30 11:56:08 PST 2006

I have some SML code for manipulating Javascript that I wrote a while
back which y'all might find useful.  The code follows the ES3 spec and

  * An ML lex specification for Javascript tokens.
  * An ML yacc specification for Javascript.
  * A hand-crafted top-down-parser generator.
  * A specification of Javascript's grammar that works with the
    top-down-parser generator. 
  * Datatypes for Javascript tokens and abstract syntax trees.
  * A command-line tool for Javascript tokenization, parsing, and
    pretty printing.

The ML yacc parser works except that it doesn't handle semicolon
insertion -- I couldn't figure out any way to do that, so I wrote my
own top-down-parser generator that has an interface for token
insertion.  That one works fine.  I've tested it on a fair bit of
Javascript code on the web and there are no bugs that I know of.

The code is available under the MLton license

which is a BSD-style license, so I hope would be OK for you.

Let me know if the code sounds useful and I will package it up.

More information about the Es4-discuss mailing list