This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Thursday, March 24, 2016

Discuss the capabilities of CFG

 The capabilities of CFG :  Context free grammars are capable of describing most of the syntax of programming language. suitable grammars for expressions can often be constructed using associatively & precedence information. So, context free grammar are most useful in describing nested structures such as balanced parentheses, matching begin-end's, corresponding if-then-else's & so on. These nested structures cannot be described by regular expression. The following grammars the string, which serves the language. Stat ...

What is CFG?Advantages of CFG

 Context Free Grammar :  A CFG is a way of describing language by recursive rules. A CFG consists four tuples, denoted G = {V, T, P,  S} Where,               V = Finite set of variables.  [Eg. {S, E}etc.]               T = Finite set of terminals.  [Eg. {a, b, c,+}etc.]               P = Finite set of productions.  [Eg. E E+E]              ...

What is drawback of operator precedence parsing?

Drawback of operator precedence parsing :  Difficult to find token from the operator precedence parsing. It is itself tenuous. One can't always be sure the parser accepts exactly the desired language. Only a small class of grammar can be using operator precedence techniques. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Context Free Grammar With Example?

 Context Free Grammar :  A CFG is a way of describing language by recursive rules. A CFG consists four tuples, denoted G = {V, T, P,  S} Where,               V = Finite set of variables.  [Eg. {S, E}etc.]               T = Finite set of terminals.  [Eg. {a, b, c,+}etc.]               P = Finite set of productions.  [Eg. E E+E]              ...

What are the differences between single pass & multi-pass compiler?

The differences between single pass & multi-pass compiler : Single Pass Compiler Multi-Pass Compiler 1. Single pass compiler can be made to use more space than multi-pass compiler 1. Multi - pass compiler can be made to use less space than a single -pass compiler 2. Single pass compiler is faster than a multi -pass compiler 2. Multi - pass compiler is slower than a single pass compiler because each pass reads & writes an intermediate file. ...

Translate the expression -

Translate the expression - -(a+b)*(c+d)+(a+b+c) into (ii) Quadruples At first we construct the three address code the above expression : Three address code : 0) T1 : = a+b 1) T2 : = -T1 2) T3 : = c+d 3) T4 : = T2*T3 4) T5 : = a+b 5) T6 : = T5+c 6) T7 : = T4+T6 SL NO OP ARG1 ARG2 RESULT (0) + a b T1 (1) uminus T1 - T2 (2) + c d T3 ...

Translate the following assignment statement A : = -B*(C+D) into three address, quadruple & triple forms

Translate the following assignment statement A : = -B*(C+D) into three address, quadruple & triple forms Here, given the expression - A: = -B*(C+D) Three-address code :     T1 : = -B T2 : = C+D T3 : = T1+T2 A : = T3 These statement are represented by quadruples as shown in fig . (a)  SL NO OP ARG1 ARG2 RESULT (0) Uminus B - T1 (1) + C D T2 ...

Briefly describes quadruples, triples in representation of three address statements. What ate the benefits of quadruples over triples in optimizing compiler?

Quardruples : Quadruples representation the three - address code by using four fields These are -                     OP, ARG1, ARG2 & RESULT. Implementation of quadruples : Let us consider the following three - address code :  T1 : = -B T2 : = C+D T3 : = T1+T2 A : = T3 These statement are represented by quadruples as shown in fig . (a)  SL NO OP ARG1 ARG2 RESULT ...

Find the postfix notation for the following expressions -

 (i) (a+b) - c & (ii) a - (b+c) (i) The postfix notation -     (a+b)-c                                                      = [ab+]-c                                                     ...

Discuss the purpose of the fields of an activation record

Discuss the purpose of the fields of an activation record Activation Code : Stack allocation collect fixed -storage by using activation record. The activation record contain the following steps -  Storage for simple name & pointers to array & other data structures local to the procedure. Temporaries for expression evaluation & parameter passing. Information regarding attributes for local names & formal parameters, when these cannot be determined at compile time. The return address. A portion to the activation record of...

