Ask Experts Questions for FREE Help !
Ask
    Leo_645's Avatar
    Leo_645 Posts: 1, Reputation: 1
    New Member
     
    #1

    Nov 13, 2008, 04:07 AM
    Compiler Questions
    1. How can a multi-pass compiler can be reduced to a single pass compiler?Explain.


    2. In the statement IF<expr> THEN statement ENDIF,explain the syntax,static semantics and execution semantics.


    3.Suppose for a moment that c++ did not permit multiple inheritance.In other words,assume that each class can only inherit from one or no other.Describe a scheme for laying out memory at runtime that will enable a compiler to compile such classes.
    In your scheme,describe the solutions to the following problems:
    1.) Where to put additional data object in a derived class.
    2.) How to handle non-virtual functions.
    3.) How to handle virtual functions,inclusing problems due to redefinition in derived classes.



    4. Generate the three-address codes and quadruples for the following c program segment.Assume that two bytes are required to store each element of the array

    sum=0;
    p=0;
    while(p<=20){
    sum=sum+x[p];
    p=p+1;
    }



    5. Explain with an example the simple translation scheme for an assignment statement.


    6. In the statement a=b+c*d,explain what is the syntax,the static semantics and execution semantics.


    7. Construct a non-deterministic finite automata(NFA) for recognizing the following tokens.

    a) a(aa)*
    b) (a+b)*a
    convert the NFA to an equivalent DFA and make the token recognized by each state of DFA.


    8. If a well designed symbol table had a total capacity of around 18,000 and currently contained 10,000 randomly chosen identifiers,approx. how many comparisons would most likely be needed to locate a single identifier inth etable.


    9. Construct the parsing table for the following LL(1) grammar
    S (arrow sign) aA/B
    A (arrow sign) bB/a
    B (arrow sign) c/bAc


    10.Generate code for the following c program
    main()
    {
    int p;
    int x[10];
    while(p<=10)
    x[p]=0;
    }


    11. Construct the directed acyclic graph for the following basic block
    d=b*c
    e=a+b
    b=b*c
    a=e-d



    12. Which phase of the compiling process would be expected to be the first discover an error in the following program and why?


    int mail@(){return 0;}


    13. Factor loop-invariant expressions in the following loop

    while(x>y){
    sub=x*Is+d/e;
    b[sub]=(a-c)*(x-y);
    x--;
    }

    14.Three advantages and disadvantages of single pass compiler and multi compiler.
    Curlyben's Avatar
    Curlyben Posts: 18,514, Reputation: 1860
    BossMan
     
    #2

    Nov 13, 2008, 04:16 AM
    Thank you for taking the time to copy your homework to AMHD.
    Please refer to this announcement: Ask Me Help Desk - Announcements in Forum : Homework Help

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Are You Pregnant Or Think You Are? Have Questions? Post New Questions Here.. [ 21 Answers ]

Hi and welcome to the forum. If you think you might be pregnant, or are pregnant, post your questions here, as the other thread is getting so large that it's hard to keep them organized. Also, if you are a teen and have questions and/or fears, let us know and we'll help as best as we can, or find...

Name of Compiler by which I can run Mobile Programme in Computer [ 1 Answers ]

Hi I am java Programmer I know java language ,now I want to a programme which I can Run in my Mobile Nokia N70,so which compiler should I have to use to construct the programme .

C++ programing compiler [ 8 Answers ]

Does anyone know where I can find a free or really cheap programin g compiler?


View more questions Search