&gt; you need hooks from the symbol table back into the tokeniser&#x2F;parser<p>not necessary. you can add a bit of information to each identifier token: is this the name of a type or not?<p>you have to split up one of the parser passes, so if you had a two pass &quot;tokenizer&quot; and &quot;LR parser&quot; compiler now you have a tokenizer pass followed by two LR parser passes. The first LR pass is &quot;last mile tokenization&quot;. I guess another word would be a (very short) cascade tokenizer&#x2F;parser.<p>The intermediate pass adds a piece of metadata to each token marking it as the name of a type or not (this makes the language actually context free instead of just nearly context free). If you do this, then the second pass doesn&#x27;t see this as two identifiers at all because it knows which identifiers refer to types and which do not.<p>It&#x27;s a different application (computing scope data instead of type data) but I&#x27;ve implemented the basic concept of annotating token data with the result of an intermediate parsing stage here...check out line 318 here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dbpokorny&#x2F;autoclave&#x2F;blob&#x2F;master&#x2F;tree.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dbpokorny&#x2F;autoclave&#x2F;blob&#x2F;master&#x2F;tree.js</a>