Parser

Noun · Development

Definitions

  1. A component that takes a stream of tokens from the lexer and builds a structured representation (AST or parse tree) according to a formal grammar. Types include recursive descent (hand-written, used by most production compilers), PEG parsers, and parser generators (yacc, ANTLR). Produces syntax errors for invalid input.

    In plain English: The part of a compiler that checks if code follows the language's grammar rules and builds a structured tree from it.

    Example: "The parser turns the token stream into an AST — if the tokens don't match the grammar rules, it reports a syntax error with line and column."

Related Terms