chapter
    Context-Free Grammars and Pushdown Automata Short Notes for GATE CS

    Context-Free Grammars and Pushdown Automata short notes for GATE CS: 4 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice

    context free grammars and pushdown automata short notes

    CFG Symbol-Count Quick Checklist

    CFG Symbol-Count Quick Checklist

    1. Equation First Write the net terminal count change () for every production rule.
    2. Bottom-Up Propagation Solve for the simplest non-terminals first, then substitute into higher-level rules.
    3. Branching Tax Remember that rules splitting the derivation (e.g., ) increase the number of required base-case terminations.
    4. Absorption Check When unrolling, check if outer recursive wrappers (like ) are absorbed by inner Kleene stars.
    5. Edge Case Verification Test your final invariant against the shortest valid strings (e.g., length 1 or 2) to ensure no hidden exceptions exist.
    6. Beware False Equality If any rule generates 's and 's asymmetrically, is almost certainly false.

    CNF and Derivation Length Quick Revision

    CNF and Derivation Length Quick Revision

    Core Rules of CNF:
    1. (Two non-terminals)
    2. (One terminal)
    3. (Only if is start and never on RHS)
    The Golden Formula:

    For any string of length derived in CNF

    Exam Execution:
    • Identify (total terminal count in the target string).
    • Compute .
    • Ignore distractors (number of variables, number of rules).

    Ambiguity Quick Revision Checklist

    Ambiguity Quick Revision Checklist

    Core Definitions:
    • Ambiguous Grammar: at least one string with LMD, RMD, or parse tree.
    • Unambiguous Grammar: strings, exactly LMD, RMD, and parse tree.
    • Inherently Ambiguous Language: No unambiguous CFG exists for this language.
    Proof Method:
    1. Pick a candidate string .
    2. Derive using two different leftmost derivation sequences.
    3. Confirm the parse trees are structurally distinct.
    Exam Heuristic:

    Look for rules with repeated non-terminals on the right-hand side (e.g., ) or symmetric binary operations (e.g., ). These are prime candidates for ambiguity.

    1 more card in this chapter

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Context-Free Grammars and Pushdown Automata Short Notes for GATE CS

    Context-Free Grammars and Pushdown Automata short notes for GATE CS: 4 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    CFG Symbol-Count Quick Checklist

    CFG Symbol-Count Quick Checklist

    1. Equation First Write the net terminal count change () for every production rule.
    2. Bottom-Up Propagation Solve for the simplest non-terminals first, then substitute into higher-level rules.
    3. Branching Tax Remember that rules splitting the derivation (e.g., ) increase the number of required base-case terminations.
    4. Absorption Check When unrolling, check if outer recursive wrappers (like ) are absorbed by inner Kleene stars.
    5. Edge Case Verification Test your final invariant against the shortest valid strings (e.g., length 1 or 2) to ensure no hidden exceptions exist.
    6. Beware False Equality If any rule generates 's and 's asymmetrically, is almost certainly false.

    CNF and Derivation Length Quick Revision

    CNF and Derivation Length Quick Revision

    Core Rules of CNF:
    1. (Two non-terminals)
    2. (One terminal)
    3. (Only if is start and never on RHS)
    The Golden Formula:

    For any string of length derived in CNF

    Exam Execution:
    • Identify (total terminal count in the target string).
    • Compute .
    • Ignore distractors (number of variables, number of rules).

    Ambiguity Quick Revision Checklist

    Ambiguity Quick Revision Checklist

    Core Definitions:
    • Ambiguous Grammar: at least one string with LMD, RMD, or parse tree.
    • Unambiguous Grammar: strings, exactly LMD, RMD, and parse tree.
    • Inherently Ambiguous Language: No unambiguous CFG exists for this language.
    Proof Method:
    1. Pick a candidate string .
    2. Derive using two different leftmost derivation sequences.
    3. Confirm the parse trees are structurally distinct.
    Exam Heuristic:

    Look for rules with repeated non-terminals on the right-hand side (e.g., ) or symmetric binary operations (e.g., ). These are prime candidates for ambiguity.

    High-Yield Revision: PDA Core Rules

    High-Yield Revision: PDA Core Rules

    • Transition Meaning: means: in state , reading , with on top move to , pop , push .
    • DPDA Golden Rule: If is defined for , then must be empty.
    • Acceptance Equivalence: NPDA by Final State NPDA by Empty Stack (CFL).
    • DPDA Limitation: DPDA by Empty Stack is strictly weaker (requires prefix property).
    • Stack Power Limit: Can verify (DCFL) or (CFL), but cannot verify or (Not CFL).

    More short notes in this unit