CHAPTER1

作者: 薛家四少 | 来源:发表于2016-04-01 16:09 被阅读0次

    Exercises Section 1.1.1

    Exercise 1.1.1: What's the difference between a compiler and an interpreter?

    • A compiler is a program that can read a program in one language -- the source language -- and translate it into an equivalent program in another language -- the target language. An important role of the compiler is to report any errors in the source program that it detects during the translation process.

    • An interpreter is another common kind of language processor. Instead of producing a target program as a translation, an interpreter appears to directly execute the operations specified in the source program on inputs supplied by the user.

    Exercise 1.1.2: What are the advantages of
    (a) a compiler over an interpreter
    (b) an interpreter over a compiler?

    • a. The machine-language target program produced by a compiler is usually much faster than an interpreter at mapping inputs to outputs.

    • b. An interpreter can usually give better error diagnostics than a compiler, because it executes the source program statement by statement.

    Exercise 1.1.3: What advantages are there to a language-processing system in which the compiler produces assembly language rather than machine language?

    • The compiler may produce an assembly-language program as its output, because assembly language is easier to produce as output and is easier to debug.

    Exercise 1.1.4: A compiler that translates a high-level language into another high-level language is called a source-to-source translator . What advantages are there to using C a target language for a compiler?

    • For the C language there are many compilers available that compile to almost every hardware.

    Exercise 1.1.5: Describe some of the tasks that an assembler needs to perform.

    • It translates from the assembly language to machine code. This machine code is relocatable.

    相关文章

      网友评论

          本文标题:CHAPTER1

          本文链接:https://www.haomeiwen.com/subject/vvjylttx.html