Abstract
We propose a systematic method of compiling Haskell based on the spineless Tagless G-machine (STGM) for the Java, Virtual Machine (JVM) We introduce an intermediate language called L-code to identify each micro-operation of the machine by its instruction, Each macro operation of the machine is identified by a binding Each instruction of the L-code can be easily translated into Java statements. After our determination on representation and L-code program from a STG program is translated into Java program according to out compilation rules. Our experiment shows that the execution times of translated benchmarks are competitive compared with those in Haskell interpreter Hugs, particularly when Glasgow Haskell compiler's STG -level optimizations are applied.
본 논문에서는 함수형 언어 Haskell 을 Java언어로 변환하여 Java Virtual Machine 에 수행하는 컴파일 방법을 제안한다. 이 컴파일 방법은 추상 기계 Spineless Tageless G-machine(STGM)을 수행 모델로 삼는다 L-code로 명명한 중간 언어를 도입하여 추상기계의 각각의 세부 동작을 이 언어의 명령어로 표현하고, 일견의 세부 동작들을 이 언어의 바인딩을 통해 표현한다. 각 명령어는 Java의 문장으로 변환하기 쉽도록 정의하였다. Java에서의 표현 방법을 결정하고. STS 프로그램의 L-code 프로그램으로의 컴파일 규칙과 Java 프로그램으로의 컴파일 규칙을 세안한다. 실험을 통해 제안한 컴파일러에 의해 Haskell 프로그램으로부터 생성된 Java 프로그램의 수행 성능은 Glasgow Haskell 컴파일러의 최적화 변환을 적용했을 때 기존의 Haskell 인터프리터인 Hugs와 대등함을 보인다