kawa.lang
public class Translator extends Compilation
| Field Summary | |
|---|---|
| LambdaExp | curMethodLambda |
| Macro | currentMacroDefinition Set if we're processing (as opposed to expanding)
a define-syntax or defmacro. |
| int | firstForm |
| Stack | formStack |
| Declaration | matchArray A variable to hold the matched values for syntax-case
pattern variables. |
| PatternScope | patternScope Innermost current scope of pattern variable,
from a syntax-case. |
| Object | pendingForm |
| Declaration | templateScopeDecl |
| Constructor Summary | |
|---|---|
| Translator(Language language, SourceMessages messages) | |
| Method Summary | |
|---|---|
| Declaration | define(Object name, SyntaxForm nameSyntax, ScopeExp defs) |
| Type | exp2Type(Pair typeSpecPair) Extract a type from the car of a pair. |
| void | finishModule(ModuleExp mexp) |
| Syntax | getCurrentSyntax() |
| Environment | getGlobalEnvironment() |
| boolean | isLexical(Declaration decl) Return true if decl is lexical and not fluid. |
| static int | listLength(Object obj) Returns the length of a syntax list.
|
| Declaration | lookup(Object name, int namespace) |
| Declaration | lookupGlobal(Object name) Find global Declaration, creating one if not found. |
| Declaration | lookupGlobal(Object name, int namespace) Find global Declaration, creating one if not found. |
| Expression | makeBody(int first, ScopeExp scope) Combine a list of zero or more expression forms into a "body". |
| static Pair | makePair(Pair pair, Object car, Object cdr) |
| Declaration | makeRenamedAlias(Declaration decl, ScopeExp templateScope) |
| Declaration | makeRenamedAlias(Object name, Declaration decl, ScopeExp templateScope) |
| boolean | matches(Object form, String literal) True iff a form matches a literal symbol. |
| boolean | matches(Object form, SyntaxForm syntax, String literal) |
| Symbol | namespaceResolve(Expression context, Expression member) |
| Object | namespaceResolve(Object name) |
| void | noteAccess(Object name, ScopeExp scope) Note that we reference name in a given scope.
|
| Expression | parse(Object input) |
| Object | popForms(int first) |
| void | popPositionOf(Object saved) Restore line number position from a previous pushPositionOf. |
| void | popRenamedAlias(int count) Remove one or more aliases created by pushRenamedAlias. |
| void | processAccesses() Check references recorded by noteAccess.
|
| Object | pushPositionOf(Object pair) Note current line number position from a PairWithPosition.
|
| void | pushRenamedAlias(Declaration alias) Push an alias for a declaration in a scope.
|
| void | resolveModule(ModuleExp mexp) |
| Expression | rewrite(Object exp)
Re-write a Scheme expression in S-expression format into internal form. |
| Expression | rewrite(Object exp, boolean function)
Re-write a Scheme expression in S-expression format into internal form. |
| void | rewriteBody(int first) |
| void | rewriteInBody(Object exp) |
| Expression | rewrite_body(Object exp)
Re-write a Scheme in S-expression format into internal form. |
| Expression | rewrite_car(Pair pair, SyntaxForm syntax) |
| Expression | rewrite_car(Pair pair, boolean function) |
| Expression | rewrite_pair(Pair p, boolean function) |
| Expression | rewrite_with_position(Object exp, boolean function, PairWithPosition pair) |
| static Object | safeCar(Object obj) |
| static Object | safeCdr(Object obj) |
| Object | scanBody(Object body, ScopeExp defs, boolean makeList) Recursive helper method for rewrite_body.
|
| void | scanForm(Object st, ScopeExp defs) |
| void | setCurrentScope(ScopeExp scope) |
| static void | setLine(Expression exp, Object location) |
| static void | setLine(Declaration decl, Object location) |
| void | setLineOf(Expression exp) Set the line position of the argument to the current position. |
| static Object | stripSyntax(Object obj) |
| static Object | wrapSyntax(Object form, SyntaxForm syntax) |
define-syntax or defmacro.syntax-case.Parameters: saved value returned by matching pushPositionOf.
pushRenamedAlias.decl came from a syntax template
whose immediate scope is templateScope,
then the same syntax template may contain local variable references
that are also in the same templateScope.
Such variable references will not look in the current
"physical" scope, where we just created decl, but
will instead search the "lexical" templateScope.
So that such references can resolve to decl, we
create an alias in templateScope that points
to decl. We record that we did this in the
renamedLiasStack, so we can remove the alias later.formStack.Parameters: makeList if true, return a list representation of the scanned forms (not including declarations); else forms are push on formStack
Returns: a list of forms if makeList (possibly wrapped
in a SyntaxForm); otherwise null.