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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.