컴파일러란

CJY·2023년 4월 13일
0

컴파일러

목록 보기
5/8

SW 어플리케이션을 동작하기 위해서는 하드웨어 전에 OS에게 이해할 수 있는 언어로 번역해주는 과정이 필요한데 이 때 필요한 것이 Interpreters와 compilers다

interpreter

a program that reads a source program and produces the results of executing that program

라인을 하나씩 읽어서 결과를 낸다. 따라서 루프문을 반복해서 분석하는 경향이 있지만 곧바로 실행 결과를 알 수 있어 디버깅과 상호작용에 유리하다.

종류

PERL, Python, Ruby, awk, sed, shells, scheme/Lisp/ML, postscript/pdf, java VM

particularly effective if interpreter overhead is low relative to execution cost of individual statements

compiler

a program that translates a program from one language (the source) to another (the target)

프로그램 전체를 읽고 분석한다.

하나의 언어로 작성된 프로그램을 다른 언어로 의미가 동일하게 (semantically equivalent) 해석한다. 아마 실행하기 더 쉽고 더 효율적이다. 코드의 효율성을 높일 수도 있다.

Tradeoff: compile time overhead(preprocessing step) vs execution performance

종류

FORTRAN, C, C++, Java, COBOL, etc.

optimization이 필요한 경우들

Hybrid

Java

  • java source를 바이트 코드로 컴파일하는 JVM
  • 실행
    • 바이트 코드를 곧바로 interpret
    • Compilie some or all byte codes to native code
      ex) Just-In-Time compiler(JIT) - detect hot spots, compile on the fly to native code standard these days
profile
열심히 성장 중인 백엔드

0개의 댓글