Reflection in Direct Style

Reflection in Direct Style
复制标题

直接风格的反思

DOI:
10.1145/2047862.2047882
复制
发表时间:
2012
期刊:
Generative Programming and Component Engineering
影响因子:
--
通讯作者:
Kenichi Asai
Kenichi Asai
中科院分区:
--
文献类型:
--
作者:
藤井貴啓;上野雄大;森畑明昌;大堀淳;高橋俊彦;Tetsuya Kanda;Kenichi Asai

文献摘要

相似文献

反射语言使我们能够在同一语言框架内访问、检查和/或修改语言语义。虽然语义暴露的程度因语言而异,但最强大的方法(称为行为反射)暴露了定义用户程序行为的整个语言语义(或语言解释器),以供用户检查/修改。在本文中,我们处理的功能语言计划的上下文中的行为反射。特别是,我们将展示如何构建一个反射解释器,其中用户程序由元环解释器的塔进行解释,并有能力在执行过程中更改解释器的任何部分。它的显着特点相比,以前的工作是,由用户观察到的元级解释器直接写的风格。本文在前人工作的基础上,通过对连续标架顶部的去功能化和检查,解决了水平位移异常。由此产生的系统使我们能够自由地向上和向下的水平和访问/修改直接风格的元级解释器。这与以前的系统形成对比,在以前的系统中,元级解释器是以连续传递风格(CPS)编写的,并且只有CPS函数可以暴露给用户进行修改。
A reflective language enables us to access, inspect, and/or modify the language semantics from within the same language framework. Although the degree of semantics exposure differs from one language to another, the most powerful approach, referred to as the behavioral reflection, exposes the entire language semantics (or the language interpreter) that defines behavior of user programs for user inspection/modification. In this paper, we deal with the behavioral reflection in the context of a functional language Scheme. In particular, we show how to construct a reflective interpreter where user programs are interpreted by the tower of metacircular interpreters and have the ability to change any parts of the interpreters during execution. Its distinctive feature compared to the previous work is that the metalevel interpreters observed by users are written in direct style. Based on the past attempt of the present author, the current work solves the level-shifting anomaly by defunctionalizing and inspecting the top of the continuation frames. The resulting system enables us to freely go up and down the levels and access/modify the direct-style metalevel interpreter. This is in contrast to the previous system where metalevel interpreters were written in continuation-passing style (CPS) and only CPS functions could be exposed to users for modification.