COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The output of scanner is
A
a stream of lexemes
B
a stream of tokens
C
an annotated parse tree
D
a three address code
Explanation: 

Detailed explanation-1: -Java Scanner tokens() Method The tokens() method of Java Scanner class is used to get a stream of delimiter-separated tokens from the Scanner object which are in using. This method might block waiting for more input.

Detailed explanation-2: -Scanner Generation Tools These tools normally work by taking the token definitions expressed by regular expressions and generates the source code for the scanner automatically (for this project, the tokens are especified in the language’s grammar). The programmer has to add the code to handle the scanner’s output.

Detailed explanation-3: -(1) The output of the lexical analyzer is tokens.

Detailed explanation-4: -next() method finds and returns the next complete token from this scanner. A complete token is preceded and followed by input that matches the delimiter pattern.

There is 1 question to complete.