Linear Grammar in the Chomsky Hierarchy (CF Grammar with ≤ 1 Nonterminal on RHS)
A context-free grammar in which each production’s right-hand side contains at most one non-terminal is called a Linear Grammar. This is the defining property that matches the statement in the question: “atmost one non-terminal in the right handside of the production.”
In the Chomsky hierarchy, linear grammars sit strictly between regular grammars and context-free grammars (more permissive than regular, but more restrictive than general CFGs). The key structural restriction is about how many nonterminals can appear on the RHS of any production.
A common way to express the linear grammar constraint:
- For productions of the form ,
- the string contains terminals and at most one nonterminal symbol (e.g., patterns like or where are strings of terminals, and is a nonterminal).
Mermaid view of “allowed” versus “forbidden” shapes:
Therefore, among the options, the correct answer is (i) linear grammar.
Linear grammars vs regular grammars (intro)
Answer to the MCQ
The blank is “linear grammar”.
- (i) linear grammar ✅
- (ii) linear bounded grammar ❌ (that term is typically associated with linearly bounded automata/languages; not the standard grammar restriction in the question)
- (iii) regular grammar ❌ (regular grammars are more restrictive: they effectively allow nonterminals in a much more limited positional form; they are a subset of linear grammars)
- (iv) None of the above ❌
Why (i) matches the definition
A linear grammar is defined by the “at most one nonterminal on the RHS” rule, which is exactly what the question states.
Key terms:
- Linear Grammar
- Context-Free Grammar (CFG)
- Regular Grammar
Quick identification procedure for the blank
- 1Step 1
Check whether every production’s RHS contains “at most one non-terminal.”
- 2Step 2
If the RHS has ≤ 1 nonterminal for all productions, classify it as a Linear Grammar.
- 3Step 3
If it were regular, the structure would have stronger positional constraints; but the question only specifies the “≤ 1 nonterminal” constraint.
Placement in the Chomsky hierarchy
Most restrictive (among the listed)
RegularProductions are left-linear or right-linear; nonterminals appear in limited positions."
Between regular and full CFG
LinearEach production has at most one nonterminal on the RHS."
General CFG
Context-FreeRHS may contain multiple nonterminals (no “≤ 1” restriction)."
Pro Tip
When a question states a grammar restriction like “at most one nonterminal in RHS,” think first of linear grammars—it’s a standard characterization used in automata/Chomsky hierarchy questions.
Common pitfall
“Linear bounded grammar” is not the usual name for the “≤ 1 nonterminal on RHS” grammar class. Don’t confuse this with “linear” used in other contexts (e.g., boundedness constraints) or with regularity.
Concept check (FAQs)
Knowledge Check
A CFG in which every production has at most one non-terminal on its RHS is called:
Explore Related Topics
Hierarchy and Power of Bottom-Up Parsers: SLR, LALR, and CLR
Bottom‑up LR parsers form a strict hierarchy of power: LR(0) < SLR < LALR < CLR, with each level able to handle all grammars of the lower levels.
- SLR uses LR(0) items and resolves conflicts with FOLLOW sets; it is the weakest but simplest LR parser.
- LALR builds full LR(1) items then merges states that share the same core, keeping the same number of states as SLR while adding look‑ahead precision.
- CLR (canonical LR) retains all LR(1) states and look‑aheads, giving it the highest grammar coverage at the cost of many more states.
- Merging CLR states to form LALR can introduce reduce‑reduce conflicts (never shift‑reduce), making LALR strictly less powerful than CLR.
- In practice, tools like Yacc/Bison prefer LALR because it balances power with manageable memory usage.
Type 2 Grammar (Context-Free Grammar): A Short Note with Formal Meaning and Examples
FIRST/FOLLOW, LL(1) Parsing Table, and LL(1) Determination for a Given CFG