Imp questions Cc

 Q1)Define the term lexeme.

Ans:-Lexemes are the character strings assembled from the character stream of a program.


Q2)List the phases of compiler.

Ans:-•Lexical Analysis.

•Syntactic Analysis or Parsing.

•Semantic Analysis.

•Intermediate Code Generation.

•Code Optimization.

•Code Generation.


Q3)Define Cross compiler?

Ans:-A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running.


Q4)State any two functions of lex library.

Ans:-Invokes the lexical analyzer by calling the yylex subroutine. Returns the value 1 when the end of input occurs. Appends the next matched string to the current value of the yytext array rather than replacing the contents of the yytext array.


Q5)Define SDD(Syntax Directed Definations).

Ans:-A context-free grammar in which. each grammar symbol X is associated with two finite sets of values.


Q6)Which parser is most powerful parser in bottom up parser?

Ans:-LR Parser.


Q7)Define the term Bootstrapping.

Ans:-Bootstrapping is the technique for producing a self-compiling compiler.


Q8)What is handle pruning?

Ans:-The process of identifying handles and reducing them to the appropriate left most non-terminals.


Q9)Define annotated parse tree?

Ans:-AN ANNOTATED PARSE TREE is a parse tree showing the values of the attributes at each node.


Q10)Compute the FIRST and FOLOW of the following grammer.

S->(T)|a|^

T->T,SIS

Ans:-


Q11)Define S-Attributed?

Ans:-An SDD is S-attributed if every attribute is synthesized. 


Q12)Define the Term Attribute Grammer?

Ans:-Attribute grammar is a special form of context-free grammar where some additional information (attributes) are appended to one or more of its non-terminals in order to provide context-sensitive information.


Q13)What is the use of dependency graph?

Ans:-To show the flow of information among attribute instances within a parse tree.


Q14)List the Different tyes of conflicts that occur in LR parser.

Ans:-shift-reduce conflict (SR conflict) and another is reduce – reduce conflict (RR) conflict.


Q15)Which parser is most powerful parser in bottom up parser.

Ans:-LR Parser.


Q16)List any two Lex library function.

Ans:-(1)main():- Invokes the lexical analyzer by calling the yylex subroutine.

(2)yywrap() :-Returns the value 1 when the end of input occurs.

(3)yymore() :-Appends the next matched string to the current value of the yytext array rather than replacing the contents of the yytext array.


Q17)What is the use of lookhead pointer?

Ans:-It allows to peek ahead, so to read and evaluate a portion of the input stream without actually forwarding the location of the stream.


Q18)What is the Output of lexical Analysis?

Ans:-coverts character sequences to set of tokens.


Q19)State three section of lex program.

Ans:-A lex program consists of three sections: a section containing definitions, a section containing translations, and a section containing functions.


Q20)Define compiler.

Ans:-A compiler is a special program that translates a programming language's source code into machine code, bytecode or another programming language.

Comments

Popular posts from this blog

WT slip tybcs21to30

Wt slip tybcs11to 20

Java