CFG
A Context-Free Grammar (CFG) is a formal system used to define the structure of languages, particularly in computer science and linguistics. It consists of a set of production rules that describe how symbols can be combined to form valid strings. Each rule specifies how a single non-terminal symbol can be replaced with a combination of terminal and non-terminal symbols.
CFGs are essential in the design of programming languages and compilers, as they help parse and understand code. They are also used in natural language processing to analyze and generate human languages. The concept of CFG is closely related to Chomsky hierarchy, which classifies grammars based on their generative power.