Grammatica does not handle Semantic instructions in grammar file. Thus, the those productions need to be described in a C# class.

After the execution of /etc/exec.sh, Grammatica will create four files in parser directory:
To include basic/local semantic instructions we must extend the XXXAnalyzer, overriding onEnter and onExit methods and adding the behavior needed. In our case, we replace all one-to-one tokens, adding a GLSL version of a token in the values attribute and keeping on the original HLSL version in image attribute.

// Replacing #elseif to #elif.
public override Node ExitPreElseif(Token node) {
	node.AddValue("#elif");
	return node;
}


We reconstruct the shader joining the image attribute when there are no value added.