Write a translation scheme for providing three -address code for Boolean expressions : "OR", "AND" and "NOT"

Write a translation scheme for providing three -address code for Boolean expressions : "OR", "AND" and "NOT" A OR B, A AND D, NOT D. So, the translation scheme becomes -  T1 : = A OR B T2 : = A AND D T3 : = NOT D. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Activation Code?

Activation Code : Stack allocation collect fixed -storage by using activation record. The activation record contain the following steps -  Storage for simple name & pointers to array & other data structures local to the procedure. Temporaries for expression evaluation & parameter passing. Information regarding attributes for local names & formal parameters, when these cannot be determined at compile time. The return address. A portion to the activation record of the caller. If You want to learn about the technology,...

What is Postfix notation/Reverse Polish notation With Example?

Postfix notation/Reverse Polish notation : It is the form of an expression obtained from postorder traversal of the tree representing this expression. So, in the postfix notation, operators must be placed after the operands.  Example :  AB+, CD*, GH/ . If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Prefix notation/Polish notation With Example?

Prefix notation/Polish notation : It is the form of an expression obtained from preorder traversal of the tree representing this expression. So, in the prefix notation, operators must be placed before the operands.  Example :  +AB, *CD, /GH If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is infix notation with example?

Infix notation : It is the form of an expression obtained from in order traversal of the tree representing this expression. So in the infix notation, Operators must be placed in the operands. Example :  A+B, C*D, /GH If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Intermediate Language with two properties?

Intermediate Language with two properties : - After syntax & semantic analysis the compiler generates an explicit intermediate representation of the source program. This, intermediate representation as a program for an abstract machine.  It has two properties -  It should be easy to produce & Easy to translate into the target program. The intermediate  code generates the intermediate language which is involve during code generation. If You want to learn about the technology, computer science & engineering, web...

What is Object Program?

Object Program : The output  of a code generator is the object program. This takes a variety of forms : an absolute machine - language program, a locatable machine - language program, an assembly -language program & other language program.  If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

Explain Syntax - Directed translation

Syntax - Directed translation  : Syntax - directed translation schemes to describe the output to generate for each input construct. A syntax - directed translation is merely a CFG in which a program fragment called an output action  ( or sometimes a semantic action or semantic rule) is associated with each production for example, suppose output action is, associated with production A tensto XYZ. The action is executed whenever the syntax analyzer recognizing in its input a sub - string w which has a derivation of the form A or ...

What is the way to represent 3-address code? Write down the advantage & disadvantage of quadruples over triples?

Three Address Code: Three address statements are a sequence of statements. Typically, the general form A : B op C, where A, & C are either programmer defined names. Constants or compiler - generated temporary names. Op stands for any operator, such as a fixed or floating -point arithmatic operator or a logical operator on Boolean -valued data. Three address statements usually contain  three addresses, two for the operands & one for the result. Example : Let us consider the expression A : = -B*(C+D). We get the following...

Define different types of translation with example

 Different types of translation with example :  A translation is an input/output mapping. Generally three types of translation scheme are used - Three Address Statements Quadruples & Triples Three Address Statements : Three address statements are a sequence of statements. Typically, the general form A : B op C, where A, & C are either programmer defined names. Constants or compiler - generated temporary names. Op stands for any operator, such as a fixed or floating -point arithmatic operator or a logical operator...

Wednesday, March 23, 2016

What is Suffix?

Suffix : A Suffix of a string is any number of trailing symbols of that string. Example : String abc has suffix - epsilon, c, bc, ab...

What is Prefix?

Prefix : A prefix of a string is any number of leading symbols of that string. Example : String abc has prefix - epsilon, a, bc, ab...

What is String(Word)?

String(Word) : A string (word) is a finite sequence of symbols of that string . Example : abc, 01110 are the examples of string If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Symbol?

