Q22.Marks: +2.0UGC NET Paper 2: Computer Sc 6th Jan 2025 Shift 1
Yacc is which of the following parsers?
1.Predictive Parser
2.SLR Parser
3.CLR Parser
4.LALR Parser✓ Correct
Solution
The correct answer is LALR Parser.
Key Points
Yacc (Yet Another Compiler-Compiler) is a tool used to generate a parser in the form of a LALR (Look-Ahead LR) parser.
A LALR parser is a type of LR parser, specifically designed to handle a larger set of grammars than SLR parsers, while being more efficient than CLR parsers.
Yacc is widely used in compiler construction to generate the syntax analysis phase of a compiler.
It takes a formal grammar for the source language and produces source code for a parser that can parse the language.
Yacc generates an LALR(1) parser, which means it uses one look-ahead symbol to make parsing decisions.
Additional Information
Yacc has been instrumental in the development of many programming languages, including C and many others.
It is often used in conjunction with a lexical analyzer generator like Lex.
Yacc's output is typically in the form of C source code, which can be compiled to produce the parser.
The combination of Lex and Yacc allows for the creation of a complete compiler front end, including lexical analysis and syntax analysis.
Yacc was developed at AT&T Bell Laboratories in the early 1970s by Stephen C. Johnson.