A library to represent JavaScript programs.
Author: Michael Hanus
Version: January 22, 2007
| Exported names: |
Datatypes:
JSBranch
| JSExp
| JSFDecl
| JSStat
Constructors:
JSApply
| JSAssign
| JSBool
| JSCase
| JSDefault
| JSFCall
| JSFDecl
| JSIArrayIdx
| JSIf
| JSInt
| JSIVar
| JSLambda
| JSOp
| JSPCall
| JSReturn
| JSString
| JSSwitch
| JSVarDecl
Functions:
jsConsTerm
| showJSExp
| showJSFDecl
| showJSStat
| Summary of exported functions: |
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
Type of JavaScript expressions.
Constructors:
:: String -> JSExp
JSString - string constant
:: Int -> JSExp
JSInt - integer constant
:: Bool -> JSExp
JSBool - Boolean constant
:: Int -> JSExp
JSIVar - indexed variable
:: Int -> Int -> JSExp
JSIArrayIdx - array access to index array variable
:: String -> JSExp -> JSExp -> JSExp
JSOp - infix operator expression
:: String -> [JSExp] -> JSExp
JSFCall - function call
:: JSExp -> JSExp -> JSExp
JSApply - function call where the function is an expression
:: [Int] -> [JSStat] -> JSExp
JSLambda - (anonymous) function with indexed variables as arguments
Type of JavaScript statements.
Constructors:
:: JSExp -> JSExp -> JSStat
JSAssign - assignment
:: JSExp -> [JSStat] -> [JSStat] -> JSStat
JSIf - conditional
:: JSExp -> [JSBranch] -> JSStat
JSSwitch - switch statement
:: String -> [JSExp] -> JSStat
JSPCall - procedure call
:: JSExp -> JSStat
JSReturn - return statement
:: Int -> JSStat
JSVarDecl - local variable declaration
Constructors:
:: String -> [JSStat] -> JSBranch
JSCase - case branch
:: [JSStat] -> JSBranch
JSDefault - default branch
Constructors:
:: String -> [Int] -> [JSStat] -> JSFDecl
| Exported functions: |
:: JSExp -> String
Shows a JavaScript expression as a string in JavaScript syntax.
:: Int -> JSStat -> String
Shows a JavaScript statement as a string in JavaScript syntax with indenting.
Example call: (showJSStat i jstat)
i
- number of spaces to indent this statement
jstat
- the JavaScript statement to print
:: JSFDecl -> String
Shows a JavaScript function declaration as a string in JavaScript syntax.
:: String -> [JSExp] -> JSExp
Representation of constructor terms in JavaScript.
Example call: (jsConsTerm cons args)
cons
- the name of the data constructor
args
- the arguments of the constructor term