Parser
A parser is a software component that analyses a sequence of input tokens to determine its grammatical structure with respect to a given formal grammar. In programming language implementation, a parser processes source code produced by a lexer to produce a parse tree or an abstract syntax tree (AST) used by later stages such as semantic analysis and code generation. Parsers are used beyond compilers, in data processing to parse data formats like XML, JSON, or custom configuration languages, and in natural language processing to obtain syntactic structures from sentences. Output structures encode relationships such as precedence, nesting, and scope.
Parsers are broadly categorized by parsing strategy. Top-down parsers, including recursive-descent and LL(k) parsers, build structures
Useful tools include parser generators like Yacc/Bison, ANTLR, JavaCC, or Pegen, which emit code from grammar