April 2002 Draft
JavaScript 2.0
Formal Description
Unit Grammar
previousupnext

Tuesday, October 9, 2001

This LALR(1) grammar describes the syntax of quoted unit patterns. The input to this grammar is the unit string literal’s contents after the string literal has been processed. See also the description of the grammar notation.

This document is also available as a Word 98 rtf file.

The start nonterminal is UnitPattern.

White Space

  {wsoptwsreq}
WhiteSpaceCharacter 
   «TAB» | «VT» | «FF» | «SP» | «u00A0»
|  «u2000» | «u2001» | «u2002» | «u2003» | «u2004» | «u2005» | «u2006» | «u2007»
|  «u2008» | «u2009» | «u200A» | «u200B»
|  «u3000»
LineTerminator  «LF» | «CR» | «u2028» | «u2029»
RequiredWhiteSpace 
   WhiteSpaceCharacter
|  LineTerminator
|  RequiredWhiteSpace WhiteSpaceCharacter
|  RequiredWhiteSpace LineTerminator
WhiteSpacewsopt 
   RequiredWhiteSpace
|  «empty»
WhiteSpacewsreq  RequiredWhiteSpace

Unit Patterns

UnitPattern  WhiteSpacewsopt UnitQuotient
UnitQuotient 
   UnitProductwsopt
|  UnitProductwsopt / WhiteSpacewsopt UnitProductwsopt
UnitProduct 
   UnitFactor
|  UnitProductwsopt * WhiteSpacewsopt UnitFactor
|  UnitProductwsreq UnitFactor
UnitFactor 
   1 WhiteSpace
|  1 WhiteSpacewsopt ^ WhiteSpacewsopt SignedInteger WhiteSpace
|  Identifier WhiteSpace
|  Identifier WhiteSpacewsopt ^ WhiteSpacewsopt SignedInteger WhiteSpace

Signed Integers

SignedInteger 
   DecimalDigits
|  + DecimalDigits
|  - DecimalDigits
DecimalDigits 
   ASCIIDigit
|  DecimalDigits ASCIIDigit
ASCIIDigit  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Identifiers

Identifier 
   InitialIdentifierCharacter
|  Identifier ContinuingIdentifierCharacter
InitialIdentifierCharacter  UnicodeInitialAlphabetic | $ | _
ContinuingIdentifierCharacter  UnicodeAlphanumeric | $ | _
UnicodeInitialAlphabetic  Any Unicode initial alphabetic character (includes ASCII A-Z and a-z)
UnicodeAlphanumeric  Any Unicode alphabetic or decimal digit character (includes ASCII 0-9, A-Z, and a-z)

Waldemar Horwat
Last modified Tuesday, October 9, 2001
previousupnext