A Self-Hosting Evaluator using HOAS A Scheme Pearl
نویسنده
چکیده
We demonstrate a tiny, yet non-trivial evaluator that is powerful enough to run practical code, including itself. This is made possible using a Higher-Order Abstract Syntax (HOAS) representation — a technique that has become popular in syntax-related research during the past decade. With a HOAS encoding, we use functions to encode binders in syntax values, leading to an advantages of reflecting binders rather than re-implementing them. In Scheme, hygienic macros cover problems that are associated with binders in an elegant way, but only when extending the language, i.e., when we work at the meta-level. In contrast, HOAS is a useful object-level technique, used when we need to represent syntax values that contain bindings — and this is achieved in a way that is simple, robust, and efficient. We gradually develop the code, explaining the technique and its benefits, while playing with the evaluator.
منابع مشابه
Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages
We have built the first family of tagless interpretations for a higher-order typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically type-preserving interpretations include an evaluator, a compiler (or staged evaluator), a partial evaluator, and call-by-name and call-by-v...
متن کاملPEARL: A PErformance evaluAtor of cRyptographic aLgorithms for Mobile Devices
Limited computational power imposes new challenges during the implementation of security and privacy solutions for mobile devices. The choice for the most appropriate cryptographic algorithm for each mobile device has become a critical factor. In this paper, we present an approach for performance evaluation of cryptographic algorithms for mobile devices. To validate the approach, a tool called ...
متن کاملUsing an Evaluator Fixed Structure Learning Automata in Sampling of Social Networks
Social networks are streaming, diverse and include a wide range of edges so that continuously evolves over time and formed by the activities among users (such as tweets, emails, etc.), where each activity among its users, adds an edge to the network graph. Despite their popularities, the dynamicity and large size of most social networks make it difficult or impossible to study the entire networ...
متن کاملA Modified Reinforcement Learning Scheme For Controlling The Mean Arterial Pressure
The original reinforcement learning scheme comprises two networks, one performs a controller and the other stands for an evaluator. Based on temporal difference predictive techniques, the evaluative network predicts an external reinforcement signal and estimates a more informative internal signal to adapt a set of parameters of the controller. This paper introduces a modified reinforcement lear...
متن کاملPartial Evaluator as a Compiler for Re ective Languages
This paper presents an online partial evaluator with a mechanism to handle I/O-type side-e ects using preactions, and reports our experiment of using the partial evaluator as a compiler for the re ective language Black we are designing. Black is a Scheme-based re ective language, which allows user programs to access and modify its metalevel interpreter (or the language semantics) from within th...
متن کامل