We don&#x27;t need to decide to apply this rule sometimes but other times that rule. When we come to an ambiguous string, we apply both rules nondeterministically. Here&#x27;s a pseudo-grammar that I think describes both possibilities.<p><pre><code>  Statement -&gt; Type Op Var &quot;;&quot;
  Statement -&gt; Var Op Var &quot;;&quot; 
  Op -&gt; &quot;*&quot;
</code></pre>
I think the disconnect here is that most lexers would insist on feeding a different token to the parser depending on whether &quot;foo&quot; is a Type or a Var, and choosing one or the other means the lexer might feed it bad information. The pragmatic way to implement this in a real compiler is to add some logic to the lexer so that it&#x27;s working with more information than just the syntax. Theoretically though, all that really matters is that both possibilities are syntactically valid. So another way to implement it would be to pass on both possibilities, letting the parser eliminate the one that doesn&#x27;t compile.