homework 1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Homework #1 PowerPoint Presentation
Download Presentation
Homework #1

Loading in 2 Seconds...

play fullscreen
1 / 8

Homework #1 - PowerPoint PPT Presentation

  • Uploaded on

Homework #1. J. H. Wang Oct. 4, 2011. Homework #1. Chap.1 1.8 1.11 Chap.2 2.1 (a) 2.2 (a) 2.4 2.5 (a). Chap.1

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Homework #1' - blake

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
homework 1

Homework #1

J. H. Wang

Oct. 4, 2011

homework 11
Homework #1
  • Chap.1
    • 1.8
    • 1.11
  • Chap.2
    • 2.1 (a)
    • 2.2 (a)
    • 2.4
    • 2.5 (a)
    • 1.8: Most programming languages, such as C and C++, are compiled directly into the machine language of a “real” microprocessor (for example, an Intel x86 or Sparc). Java takes a different approach. It is commonly compiled into the machine language of the JVM. The JVM is not implemented in its own microprocessor, but is instead interpreted on some existing processor. This allows Java to be run on a wide variety of machines, thereby making it highly platform independent.Explain why building an interpreter for a virtual machine like the JVM is easier and faster than building a complete Java compiler. What are the disadvantages of this virtual machine approach?
1.11: C is sometimes called the universal assembly language in light of its ability to be very efficiently implemented on a wide variety of computer architectures. In light of this characterization, some compiler writers have chosen to generate C code as their output instead of a particular machine language. What are the advantages to this approach to compilation? Are there any disadvantages?
    • 2.1(a): Based on the grammar in Figure 2.1, construct the parse tree for the following input:(a) i x x=100 x=x+30+1 p x
    • 2.2: For the above input in Exercise 2.1(a), (a) Construct the input’s AST.
2.4: The CFG shown in Figure 2.1 defines the syntax of ac programs. Explain how this grammar enables you to answer the following questions.(a) Can an ac program contain only declarations (and no statements)?(b) Can a print statement precede all assignment statements?
2.5: Sometimes it is necessary to modify the syntax of a programming language. This is done by changing the CFG that the language uses. What changes would have to be made to ac’s CFG (Figure 2.1) to implement the following changes?(a) All ac programs must contain at least one statement.
  • Submission
    • Hand-written exercises: hand in your paper version in class
    • Programming exercises: to be announced
  • Due: two weeks (Oct. 18, 2011)