PArrows-0.1.1: Arrow parser combinators similar to Parsec




data JSCompiler Source

JSCompiler encapsulates the state of the JavaScript compiler.

data JSFun Source

JSFun encapsulates a reference to a JavaScript function.

newJSCompiler :: String -> IO (JSCompiler, JSFun -> String)Source

Create a new JavaScript compiler using the suplied string as prefix. Returns the compiler and a function for showing function references.

compileJS :: JSCompiler -> MD i o -> IO JSFunSource

Compile a parser into JavaScript. Returns a reference to the top-level Parsing function. The generated javascript function expects a String and a starting index for parsing. The result will be either the index of the rightmost character matched or -1 if the parser failed.

dumpBodies :: JSCompiler -> IO [(JSFun, String)]Source

Dump all bodies of generated JavaScript functions.