Symbol : A symbol is an abstract entity set we shall not define formally; just an point & line are not defined in geometry. Example :  Letter & digits are examples of symbol. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Lexema?

 Lexema : A lexema is a sequence of characters in the source program that is matched by the pattern for a token. Example : For Pascal statement -  Cons pi = 3.1416; Here, the sub-string pi is a lexema for the token "identifier." If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Token?

Token : The string representing a program can be partitioned at the lowest level into a sequence of sub-string called tokens. Each token is a sequence of characters whose significant is possessed collectively rather than individually. Example : Generally, these are used as tokens -  Constants, e.g. 1.2.3.4. Operator symbols, e.g. +,-,*.EQ, Identifiers e.g. A, H2035B, SPEED, Keywords e.g, IF, GOTO, SUBROUTINE. Punctuation symbols, e.g. parenthesis, brackets, coma & semicolon. If You want to learn about the technology, computer...

What is Regular Expression? Properties of regular expression

Regular Expression : The language accepts by finite automata are easily described by simple expression called regular expression. Regular expression operators are union , concatenation & closure/star. Properties of regular expression :  Faka Set is a regular expression & denotes the empty set.  Epsilon  is regular expression & denotes the set {Epsilon}         For each a in . a is a regular expression & denotes the set {a}.If r & s are regular expressions denoting...

Using suitable block diagram shows the different phases of a compiler & briefly describes the phases.

Using suitable block diagram shows the different phases of a compiler & briefly describes the phases. Or,Describe the function of the five main component of compiler. A compiler operates in phases, each of which transform the source program from one representation to another. Generally, these are six types of phases in compiler. These are - Lexical Analysis Syntax Analysis Semantic Analysis Intermediate code generation Code Optimization Code Generation Lexical Analysis : Linear Analysis  is called lexical analysis or scanning....

What is Interpreter?

Interpreter :  Interpreter is kinds of translator that translates & execute each source language statement before translating & executing next one but don't produce an object program. Interpreter are frequently used to execute command language. Since each operator executed in a command language is usually an invocation of a complex routine such as high level language. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What is Assembler?

Assembler : Assembly code is passed to an assembler for further processing that is, if the source language is assembly language language & the target language is machine language, Then the translator is called assembler. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOL...

What are the properties that good error detection & diagnostic should have?

The properties that good error detection & diagnostic should have :  Good error diagnostic can significantly help reduce debugging & maintenance effort. These are the properties of good error detection & diagnostic -  The message should pinpoint the errors  of the original source program. Rather than in terms of some internal representation that is totally mysterious to the user. The error message should be tasteful & understandable by the user. If You want to learn about the technology, computer science &...

From a compiler a designer point of view, what are the source of errors in compiler?

From a compiler a designer point of view,  the source of errors in compiler : There are many sources to occur error. These are the source of errors in compiler- At the very onset, the design specifications for the program may be inconsistent or faulty. The algorithms are incorrect or inadequate (algorithmic errors). The programmer may introduce error in implementing the algorithm - such as logical errors or coding error. Key punching or transcription errors can occur when the program is types on to cards or into a file. The program may...

Write the advantages of high -level language

The advantages of high -level language :     These are the advantages of high level language- Ease of understanding Naturalness Portability & Efficiency of use Ease of understanding : - A high level language program is generally easier to read. Write & prove correct than is an assembly language program. Naturalness : Much of the understanding of a high - level programming language comes from the ease with which one can express an algorithm in that language. Portability : - User often be able to run their...

Write the necessary/motive of compiler

 The necessary/motive of compiler : A compiler is a program that reads a program written in one language - the source language & translates it into an equivalent program in another language - the target language. So, the main motive of compiler that if reports to its user the presence of errors in the source program. A compiler can also assist in producing reliable program. For Example, a compiler could check that the types of operands are compatible. Compiler can also acts as index by using symbol table. Some compiler makes...

Tuesday, March 22, 2016

Write some advantages & limitations of parses

