title: How can a lexer extract a token in ambiguous languages?
body: <p>I wish to understand how does a parser work. I learnt about the LL, LR(0), LR(1) parts, how to build, NFA, DFA, parse tables, etc.</p>
  
  <p>Now the problem is, i know that a lexer should extract tokens only on the parser demand in some situation, when it's not possible to extract all the tokens in one separated pass. I don't exactly understand this kind of situation, so i'm open to any explanation about this.</p>
  
  <p>The question now is, how should a lexer does its job ? should it base its recognition on the current "contexts", the current non-terminals supposed to be parsed ? is it something totally different ?
  What about the GLR parsing : is it another case where a lexer could try different terminals, or is it only a syntactic business ?
  I would also want to understand what it's related to, for example is it related to the kind of parsing technique (LL, LR, etc) or only the grammar ?</p>
  
  <p>Thanks a lot</p>