IAE Academy

ISRO CS 2025 Q.31: solution and answer

ISRO 2025 · CSQ.31 · 1 mark · MCQ

Which one of the following tools generates parser from BNF notation?

  1. (A)

    lex

  2. (B)

    yacc

  3. (C)

    ed

  4. (D)

    gdb

See the question in the paper

Answer and solution

ANSWER

The answer is (b) yacc.

Official answer: BSource: ISRO's final answer key of 15 May 2026

  1. A parser generator takes a context-free grammar, written in BNF-style rules, and produces the source code of a parser for that grammar.

  2. yacc (Yet Another Compiler Compiler) reads grammar rules in a BNF-style notation, with an action attached to each production, and generates an LALR(1) bottom-up parser in C.

  3. lex is a lexical analyser generator. It takes regular expressions and produces a scanner that splits the input into tokens, so it does not handle grammars.

  4. ed is a line-oriented text editor. It has nothing to do with compilers.

  5. gdb is a debugger for running programs. It does not generate parsers.

  6. So the tool that builds a parser from BNF notation is yacc, option (b).

KEY IDEA

yacc turns a grammar written in BNF-style rules into a parser, while lex turns regular expressions into a scanner. The two are normally used together: lex supplies tokens and yacc parses them.

WATCH OUT FOR

Choosing lex because it is the better-known compiler tool. lex only does lexical analysis (tokens from regular expressions) and cannot work from a grammar.

From the ISRO CS 2025 paper. Every question of this paper · The full paper (PDF, ISRO) · All 2 ISRO Parsing questions, with notes