口译员的环境是什么? [英] What is environment for an interpreter?
本文介绍了口译员的环境是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在上一门名为《编程语言原理》的课程.它介绍了一个简单的解释器的设计.
I'm taking a course named Programming Language Principles. It introduces design of a simple interpreter.
gere的解释器的一个单独的代码:
And gere's one piece code of this interpreter:
(define valof
(lambda (exp env)
(dmatch exp
[,sym (guard (symbol? sym)) (env sym)]
... )))
我想知道翻译器中的环境是什么.
I want to know what is environment in an interpreter.
推荐答案
在像您正在使用的解释器中,环境是将值与变量名相关联的对象.通常,它是一个框架列表,每个框架都是一个变量绑定列表.
In an interpreter like the one you're looking at, the environment is the object that associates values with variable names. Typically it is a list of frames, and each frame is a list of variable bindings.
看看 计算机程序的结构和解释 ,用于讨论评估者如何使用环境.
Take a look at Structure and Interpretation of Computer Programs for a discussion of how an evaluator uses an environment.
这篇关于口译员的环境是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文