| Home | Trees | Index | Help |
|---|
| Package tp :: Package client :: Package pyscheme :: Module analyzer |
|
An analyzer that does syntactic analysis of an expression.
Danny Yoo (dyoo@hkn.eecs.berkeley.edu)
analyze() returns a function that can be evaluated just by calling it
with the environment and continuation. It's based (or bastardized,
depending on your perspective... *grin*) on material in Chapter 4.1.7
of Structure and Interpretation of Computer Programs:
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-26.html#%25_sec_4.1.7
This is slightly more complicated since I'm using continuation passing
style and trampolining to get around Python's call stack.
The core forms that the analyzer recognizes is the following:
self evaluating expressions
variable references
QUOTE
SET!
DEFINE
IF
LAMBDA
BEGIN
function application
Other special forms are handled by derivation: the expander module translates
the derived forms into these core forms.
FIXME: the analyzer itself is not in continuation passing mode. The
analyzed expressions that it produces do use CPS.
FIXME: quasiquotation hasn't been pushed off into the expander yet.
| Function Summary | |
|---|---|
analyze(exp) -> lambda env, cont: ... | |
analyzeApplication(exp)
| |
analyzeAssignment(exp)
| |
analyzeBegin(exp)
| |
analyzeDefinition(exp)
| |
analyzeIf(exp)
| |
analyzeLambda(exp)
| |
analyzeOperands(operands)
| |
analyzeQuoted(exp)
| |
analyzeSelfEvaluating(exp)
| |
analyzeSequence(exps)
| |
analyzeVariable(exp)
| |
Applies a procedure on a list of arguments. | |
applyContinuationProcedure(proc,
args)
| |
applyPrimitiveProcedure(proc,
args,
env,
cont)
| |
This version of eval calls analyze, and then texec()s it against the environment. | |
Executes each operand and constructs a new list. | |
texec applies the analyzedExpression against the environment. | |
| Variable Summary | |
|---|---|
str |
__license__ = 'MIT License'
|
| Function Details |
|---|
analyze(exp)analyze(exp) -> lambda env, cont: ... Given an expression, returns a new lambda function that can be applied on an environment and continuation. |
apply(procedure, arguments, env, cont)Applies a procedure on a list of arguments. |
eval(exp, env)This version of eval calls analyze, and then texec()s it against the environment. |
execRands(rands, env, cont)Executes each operand and constructs a new list. |
texec(analyzedExp, env, cont)texec applies the analyzedExpression against the environment. Trampolined by eval(), and will be used by primitives like EVAL and CALL/CC. |
| Variable Details |
|---|
__license__
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Fri Jan 1 08:00:27 2010 | http://epydoc.sf.net |