본문 바로가기
오래된 글

compilers chapter 1 exercises solution

by pagehit 2018. 10. 19.
반응형

1.1.1

What is the difference between a compiler and an interpreter?


컴파일러와 인터프리터의 차이는 무엇인가?


Answer

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 and report any errors in the source program that it detects during the translation process.


Interpreter directly executes the operations specified in the source program on inputs supplied by the user.


컴파일러는 소스 프로그램의 언어를 읽고 다른 언어로된 상응하는 프로그램으로 번역해준다. 그리고 소스 프로그램의 에러를 번역 과정 동안 감지하고 보고해준다.




1.1.2

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


컴파일러의 이점은 무엇이고, 인터프리터의 장점은 무엇인가?


Answer

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.


컴파일러에 의해 생성되는 기계언어 타겟 프로그램은 보통 인터프리터가 인풋을 아웃풋에 맵핑하는 방식보다 빠르다.


인터프리터는 보통 컴파일러 보다 에러를 진단하는데 더 좋다. 인터프리터가 소스 프로그램을 문장 단위로 실행하기 때문이다.




1.1.3

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


컴파일러가 기계 언어를 생성하는 것보다 어셈블리 언어를 생성하는 언어 처리 시스템에는 어떤 이점이 있는가?


Answer

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.


어셈블리 언어가 출력으로 생성하기가 더 쉽고 디버그에 용이하기 때문에 컴파일러는 어셈블리 언어 프로그램을 생성한다.




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 as a target language for a compiler?


컴파일러가 고급 언어를 또 다른 고급언어로 번역하는 것을 소스 간 번역기라고 부른다. C 언어를 컴파일러의 타겟 언어로 하면 좋은 점은 무엇인가?


Answer

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


C언어에 대한 이용가능한 컴파일러가 많으며, 거의 모든 하드웨어로 컴파일할 수 있다.




1.1.5

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


어셈블러가 수행해야하는 임무는 무엇인가?


Answer

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


어셈블리 언어로 부터 기계언어 코드를 만들어 준다. 이 기계 언어 코드는 relocatable 하다.

반응형

댓글