COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
a stream of lexemes
|
|
a stream of tokens
|
|
an annotated parse tree
|
|
a three address code
|
Detailed explanation-1: -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: -public Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream. Bytes from the stream are converted into characters using the underlying platform’s default charset. Example: The method input on this constructor is InputStream.
Detailed explanation-3: -A scanner is a language processor component that transforms an input program, P, from a sequence of characters into a sequence of tokens. If illegal tokens are encountered, an exception is thrown. There are programs such as Lex that can generate scanners from regular expressions.