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.

This is default featured slide 2 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.

This is default featured slide 3 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.

This is default featured slide 4 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.

This is default featured slide 5 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  if cond then stat
        | if cond then stat else stat
        |other -stat.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

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]
              S = Start symbol. 
Example :
                    Let a CFG which is given :
Here, V = {E}
T = {+, *, id}
S = E
So, the grammar notation is written as;  G = (E, {+, *, id}, P, E) 
Advantages of context free grammar : 
  • A grammar give a precise, yet easy to understand, syntactic specification of a programming language.
  • An efficient parser can be constructed automatically from a properly designed grammar.
  • A grammar imparts a structure to a program that is useful for its translation into object code for the detection of errors.
  • Language ecvolved over a period of time.acquiring new constructs & performing additional tasks.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

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 SOLVE

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]
              S = Start symbol. 
Example :
                    Let a CFG which is given :
Here, V = {E}
T = {+, *, id}
S = E

So, the grammar notation is written as;  G = (E, {+, *, id}, P, E)
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

What are 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.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

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
(3) * T2 T3 T4
(4) + a b T5
(5) + T5 c T6
(6) + T4 T6 T7

Fig. (a) quadruple.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

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
(2) * T1 T2 T3
(3) := T3 - A

Fig. (a) quadruple representation of three -address statements.


 These statement are represented by triples as shown in fig . (b) 


SL NO OP ARG1 ARG2
(0) Uminus B -
(1) + C D
(2) * (0) (1)
(3) := A (2)

Fig. (b) triple representation of three -address statements.

If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE