Which one of the following tools generates parser from BNF notation?
- (A)
lex
- (B)
yacc
- (C)
ed
- (D)
gdb
Which one of the following tools generates parser from BNF notation?
lex
yacc
ed
gdb
ANSWER
The answer is (b) yacc.
Official answer: BSource: ISRO's final answer key of 15 May 2026
A parser generator takes a context-free grammar, written in BNF-style rules, and produces the source code of a parser for that grammar.
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.
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.
ed is a line-oriented text editor. It has nothing to do with compilers.
gdb is a debugger for running programs. It does not generate parsers.
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