Download presentation
Presentation is loading. Please wait.
1
Homework #1 J. H. Wang Oct. 5, 2015
2
Homework #1 Chap.1 1.8 1.13 Chap.2 2.1 (c) 2.2 (a) 2.7 2.11
3
Chap.1 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?
4
1.13: Many computer systems provide an interactive debugger (for example, gdb or dbx) to assist users in diagnosing and correcting runtime errors. Although a debugger is run long after a compiler has done its job, the two tools still must cooperate. What information (beyond the translation of a program) must a compiler supply to support effective runtime debugging?
5
Chap.2 2.1(c): Based on the grammar in Figure 2.1, construct the parse tree for the following input: (c) i x i y x=x-y p y 2.2: For the above input in Exercise 2.1(c), (a) Construct the input’s AST.
6
2. 7: The recursive-descent code shown in Figure 2
2.7: The recursive-descent code shown in Figure 2.7 contains redundant tests for the presence of some terminal symbols. How would you decide which ones are redundant?
7
2.11: Figure 2.6 scans an input stream for an inum or fnum based on the regular expressions for those patterns shown in Figure 2.3. The code in Figure 2.6 does not check for errors. (a) Where could errors occur in Figure 2.6? (b) For each error, what action would you take should the error occur?
8
Submission Submission Due: two weeks (Oct. 19, 2015)
Hand-written exercises: hand in your paper version in class Programming exercises: to be announced Due: two weeks (Oct. 19, 2015)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.