Professional Documents
Culture Documents
Sample Questions: Subject Name: Semester: VI
Sample Questions: Subject Name: Semester: VI
Computer Engineering
4. They normally interact with the system via the user interface provided by the
application software.
Option A: Programmers
Option B: Developers
Option C: Users
Option D: Testers
9. Instructions which won’t appear in the object program are called as _____
Option A: Redundant instructions
Option B: Exceptions
Option C: Mnemonic opcode
Option D: Assembler Directives
Shift Reduce parser attempts for the construction of parse in a similar manner
as done in bottom-up parsing i.e. the parse tree is constructed from
leaves(bottom) to the root(up). A more general form of the shift-reduce parser is
the LR parser.
This parser requires some data structures i.e.
• An input buffer for storing the input string.
• A stack for storing and accessing the production rules.
Basic Operations –
• Shift: This involves moving symbols from the input buffer onto the stack.
• Reduce: If the handle appears on top of the stack then, its reduction by using
appropriate production rule is done i.e. RHS of a production rule is popped
out of a stack and LHS of a production rule is pushed onto the stack.
• Accept: If only the start symbol is present in the stack and the input buffer is
empty then, the parsing action is called accept. When accepted action is
obtained, it is means successful parsing is done.
• Error: This is the situation in which the parser can neither perform shift action
nor reduce action and not even accept action.
Example 1 – Consider the grammar
S –> S + S
S –> S * S
S –> id
Perform Shift Reduce parsing for input string “id + id + id”.
Explain the different forms of intermediate codes used by Compiler.
Types of Loader :-
There are eight(8) general loader schemes available. But
generally main loader scheme is four(1,2,3,4). Those are –
1. Absolute Loader.
2. Relocating Loader.
3. Direct Linking Loader.
4. Dynamic Loader.
5. Assemble – and – go or Compile – and – go loader.
6. Boot Strap Loader.
7. Linking Loader.
8. Relocation Loader.
Explain the working of absolute loader.
What do you mean by relocation? Explain relocating loader in detail.
Explain the difference between linking loader and linkage editor.
Explain the working of compiler phases for following expression Position = initial + rate * 60.
Explain the role of finite automata in lexical analysis
Design DFA for given finite automata. (a+b)*abb
Differentiate between top down and bottom up parser.
Define synthesized and inherited attributes used in Syntactic analysis of compiler.
Generate three address code for the following logical expression. If a<b then 1 else 0
LEX
-Lex is officially known as a "Lexical Analyser".
-Its main job is to break up an input stream into more usable elements. Or in, other words, to
identify the "interesting bits" in a text file.
-For example, if you are writing a compiler for the C programming language,
the symbols { } ( ); all have significance on their own.
-The letter a usually appears as part of a keyword or variable name, and is not interesting on
its own.
-Instead, we are interested in the whole word. Spaces and newlines are completely
uninteresting, and we want to ignore them completely, unless they appear within quotes "like
this"
-All of these things are handled by the Lexical Analyser.
-A tool widely used to specify lexical analyzers for a variety of languages
-We refer to the tool as Lex compiler, and to its input specification as the Lex language.
YACC
-Yacc is officially known as a "parser".
-It's job is to analyse the structure of the input stream, and operate of the "big picture".
-In the course of it's normal work, the parser also verifies that the input is syntactically sound.
-Consider again the example of a C-compiler. In the C-language, a word can be a function
name or a variable, depending on whether it is followed by a (or a = There should be exactly
one } for each { in the program.
-YACC stands for "Yet another Compiler Compiler". This is because this kind of analysis of
text files is normally associated with writing compilers.