Looking for a clear definition of what a “tokenizer”, “parser” and “lexers” are and how they are related to each other and used?

前端 未结 4 1928
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 15:12

I am looking for a clear definition of what a \"tokenizer\", \"parser\" and \"lexer\" are and how they are related to each other (e.g., does a parser use a tokenizer or vice

4条回答
  •  忘掉有多难
    2020-11-29 15:38

    I would say that a lexer and a tokenizer are basically the same thing, and that they smash the text up into its component parts (the 'tokens'). The parser then interprets the tokens using a grammar.

    I wouldn't get too hung up on precise terminological usage though - people often use 'parsing' to describe any action of interpreting a lump of text.

提交回复
热议问题