kawa.lang

Class Syntax

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

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(Object name)

Method Summary

String
getName()
Object
getSymbol()
void
print(Consumer out)
Expression
rewrite(Object obj, Translator tr)
Re-write an expression that is an "application" of this Syntax object.
Expression
rewriteForm(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(Object name)
void
setName(String name)

Constructor Details

Syntax

public Syntax()

Syntax

public Syntax(Object name)

Method Details

getName

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

getSymbol

public Object getSymbol()
Specified by:
getSymbol in interface Named

print

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

rewrite

public Expression rewrite(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(Object form,
                              Translator tr)

rewriteForm

public Expression rewriteForm(Pair form,
                              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

scanForm

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

setName

public void setName(Object name)

setName

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