I think that if the lexer is to be pure, it should have the following structure:

namespace yy {

  class lexer {

  public:
    token_type lex(semantic_type& [,...]);
  };

}

This means that semantic_type must be known to class lexer at least as a reference. So it suggests that also the semantic type should be put in a header, as I suggested. [,...] might contain other data the lexer is communicating with the parser, like the location.

  Hans Aberg




Reply via email to