Write some advantages & limitations of parses. Pass: When one or more phases are combined into a module then the module is referred as pass. A pass is  read the source program to the output of the previous pas, makes the transformations specified by its phases & writes output into an intermediate file. Advantages :  Reduced memory space. Requires less time. Limitations of parses :-  The interface between the lexical & syntactic analyzer can often be limited to a single token. It is very hard to perform...

What is intermediate code? Why it is necessary in compiler?

 Intermediate Code : After syntax & semantic analysis the compiler generates an explicit intermediate representation of the source program. thsi, intermediate representation as a program for an abstract machine. It has two properties- It should be easy to produce & Easy to translate into the target program.  Necessary in compiler: To generate machine/assembly language  To create stream of simple instructios after syntax analysis. If You want to learn about the technology, computer science & engineering, web...

What are the types of errors found in different phases of compiler?

The types of errors found in  different phases of compiler- The lexical analyzer may be unable to proceed because the next token in the source program is misspelled. The syntaxb analyzer may be unable to infer structure for its input because a syntatic error such as a missing parenthesis has occured. The intermediate code generation detects an operator whose operands have incompatible types. The code optimizer, doing control flow analysis, may detect that certain statements can never be reached. The code generator may find a compiler...

Describe the main problem in code generation

 The main problem in code generation:   There are three main  problems occur in code generation. They are-  Deciding what machine instructions to generate. Deciding in what order the computations should be done. Deciding which register to use. What instructions should we generate? Most machines permit certain computations to be done in a variety of ways. For Example: The target machine has an "add-one-to-storage" instruction (AOS), then for the three-address statement A : = A+1. We might generate the signal...

What is a DAG for basic blocks? Construct the DAG for the following basic blocks

What is a DAG for basic blocks? Construct the DAG for the following basic blocks DAG(Directed acyclic graph):   A Directed acyclic graph is a graph with no cycles which gives a picture of how the value computed by each statement in a basic block is used in subsequent statement in the block . That is,  a DAG has node for every sub-expression of the expression. An interior node represents n operator & its child represents an operand. DAG is mainly used to identify the same expression. Example:  Let us the following...

Describe primary structure-preserving transformations on basic blocks

Describe primary structure-preserving transformations on basic blocks Primary structure-preserving transformations on basic blocks- Common sub-expression elimination  Dead-code elimination Renaming of temporary variable Interchanging of two independent-adjacent statements. Common sub-expression elimination:  Consider the basic block- a : = b+c        c : = b+c b : = a-d         d : = a-d The 2nd and fourth statements compute same expression namely b + c -...

What do you understand by dead elimination?

Dead elimination:   A variable is live at a point in a program if its value can be used subsequently. Otherwise it is dead at that point. Let us a variable x is dead. That is, never subsequently used, at the point where the statement x : = y + z appears in a basic block. Then this statement may be safely removed without changing the value of the basic block. If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

Write the major issues in the design of a code generator?

The major issues in the design of a code generator There are some major issues in the design of a code generator. They are - Memory Management Instruction selection Register allocation Evaluation order If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

What are the advantages of generating intermediate code?

The advantages of generating intermediate code  Intermediate Code Generation:   After syntax & semantic analysis the compiler generates an explicit intermediate representation of the source program. To implement intermediatecode such as - It should be easy to produce & Easy to translate into the target program Retargeting is faciliated. Finally, the representation of intermediate code is directly executed using a program, which is referred to as interpreter. If You want to learn about the technology, computer science...

Basic Blocks

Basic Blocks: A basic block is a sequence of consecutive statement in which flow of control enters at the beginning & leaves at the end without halt or possibility of branching except at the end of the basic block.  The following sequence of three address statement form a basic block which is shown: If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...

DAG(Directed acyclic graph)

DAG(Directed acyclic graph):   A Directed acyclic graph is a graph with no cycles which gives a picture of how the value computed by each statement in a basic block is used in subsequent statement in the block . That is,  a DAG has node for every sub-expression of the expression. An interior node represents n operator & its child represents an operand. DAG is mainly used to identify the same expression. Example:  Let us the following expression-        a + a*(b-c)+(b-c)*d. DAG for...