0

I've been reading through the GLSL standard, and one of the things I'm always interested are the detaills on how their grammar works lexically and semenatically. The document does include a chapter on it, see: https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.html#shading-language-grammar or https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf on page 205 respectively, but they both refer to the output of a lexical analysis that's not described there. Some (Like "CONST") seem to refer to keywords, some ("RIGHT_BRACE") to special characters, some ("IDENTIFIER", "INTCONSTANT") to other rules not described here.

Are there any normative references for this lexing process, or do I seriously have to sift through the glslang code base to find out how they are defined?

I searched through the specification, but neither the token names or even the words "lexical analysis" appear anywhere else.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174

1 Answers1

1

They refer to the output as produced by the preprocessor, which is described partially in chapter 3.3. As that notes, unless otherwise specified in that chapter, the preprocessor behaves in accordance with a C++ preprocessor as specified in the International Standard ISO/IEC 14882:1998(E). Programming Languages - C++, more commonly known as C++98. See this answer on how to get this standard.

The tokens referred to in chapter 4 are the tokens produced by this preprocessor.

Emanuel P
  • 1,586
  • 1
  • 6
  • 15