Appendix A. Language Grammar

The grammar is fed from the output of lexical analysis. The tokens returned from lexical analysis are

image

The following describes the grammar for the OpenGL Shading Language in terms of the preceding tokens:

variable_identifier:

IDENTIFIER

primary_expression:

variable_identifier

INTCONSTANT

UINTCONSTANT

FLOATCONSTANT

BOOLCONSTANT

LEFT_PAREN expression RIGHT_PAREN

postfix_expression:

primary_expression

postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET

function_call

postfix_expression DOT FIELD_SELECTION

postfix_expression INC_OP

postfix_expression DEC_OP

integer_expression:

expression

function_call:

function_call_or_method ...

Get OpenGL Shading Language, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.