GLSL upward or backward Compatibility


I’m Student in a engineering school in France

I am working on a project wich consist in parsing glsl with the goal of making a syntax tree.

After we should do optimizations and comparaisons between some vertex or fragment shaders file.

But the problem is that client use GLSL specifications 1.2 and 1.3 but it may evolve

If We Use 1.5 grammar for the parser will it recognize program using grammar from 1.2 or 1.3 specifications ?

1.5 supports 1.2 and 1.3 grammar if the first line is:
#version 150 compatibility

if you only write #version 150, then it only supports “core”.

See slide number 5 of the presentation about GLSL 1.4 and 1.5 at Siggraph 2009.