kawa.lang
Class Syntax

java.lang.Object
  extended by kawa.lang.Syntax
All Implemented Interfaces:
Named, Printable
Direct Known Subclasses:
AutoloadSyntax, begin, constant_fold, defcustom, defgroup, define, define_alias, define_autoload, define_class, define_member_alias, define_syntax, define_unit, define_variable, DefineNamespace, defun, defvar, export, fluid_let, function, Lambda, let, let_syntax, location, Macro, module_compile_options, module_extends, module_implements, module_name, module_static, object, prim_method, prog1, Quote, require, SaveExcursion, set_b, setq, syntax_case, syntax_error, syntax_rules, thisRef, UnwindProtect, While, with_compile_options

public abstract class Syntax
extends java.lang.Object
implements Printable, Named

Abstract class for "syntax" objects. Builtins and macros are instances of this class.


Constructor Summary
Syntax()
           
Syntax(java.lang.Object name)
           
 
Method Summary
 java.lang.String getName()
           
 java.lang.Object getSymbol()
           
 void print(Consumer out)
           
 Expression rewrite(java.lang.Object obj, Translator tr)
          Re-write an expression that is an "application" of this Syntax object.
 Expression rewriteForm(java.lang.Object form, Translator tr)
           
 Expression rewriteForm(Pair form, Translator tr)
           
 boolean scanForDefinitions(Pair st, java.util.Vector forms, ScopeExp defs, Translator tr)
          Check if a statement is a definition, for initial pass.
 void scanForm(Pair st, ScopeExp defs, Translator tr)
           
 void setName(java.lang.Object name)
           
 void setName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Syntax

public Syntax()

Syntax

public Syntax(java.lang.Object name)
Method Detail

getName

public final java.lang.String getName()
Specified by:
getName in interface Named

getSymbol

public java.lang.Object getSymbol()
Specified by:
getSymbol in interface Named

setName

public void setName(java.lang.Object name)

setName

public void setName(java.lang.String name)
Specified by:
setName in interface Named

rewrite

public Expression rewrite(java.lang.Object obj,
                          Translator tr)
Re-write an expression that is an "application" of this Syntax object.

Parameters:
obj - the arguments to this "application" (i.e. the cdr of the macro/builtin invokation)
tr - the Translator that provides context
Returns:
the re-written expression

rewriteForm

public Expression rewriteForm(java.lang.Object form,
                              Translator tr)

rewriteForm

public Expression rewriteForm(Pair form,
                              Translator tr)

scanForm

public void scanForm(Pair st,
                     ScopeExp defs,
                     Translator tr)

scanForDefinitions

public boolean scanForDefinitions(Pair st,
                                  java.util.Vector forms,
                                  ScopeExp defs,
                                  Translator tr)
Check if a statement is a definition, for initial pass. Semi-deprecated - should convert calls to use scanForm.

Parameters:
st - the statement to check
forms - where to append the (possibly-modified) statement
defs - where to add Declarations for found definitions
tr - the compilation state
Returns:
true on success

print

public void print(Consumer out)
Specified by:
print in interface Printable