Development of a G-machine Based Translator for a Lazy Functional Programming Language Miranda

지연함수언어 Miranda의 G-기계 기반 번역기 개발

  • 이종희 (영남전문대학 전자계산기과) ;
  • 최관덕 (영남대학교 전산공학과 컴퓨터시스템전공) ;
  • 윤영우 (영남대학교 전산공학과) ;
  • 강병욱 (영남대학교 전산공학과)
  • Published : 1995.09.01

Abstract

This study is aimed at construction of a translator for a functional programming language. For this goal we define a functional programming language which has lazy semantics and develop a translator for it. The execution model selected is the G-machine-based combinator graph reduction. The translator is composed of 4 phases and translates a source program to a C program. The first phase of the translator translates a source program to a enriched lambda- calculus graph, the second phase transforms a lambda-calculus graph into supercombinators, the third phase translates supercombiantors to a G program and the last phase translates the G program to a C program. The final result of the translator, a C program, is compiled to an executable program by C compiler. The translator is implemented in C using compiler development tools such as TACC and Lex, under the UNIX environments. In this paper we present the design and implementation techniques for developing the translator and show results by executing some test problems.

본 연구는 함수언어의 번역기 개발을 목적으로 한다. 이를 위하여 지연어의를 갖 는 원시함수 언어를 정의하고 그것의 번역기를 설계, 구현, 평가한다. 함수프로그램의 실행모형은 G-기계를 기반으로 한 컴비네이터 그래프축소이다. 번역기는 전체 4단계로 구성되며 원시프로그램을 C를 사용한 목적프로그램으로 번역한다. 번역기의 첫 번째 단계에서는 원시프로그램을 확장람다계산 그래프로 번역하고, 두 번째 단계에서 수 퍼컴비네이터그래프로 변환하고, 세 번째 단계에서 G-기계어 프로그램으로 번역하고, 마지막 단계에서 G-기계어 프로그램을 C로 번역한다. 생성된 목적 프로그램은 C 컴파 일러에 의해서 실행 프로그램은 번역한다. 번역기 구현은 UNIX환경에서 컴파일러 자동 화 도구인 YACC, Lex를 이용하여 구문분석기, 어휘분석기를 구현하고, 그 외의 루틴은 C로 구현한다. 본 논문에서는 번역기에 사용된 구현기법과 수행결과를 기술한다.

Keywords