Return to search

以型態推演技術製作AspectFun語言編譯器 / Implementing a Type-Directed Translator for AspectFun

AspectFun是一個實驗性的剖面導向函式語言,它主要的特色在於具備能以靜態織入方式實現的多型剖面、高階剖面以及依據動態流程觸發的剖面。 本論文提出一個AspectFun語言的編譯器,其編譯過程分為四個主要步驟:語法結構轉換、剖面織入、剖面轉函式與整合動態流程判斷資訊。其中剖面織入是最複雜的步驟,必須仰賴可能是多型的型態資訊,選取適當的剖面整合到程式指定的切點處。這部份的織入工作,我們的編譯器是依據一套以靜態型態推論規則發展而來的轉譯規則,先將AspectFun程式轉譯成的剖面與函式整合在一起的中介格式,再翻譯為可執行的Haskell程式來完成。此外,本系統也是使用Haskell程式語言開發,並採用Monad技術將系統模組化,以達到最佳的可維護性、擴充性與閱讀性。本論文介紹系統的實作面,解釋AspectFun系統架構、語法、原理和實作帶來的貢獻以及限制。 / AspectFun is an experimental aspect-oriented functional language. Its main features include polymorphic aspects via static weaving, second-order aspects and control-flow triggered aspects. This thesis presents a type-directed compiler for AspectFun. Our compilation processes consists of four major steps: syntax de-sugaring, aspect weaving, translating aspects to normal functions, and integrating control flow information. The most complicated one is aspect weaving. Due to polymorphism in aspects, it is completely dependent on type information inferable from the aspects and the context they are used. We base our weaving step on a set of type-directed translation rules. In particular, the weaving step is further divided into two stages. First, an AspectFun program is translated into an intermediate form in which all aspects applicable at a context are chained together and integrated with context. Second, all aspects are translated into ordinary functions and any chain of aspects are transformed to a sequence of function calls in as an executable Haskell program. Moreover, the complier itself is implemented in Haskell. We fully utilize the monad mechanism of Haskell to modularize our compiler and achieve the goals of good maintainability, extensibility and readability.

Identiferoai:union.ndltd.org:CHENGCHI/G0094753003
Creators陳忠信, Chen, Chung Hsin
Publisher國立政治大學
Source SetsNational Chengchi University Libraries
Language中文
Detected LanguageEnglish
Typetext
RightsCopyright © nccu library on behalf of the copyright holders

Page generated in 0.0019 seconds