Skip to main content

Context-Free Grammar

Definition

Context-free grammar is a formal system used to define the syntax of programming languages and data structures. It specifies rules for constructing strings of symbols, where each rule’s application does not depend on the surrounding symbols. This mathematical framework is fundamental in computer science for parsing and compiling code. It provides a precise method for describing language structure.