ShaderFile ::= (Class | Procedure | Function | Main | Code)*
Class ::= '{$CLASS' ClassName ('$EXTENDS' ClassName*)? '}' (ClassProcedure | ClassFunction | ClassMain | Code)* '{$END}'
Inherited ::= '{$INHERITED' (ClassName)? (MethodName)? (Parameter)* ('$INLINE')? '}'
Call ::= '{$CALL' MethodName Parameter* '}'
Include ::= '{$INCLUDE' Filepath '}'
Meta ::= '{$META' (TextQuoted* | '$VERSION' VersionNumber 'compatibility'? | '$EXTENSION' ExtensionName ExtensionValue | '$LAYOUT' LayoutValue) '}'
Property ::= '{$PROPERTY' PropertyName (StaticName | Value)? '}'
Static ::= '{$STATIC' StaticName Value? '}'
Echo ::= '{$ECHO' (StaticName | PropertyName | TextQuoted) '}'
Varying ::= '{$VARYING' glslTypeQuoted IdentifierQuoted '}'
Uniform ::= '{$UNIFORM' glslTypeQuoted IdentifierQuoted '}'
Var ::= '{$VAR' glslTypeQuoted IdentifierQuoted glslValue? '}'
Const ::= '{$CONST' glslTypeQuoted IdentifierQuoted glslValue '}'
Procedure ::= ProcedureHead Code '{$END}' 
ClassProcedure ::= ProcedureHead (Code | Inherited)* '{$END}' 
ProcedureHead ::= '{$PROC' MethodName (ParameterType ParameterName)* ('$INLINE')? '}'
ClassFunction ::= FunctionHead (Code | Inherited)* '{$END}' 
Function ::= FunctionHead Code '{$END}'
FunctionHead ::= '{$FUNC' ReturnType MethodName (ParameterType ParameterName)* ('$INLINE')? '}'
Main ::= '{$MAIN}' Code '{$END}'
ClassMain ::= '{$MAIN}' (Code | Inherited)* '{$END}'
If ::= '{$IF' Expression '}' Code ( '{$ELIF' Expression '}' Code )* ( '{$ELSE}' Code )? '{$END}'
Info ::= '{$INFO' TextQuoted '}'
Warning ::= '{$WARNING' TextQuoted '}'
Error ::= '{$ERROR' TextQuoted '}'
Throw ::= '{$THROW' TextQuoted '}'

Parameter ::= (PropertyName | StaticName | glslCodeQuoted)
Code ::= (glslCode | Call | Include | Meta | Property | Static | Echo | Var | Varying | Uniform | Const | If | Info | Warning | Error | Throw)*
Expression ::= ( PropertyName | StaticName | Value | ( '$NOT' | '!' ) Expression | '(' Expression ')' | Expression ( '$OR' | '$AND' | '$XOR' | '+' | '-' | '*' | '/' | '=' | '<' | '>' | '<=' | '>=' | '<>' | '|' | '&' | '^' ) Expression )

ClassName ::= Identifier 
MethodName ::= Identifier 
PropertyName ::= Identifier 
StaticName ::= Identifier 
ExtensionName ::= IdentifierQuoted
ParameterName ::= IdentifierQuoted

Value ::= TextQuoted
glslValue ::= glslCodeQuoted
ExtensionValue ::= glslCodeQuoted
LayoutValue ::= glslCodeQuoted

ReturnType ::= glslTypeQuoted
ParameterType ::= glslTypeQuoted

TextQuoted ::= ['] Text [']
VersionNumber ::= [0-9]
IdentifierQuoted ::= ['] Identifier [']
Identifier ::= [A-Za-z0-9_]
Filepath ::= ['] [A-Za-z0-9\/_-] [']
glslCodeQuoted ::= ['] glslCode [']
glslTypeQuoted ::= ['] glslType [']
glslType ::= (int | float | double | vec2 | vec3 | vec4 | ivec2 | ivec3 | ivec4 | dvec2 | dvec3 | dvec4 | mat2 | mat3 | mat4 | imat2 | imat3 | imat4 | dmat2 | dmat3 | dmat4)
glslCode ::= [https://www.opengl.org/documentation/glsl/]