Gramática consolidada
Gramática léxica
lexical-unit:
lexical-elementsopt
lexical-elements:
lexical-element lexical-elementsopt
lexical-element:
whitespace
token
comentario
Espacio en blanco
whitespace:
Cualquier carácter con la clase Zs de Unicode
Carácter de tabulación horizontal (U+0009
)
Carácter de tabulación vertical (U+000B
)
Carácter de avance de página (U+000C
)
Carriage return character (U+000D
) followed by line feed character (U+000A
) new-line-character
new-line-character:
Carácter de retorno de carro (U+000D
)
Carácter de avance de línea (U+000A
)
Carácter de línea siguiente (U+0085
)
Carácter de línea siguiente (U+2028
)
Carácter separador de párrafo (U+2029
)
Comentario
comment:
single-line-comment
delimited-comment
single-line-comment:
//
single-line-comment-charactersopt
single-line-comment-characters:
single-line-comment-character single-line-comment-charactersopt
single-line-comment-character:
Any Unicode character except a new-line-character
delimited-comment:
/*
delimited-comment-textopt asteriscos /
delimited-comment-text:
delimited-comment-section delimited-comment-textopt
delimited-comment-section:
/
asterisksopt not-slash-or-asterisk
asterisks:
*
asteriscosopt
not-slash-or-asterisk:
Cualquier carácter Unicode menos *
o /
Tokens
token:
identificador
palabra clave
Literal
operator-or-punctuator
Secuencias de escape de caracteres
character-escape-sequence:
#(
escape-sequence-list )
escape-sequence-list:
single-escape-sequence
escape-sequence-list ,
single-escape-sequence
single-escape-sequence:
long-unicode-escape-sequence
short-unicode-escape-sequence
control-character-escape-sequence
escape-escape
long-unicode-escape-sequence:
hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit
short-unicode-escape-sequence:
hex-digit hex-digit hex-digit hex-digit
control-character-escape-sequence:
control-character
control-character:
cr
lf
tab
escape-escape:
#
Literales
literal:
logical-literal
number-literal
text-literal
null-literal
verbatim-literal
logical-literal:
true
false
number-literal:
decimal-number-literal
hexadecimal-number-literal
decimal-digits:
decimal-digit decimal-digitsopt
decimal-digit: one of
0 1 2 3 4 5 6 7 8 9
hexadecimal-number-literal:
0x
dígitos hexadecimales
0X
dígitos hexadecimales
hex-digits:
hex-digit hex-digitsopt
hex-digit: one of
0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
decimal-number-literal:
decimal-digits decimal-digits.
exponent-partopt
.
decimal-digits exponent-partopt
decimal-digits exponent-partopt
exponent-part:
e
signopt decimal-digits
E
signopt decimal-digits
sign: one of
+ -
text-literal:
"
text-literal-charactersopt "
text-literal-characters:
text-literal-character text-literal-charactersopt
text-literal-character:
single-text-character
character-escape-sequence
double-quote-escape-sequence
single-text-character:
Cualquier carácter excepto "
(U+0022
) o #
(U+0023
) seguido de (
(U+0028
)
double-quote-escape-sequence:
""
(U+0022
, U+0022
)
null-literal:
null
verbatim-literal:
#!"
text-literal-charactersopt "
Identificadores
identifier:
regular-identifier
quoted-identifier
regular-identifier:
available-identifier
available-identifier dot-character regular-identifier
available-identifier:
A keyword-or-identifier that is not a keyword
keyword-or-identifier:
letter-character
underscore-character
identifier-start-character identifier-part-characters
identifier-start-character:
letter-character
underscore-character
identifier-part-characters:
identifier-part-character identifier-part-charactersopt
identifier-part-character:
letter-character
decimal-digit-character
underscore-character
connecting-character
combining-character
formatting-character
generalized-identifier:
generalized-identifier-part
generalized-identifier separated only by blanks (U+0020
) generalized-identifier-part
generalized-identifier-part:
generalized-identifier-segment
decimal-digit-character generalized-identifier-segment
generalized-identifier-segment:
keyword-or-identifier
keyword-or-identifier dot-character keyword-or-identifier
dot-character:
.
(U+002E
)
underscore-character:
_
(U+005F
)
letter-character:_
Un carácter Unicode de las clases Lu, Ll, Lt, Lm, Lo o Nl
combining-character:
Un carácter Unicode de las clases MN o MC
decimal-digit-character:
Un carácter Unicode de la clase Nd
connecting-character:
Un carácter Unicode de la clase Pc
formatting-character:
Un carácter Unicode de la clase Cf
quoted-identifier:
#"
text-literal-charactersopt "
Palabras clave e identificadores predefinidos
Los identificadores predefinidos y las palabras clave no se pueden redefinir. Se puede usar un identificador entre comillas para controlar los identificadores que de otro modo entrarían en conflicto con las palabras clave o los identificadores predefinidos.
keyword: one ofand as each else error false if in is let meta not null or otherwise
section shared then true try type #binary #date #datetime
#datetimezone #duration #infinity #nan #sections #shared #table #time
Operadores y signos de puntuación
operator-or-punctuator: one of
, ; = < <= > >= <> + - * / & ( ) [ ] { } @ ? ?? => .. ...
Gramática sintáctica
Documentos
document:
section-document
expression-document
Documentos de sección
section-document:
section
section:
literal-attributesoptsection
section-name;
section-members opt
section-name:
identificador
section-members:
section-member section-membersopt
section-member:
literal-attributesopt sharedopt section-member-name =
expression ;
section-member-name:
identifier
Documentos de expresión
Expresiones
expression-document:
expresión
expression:
logical-or-expression
each-expression
function-expression
let-expression
if-expression
error-raising-expression
error-handling-expression
Expresiones lógicas
logical-or-expression:
logical-and-expression
logical-and-expression or
logical-or-expression
logical-and-expression:
is-expression
logical-and-expression is-expressionand
Expresión is
is-expression:
as-expression
is-expression is
nullable-primitive-type
nullable-primitive-type:
nullable
opt primitive-type
Expresión as
as-expression:
equality-expression
as-expression as
nullable-primitive-type
Expresión de igualdad
equality-expression:
relational-expression
relational-expression =
equality-expression
relational-expression <>
equality-expression
Expresión relacional
relational-expression:
additive-expression
additive-expression <
relational-expression
additive-expression >
relational-expression
additive-expression <=
relational-expression
additive-expression >=
relational-expression
Expresiones aritméticas
additive-expression:
multiplicative-expression
multiplicative-expression +
additive-expression
multiplicative-expression -
additive-expression
multiplicative-expression &
_additive-expression
multiplicative-expression:
metadata-expression
metadata-expression *
multiplicative-expression
metadata-expression /
multiplicative-expression
Expresión de metadatos
metadata-expression:
unary-expression
unary-expression meta
unary-expression
Expresión unaria
unary-expression:
type-expression
+
unary-expression
-
unary-expression
not
unary-expression
Expresión primaria
primary-expression:
literal-expression
list-expression
record-expression
identifier-expression
section-access-expression
parenthesized-expression
field-access-expression
item-access-expression
invoke-expression
not-implemented-expression
Expresión literal
literal-expression:
literal
Expresión de identificador
identifier-expression:
identifier-reference
identifier-reference:
exclusive-identifier-reference
inclusive-identifier-reference
exclusive-identifier-reference:
identificador
inclusive-identifier-reference:
@
identificador
Expresión de acceso de sección
section-access-expression:
identificador de identificador !
Expresión entre paréntesis
parenthesized-expression:
(
expresión )
Expresión no implementada
not-implemented-expression:
...
Expresión de invocación
invoke-expression:
primary-expression (
argument-listopt )
argument-list:
expression
expresión ,
argument-list
Expresión de lista
list-expression:
{
participación en la listade elementos }
item-list:
item
item-list,
item:
expression
expresión..
Expresión de registro
record-expression:
[
opción de listade campos ]
field-list:
campo
field-list,
campo:
expresión field-name=
field-name:
generalized-identifier
quoted-identifier
Expresión de acceso a elementos
item-access-expression:
item-selection
optional-item-selection
item-selection:
primary-expression {
item-selector }
optional-item-selection:
primary-expression {
item-selector } ?
item-selector:
expression
Expresión de acceso a campos
field-access-expression:
field-selection
implicit-target-field-selection
proyección
implicit-target-projection
field-selection:
primary-expression field-selector
field-selector:
required-field-selector
optional-field-selector
required-field-selector:
[
field-name ]
optional-field-selector:
[
field-name ] ?
implicit-target-field-selection:
field-selector
projection:
primary-expression required-projection
primary-expression optional-projection
required-projection:_
[
required-selector-list ]
optional-projection:
[
required-selector-list ] ?
required-selector-list:
required-field-selector
required-field-selector ,
required-selector-list
implicit-target-projection:
required-projection
optional-projection
Expresión de función
function-expression:
(
parameter-listopt)
return-typeopt=>
function-body
function-body:
expresión
parameter-list:
fixed-parameter-list
fixed-parameter-list ,
optional-parameter-list
optional-parameter-list
fixed-parameter-list:
parámetro
parameter ,
fixed-parameter-list
parameter:
parameter-name primitive-parameter-typeopt
parameter-name:
identifier
primitive-parameter-type:
primitive-assertion
return-type:
primitive-assertion
primitive-assertion:
as
Nullable-primitive-type
optional-parameter-list:
optional-parameter
optional-parameter ,
optional-parameter-list
optional-parameter:
optional
parámetro
Expresión each
each-expression:
each
each-expression-body
each-expression-body:
function-body
Expresión let
let-expression:
let
expresión variable-listin
variable-list:
variable
variable ,
variable-list
variable:
expresión variable-name=
variable-name:
identifier
Expresión if
if-expression:
if
if-conditionthen
true-expressionelse
false-expression
if-condition:
expresión
true-expression:
expresión
false-expression:
expression
Expresión de tipo
type-expression:
primary-expression
type
tipo principal
type:
primary-expression
primary-type
primary-type:
primitive-type
record-type
list-type
function-type
table-type
nullable-type
primitive-type: one of
any anynonnull binary date datetime datetimezone duration function
list logical none null number record table text time type
record-type:
[
open-record-marker ]
[
field-specification-listopt ]
[
field-specification-list ,
open-record-marker ]
field-specification-list:
field-specification
field-specification,
field-specification-list
field-specification:
optional
opt field-name field-type-specificationopt
field-type-specification:
=
tipo de campo
field-type:
tipo
open-record-marker:
...
list-type:
{
item-type }
item-type:
tipo
function-type:
function (
parameter-specification-listopt)
return-type
parameter-specification-list:
required-parameter-specification-list
required-parameter-specification-list ,
optional-parameter-specification-list
optional-parameter-specification-list
required-parameter-specification-list:
required-parameter-specification
required-parameter-specification ,
required-parameter-specification-list
required-parameter-specification:
parameter-specification
optional-parameter-specification-list:
optional-parameter-specification
optional-parameter-specification ,
optional-parameter-specification-list
optional-parameter-specification:
optional
parameter-specification
parameter-specification:
parameter-name parameter-type
parameter-type:
assertion
assertion:
as
tipo
table-type:
table
tipo de fila
row-type:
[
field-specification-listopt ]
nullable-type:
nullable
tipo
Expresión de generación de errores
error-raising-expression:
error
expression_
Expresión de control de errores
error-handling-expression:
try
protected-expression error-handleropt
protected-expression:
expresión
error-handler:
otherwise-clause
catch-clause
otherwise-clause:
otherwise
default-expression
default-expression:
expression
catch-clause:
catch
catch-function
catch-function:
(
parameter-nameopt=>
)
function-body
Atributos literales
literal-attributes:
record-literal
record-literal:
[
literal-field-listopt ]
literal-field-list:
literal-field
literal-field ,
literal-field-list
literal-field:
field-name =
any-literal
list-literal:
{
literal-item-listopt }
literal-item-list:
any-literal
any-literal-item-list ,
any-literal:
record-literal
list-literal
logical-literal
number-literal
text-literal
null-literal