본문 바로가기

Programming

Parser 에 대한 기초지식






아래 글은 The Definitive ANTLR4 Reference 에서 발췌한 글이다.

아주 좋은 글인 거 같아서 이렇게 남겨서 두고두고 보고 싶다. ㅎㅎ


  • Syntax tree or parse tree This represents the structure of the sentence where each subtree root gives an abstract name to the elements beneath it. The subtree roots correspond to grammar rule names. The leaves of the tree are symbols or tokens of the sentence.
  • Token A token is a vocabulary symbol in a language; these can represent a category of symbols such as “identifier” or can represent a single operator or keyword.
  • Lexer or tokenizer This breaks up an input character stream into tokens. A lexer performs lexical analysis.
  • Recursive-descent parser This is a specific kind of top-down parser implemented with a function for each rule in the grammar.
  • Lookahead Parsers use lookahead to make decisions by comparing the symbols that begin each alternative.