kawa.lang

Class Syntax

public abstract class Syntax extends 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
StringgetName()
ObjectgetSymbol()
voidprint(Consumer out)
Expressionrewrite(Object obj, Translator tr)
Re-write an expression that is an "application" of this Syntax object.
ExpressionrewriteForm(Object form, Translator tr)
ExpressionrewriteForm(Pair form, Translator tr)
booleanscanForDefinitions(Pair st, Vector forms, ScopeExp defs, Translator tr)
Check if a statement is a definition, for initial pass.
voidscanForm(Pair st, ScopeExp defs, Translator tr)
voidsetName(Object name)
voidsetName(String name)

Constructor Detail

Syntax

public Syntax()

Syntax

public Syntax(Object name)

Method Detail

getName

public final String getName()

getSymbol

public Object getSymbol()

print

public void print(Consumer out)

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, 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)