from the parse-start function and the first terminal read (let's say
it's "compile", you cannot know which rule to apply, which function to
call.

So you have to transform the grammar to make sure that for each non
terminal the set of the first symbols derivable from that non terminal
is disjoint from the set for the other non terminals (at least, for
the other non terminals derivable from the same places).