Improvement of LR Parser using Reduction Goals

리덕션 골을 이용한 LR 파서의 개선

  • Received : 2008.02.29
  • Accepted : 2008.03.24
  • Published : 2008.05.31

Abstract

The methodology of the compiler construction improved by well-defined parsing techniques and developments of automatic generation tools. Through them, a variety of compilers for the special applications can be developed effectively: particularly, the compiler for embedded/mobile devices. Also, as contents industry is proliferating recently, the necessity of developing a compiler which is suitable for contents system is highly increasing. These various demands can be resolved by modular techniques and automatic construction of compilers. But, optimization of compiler itself as development tools uses heuristic methods and it needs higher cost. In this paper, we suggest the parsing method which can decrease unnecessary reduce actions by analyzing the characteristics of LR parser. The suggested parsing technique uses lookahead/ states, reachable reduction goals information in parsing process and enhances the parsing efficiency by changing continuous reduce actions to one. Actually, we applied it to the front-end of ANSI C compiler and proved the parsing performance in terms of the number of reduce actions.

컴파일러의 구성 방법론은 파싱 기법의 정립과 자동화 도구의 개발을 통해 많은 발전을 이루었으며, 이를 통해 다양한 컴파일러를 효과적으로 제작할 수 있는 환경이 마련되었다. 특히, 최근에는 임베디드/모바일 기기의 사용과 콘텐츠 산업이 활성화되고 있으며, 이에 따라 각 시스템과 콘텐츠에 적합한 컴파일러 개발 요구가 늘어나고 있다. 컴파일러의 모듈화와 자동적인 구성을 통해 이러한 수적인 요구는 해결되고 있지만, 개발도구로서의 컴파일러를 최적화하기 위해서는 경험적인 방법론의 사용과 이에 따른 매우 큰 비용이 필요하다. 본 논문에서는 LR 파서의 특징을 분석하여, 불필요한 reduce 행동을 경감할 수 있는 파싱기법을 제시한다. 개선된 파싱 기법은 파싱과정에서 lookahead/상태 정보와 도달 가능한 리덕션 골의 정보를 이용하여 연속적인 reduce를 하나의 reduce로 변환하여 효율성을 높인다. 또한, 임베디드 ANSI C컴파일러의 전단부에 적용하여 실제 모바일 콘텐츠 대한 파싱 성능을 분석하였다.

Keywords