GRAMÁTICA DE UN ARCHIVO VRML:

A continuación entregaremos la sintaxis general tanto para un archivo VRML como para sus componentes principales (nodos y campos). Estas han sido tomadas exactamente igual del documento original en inglés con el objeto de evitar ambigüedades.

El caracter '#' (0x23) marca el inicio de una línea de comentario la cual puede aparecer en cualquier punto de un archivo VRML fuera del alcance de los campos del tipo SFString o MFString. El caracter '#' y todos los otros caracteres hasta el retorno de carro o nueva línea forman parte del comentario. Se puede usar un número de espacios en blanco y comentarios pueden ser usados para separar las entidades sintácticas de un archivo VRML.

GRAMÁTICA GENERAL DE UN ARCHIVO VRML:

A continuación se mostrará el esqueleto general en un archivo VRML:

vrmlScene:

declarations

declarations:

declaration

declaration declarations

declaration:

nodeDeclaration

protoDeclaration

routeDeclaration

NULL

nodeDeclaration:

node

DEF nodeNameId node

USE nodeNameId

protoDeclaration:

proto

externproto

proto:

PROTO nodeTypeId [ interface_declarations ] { vrmlScene }

interfaceDeclarations:

interfaceDeclaration

interfaceDeclaration interfaceDeclarations

restrictedInterfaceDeclaration:

eventIn fieldType eventInId

eventOut fieldType eventOutId

field fieldType fieldId fieldValue

interfaceDeclaration:

restrictedInterfaceDeclaration

exposedField fieldType fieldId fieldValue

externproto:

EXTERNPROTO nodeTypeId [ externInterfaceDeclarations ] mfstringValue

externInterfaceDeclarations:

externInterfaceDeclaration

externInterfaceDeclaration externInterfaceDeclarations

externInterfaceDeclaration:

eventIn fieldType eventInId

eventOut fieldType eventOutId

field fieldType fieldId

exposedField fieldType fieldId

routeDeclaration:

ROUTE nodeNameId . eventOutId TO nodeNameId . eventInId

GRAMATICA DE LOS NODOS:

node:

nodeTypeId { nodeGuts }

Script { scriptGuts }

nodeGuts:

nodeGut

nodeGut nodeGuts

scriptGuts:

scriptGut

scriptGut scriptGuts

scriptGut:

nodeGut

restrictedInterfaceDeclaration

eventIn fieldType eventInId IS eventInId

eventOut fieldType eventOutId IS eventOutId

field fieldType fieldId IS fieldId

nodeGut:

fieldId fieldValue

fieldId IS fieldId

eventInId IS eventInId

eventOutId IS eventOutId

routeDeclaration

protoDeclaration

nodeNameId:

Id

nodeTypeId:

Id

fieldId:

Id

eventInId:

Id

eventOutId:

Id

Id:

IdFirstChar

IdFirstChar IdRestChars

IdFirstChar:

Diversos ISO-10646 códigos de caracteres usando UTF-8 excepto: 0x30-0x39,

0x0-0x20, 0x22, 0x23, 0x27, 0x2c, 0x2e, 0x5b, 0x5c, 0x5d, 0x7b, 0x7d.

IdRestChars:

Diversos numeros de ISO-10646 caracteres excepto: 0x0-0x20, 0x22, 0x23, 0x27,

0x2c, 0x2e, 0x5b, 0x5c, 0x5d, 0x7b, 0x7d.

GRAMATICA DE LOS CAMPOS:

fieldType:

MFColor

MFFloat

MFInt32

MFNode

MFRotation

MFString

MFVec2f

MFVec3f

SFBool

SFColor

SFFloat

SFImage

SFInt32

SFNode

SFRotation

SFString

SFTime

SFVec2f

SFVec3f

fieldValue:

sfboolValue

sfcolorValue

sffloatValue

sfimageValue

sfint32Value

sfnodeValue

sfrotationValue

sfstringValue

sftimeValue

sfvec2fValue

sfvec3fValue

mfcolorValue

mffloatValue

mfint32Value

mfnodeValue

mfrotationValue

mfstringValue

mfvec2fValue

mfvec3fValue

sfboolValue:

TRUE

FALSE

sfcolorValue:

float float float

sffloatValue:

... números en punto floatante ANSI Cformato punto flotante...

sfimageValue:

int32 int32 int32 int32s...

sfint32Value:

[0-9]+

0x[0-9A-F]+

sfnodeValue:

nodeDeclaration

NULL

sfrotationValue:

float float float float

sfstringValue:

".*" ... double-quotes must be \", backslashes must be \\...

sftimeValue:

... double-precision number in ANSI C floating point format...

sfvec2fValue:

float float

sfvec3fValue:

float float float

mfcolorValue:

sfcolorValue

[ ]

[ sfcolorValues ]

sfcolorValues:

sfcolorValue

sfcolorValue sfcolorValues

mffloatValue:

sffloatValue

[ ]

[ sffloatValues ]

sffloatValues:

sffloatValue

sffloatValue sffloatValues

mfint32Value:

sfint32Value

[ ]

[ sfint32Values ]

sfint32Values:

sfint32Value

sfint32Value sfint32Values

mfnodeValue:

nodeDeclaration

[ ]

[ nodeDeclarations ]

nodeDeclarations:

nodeDeclaration

nodeDeclaration nodeDeclarations

mfrotationValue:

sfrotationValue

[ ]

[ sfrotationValues ]

sfrotationValues:

sfrotationValue

sfrotationValue sfrotationValues

mfstringValue:

sfstringValue

[ ]

[ sfstringValues ]

sfstringValues:

sfstringValue

sfstringValue sfstringValues

mfvec2fValue:

sfvec2fValue

[ ]

[ sfvec2fValues]

sfvec2fValues:

sfvec2fValue

sfvec2fValue sfvec2fValues

mfvec3fValue:

sfvec3fValue

[ ]

[ sfvec3fValues ]

sfvec3fValues:

sfvec3fValue

sfvec3fValue sfvec3fValues