context-free grammar

Nonterminal rewriting system

A context-free grammar is a formal system in computer science and linguistics for defining the structure of languages, particularly programming languages and mathematical notations.

It consists of rules specifying how symbols can be replaced or expanded, where each rule applies regardless of surrounding context—hence "context-free." These grammars are essential for parsing, allowing compilers to analyze code structure.

The parser uses a context-free grammar to validate the syntax.

formalism

terminal

At the endpoint

symbol · alphabet · metalanguage

linguistics

Chomsky

verb phrase · sentence structure · grammaticality · recursion · embedding · subordination

parsing

parser

Syntax-interpreting program

syntax error · scanner

automata

stack

Items piled vertically

configuration · transition · state

applications

programming language

Formal notation for computer instructions

bioinformatics · pattern matching · interpreter

Categories
Opposites
Chomsky hierarchy position

context-free grammarTuring machine

Mathematical model of computation

regular expression

context-sensitivity

context-free grammarnatural language

Human communication, not programming

traditional grammar

Family

grammar, context, recontextualization, contexts, contextualize, contextualized, contextually, decontextualize, recontextualize

Familiarity
Top 1,000,000
Profile
Used worldwide · Timeless · Abstract · Rated G