COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following language is a parser generator?
A
LEX
B
YACC
C
Pascal
D
Simula
Explanation: 

Detailed explanation-1: -yacc can generate parsers in C or C++ and supports loadable resources for Microsoft Windows. The language in use determines the name of the file containing the prototype code, and the name of the code file. With the-d option, or when C++ code is requested, an additional definitions file is written.

Detailed explanation-2: -Yacc (yet another compiler compiler) is a grammar parser and parser generator. That is, it is a program that reads a grammar specification and generates code that is able to organize input tokens in a syntactic tree in accordance with the grammar.

Detailed explanation-3: -Yacc produces only a parser (phrase analyzer); for full syntactic analysis this requires an external lexical analyzer to perform the first tokenization stage (word analysis), which is then followed by the parsing stage proper. Lexical analyzer generators, such as Lex or Flex, are widely available.

Detailed explanation-4: -Which of the following software tool is parser generator? Explanation: YACC is a LALR parser. Explanation: The output of Lex is a string of tokens.

Detailed explanation-5: -YACC provides a tool to produce a parser for a given grammar. YACC is a program designed to compile a LALR (1) grammar.

There is 1 question to complete.