On this page:
7.1.2Literals
7.1.3Statements
8.18
top
up

7Parsing ECMAScriptπŸ”— i

procedure

( read-program [source-namein])

(or/c(listof(or/cfunction? statement? ))eof-object?)
source-name:any/c=(object-namein)
in:input-port?=(current-input-port)

7.1Abstract SyntaxπŸ”— i

struct

(struct syntax-element (location))

location:source-location?
The base type for all ECMAScript syntax elements.

struct

(struct identifier syntax-element (symbol))

symbol:symbol?
An identifier.

struct

(struct function syntax-element (nameparametersbody))

name:(or/cidentifier? #f)
parameters:(listofidentifier? )
body:(listof(or/cfunction? statement? ))
A function definition, which may appear as part of an expression (in which case name may be #f) or program body, or nested within another function.

struct

(struct variable-declaration syntax-element (nameinitializer))

initializer:(or/cexpression? #f)
A variable declaration with optional initializer.

7.1.1ExpressionsπŸ”— i

The base type for all ECMAScript expressions.

A literal value expression.

The this keyword.

struct

(struct expression:reference expression (identifier))

identifier:identifier?
An identifier reference.

A member reference. This struct represents expressions of the form object.property and object[property], depending on the type of property.

struct

(struct operator syntax-element (symbol))

symbol:symbol?

struct

(struct expression:postfix expression (operandoperator))

operand:expression?
operator:operator?

struct

(struct expression:unary expression (operatoroperand))

operator:operator?
operand:expression?

struct

(struct expression:binary expression (leftoperatorright))

operator:operator?
right:expression?
Operator expressions.

The conditional (ternary) operator ?:.

struct

(struct expression:call expression (functionarguments))

function:expression?
arguments:(listofexpression? )
A function call.

struct

(struct expression:new expression (constructorarguments))

constructor:expression?
arguments:(listofexpression? )
A new expression.

struct

(struct expression:function expression (definition))

definition:function?
A function expression.

struct

(struct expression:comma expression (leftright))

right:expression?
The comma operator.

7.1.2LiteralsπŸ”— i

The base type for all literals.

The null keyword.

struct

(struct literal:boolean literal (value))

value:boolean?

struct

(struct literal:number literal (value))

value:number?

struct

(struct literal:string literal (value))

value:string?
A boolean, numeric or string literal.

struct

(struct literal:regexp literal (patternflags))

pattern:string?
flags:string?
A regular expression literal. The flags field should be a (possibly empty) string consisting of a combination of the characters g, i and m.

struct

(struct literal:array literal (elements))

elements:(listof(or/cexpression? #f))
An array literal. A #f value for any element indicates an elision.

An object literal.

A property-initializer:get initializer must be an anonymous function of no arguments. A property-initializer:set initializer must be an anonymous function of one argument.

7.1.3StatementsπŸ”— i

The base type for all statements.

body:(listofstatement? )
A block.

label:(or/cidentifier? #f)
A break statement.

label:(or/cidentifier? #f)
A continue statement.

A debugger statement.

struct

(struct statement:do statement (bodytest))

body:statement?
A do statement.

An empty statement. See empty-statement.

struct

(struct statement:expression statement (expression))

expression:expression?
An expression statement.

struct

(struct statement:for statement (initializertestupdatebody))

initializer:(or/cexpression? (listofvariable-declaration? )#f)
test:(or/cexpression? #f)
update:(or/cexpression? #f)
body:statement?
A for statement.

struct

(struct statement:for-in stmt(indexexpressionbody))

expression:expression?
body:statement?
See for-in.

struct

(struct statement:if statement (testtruefalse))

true:statement?
false:(or/cstatement? #f)
An if statement.

struct

(struct statement:label statement (labelstatement))

label:identifier?
statement:statement?
A labelled statement. See label.

struct

(struct statement:return statement (expression))

expression:(or/cexpression? #f)
A return statement.

struct

(struct statement:switch statement (expressionbody))

expression:expression?
body:(listof(or/ccase-clause? default-clause? ))

struct

(struct case-clause syntax-element (expressionbody))

expression:expression?
body:(listofstatement? )
body:(listofstatement? )
A switch statement.

struct

(struct statement:throw statement (expression))

expression:expression?
A throw statement.

struct

catch-id
catch-body
finally-body))
catch-id:(or/cidentifier? #f)
catch-body:(or/cstatement:block? #f)
finally-body:(or/cstatement:block? #f)
A try statement.

struct

(struct statement:var statement (declarations))

declarations:(listofvariable-declaration? )
A variable declaration statement.

struct

(struct statement:while statement (testbody))

body:statement?
A while statement.

struct

(struct statement:with statement (expressionbody))

expression:expression?
body:statement?
A with statement.

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /