Package kawa.standard
Class Scheme
- java.lang.Object
-
- gnu.expr.Language
-
- gnu.kawa.lispexpr.LispLanguage
-
- kawa.standard.Scheme
-
- Direct Known Subclasses:
BRL
public class Scheme extends LispLanguage
-
-
Field Summary
Fields Modifier and Type Field Description static Apply
apply
static ApplyToArgs
applyToArgs
static LangPrimType
booleanType
static String
emptyStringLeft
static String
emptyStringRight
static int
FOLLOW_R5RS
static int
FOLLOW_R6RS
static int
FOLLOW_R7RS
static Map
forEach
static Scheme
instance
static InstanceOf
instanceOf
static IsEq
isEq
static IsEqual
isEqual
static IsEqv
isEqv
static NumberPredicate
isEven
static NumberPredicate
isOdd
protected static SimpleEnvironment
kawaEnvironment
static Map
map
static Not
not
static NumberCompare
numEqu
static NumberCompare
numGEq
static NumberCompare
numGrt
static NumberCompare
numLEq
static NumberCompare
numLss
-
Fields inherited from class gnu.kawa.lispexpr.LispLanguage
bracket_apply_sym, bracket_list_sym, constructNamespace, defaultReadTable, dots3_sym, entityNamespace, getNamedPartLocation, lookup_sym, quasiquote_str, quasiquote_sym, quote_str, splice_colon_str, splice_colon_sym, splice_str, splice_sym, unitNamespace, unquote_str, unquotesplicing_str
-
Fields inherited from class gnu.expr.Language
current, environ, FUNCTION_NAMESPACE, global, NAMESPACE_PREFIX_NAMESPACE, PARSE_CURRENT_NAMES, PARSE_EMIT_MAIN, PARSE_EXPLICIT, PARSE_FOR_APPLET, PARSE_FOR_EVAL, PARSE_FOR_LINT, PARSE_FOR_SERVLET, PARSE_IMMEDIATE, PARSE_INTERACTIVE_MODULE, PARSE_ONE_LINE, PARSE_PROLOG, requirePedantic, userEnv, VALUE_NAMESPACE
-
-
Constructor Summary
Constructors Modifier Constructor Description Scheme()
protected
Scheme(Environment env)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
appendBodyValues()
Should the values of body/block be appended as multiple values? Otherwise, just return the result of the final expression.Symbol
asSymbol(String ident)
static Environment
builtin()
ReadTable
createReadTable()
Create a freshReadTable
appropriate for this language.static Object
eval(gnu.kawa.io.InPort port, Environment env)
Evaluate Scheme expressions from stream.static Object
eval(Object sexpr, Environment env)
Evaluate Scheme expressions from an "S expression."static Object
eval(String string, Environment env)
Evaluate Scheme expressions from string.static Type
exp2Type(Expression exp)
Convert expression to a Type.String
formatType(Type type)
String
getCompilationClass()
gnu.kawa.format.AbstractFormat
getFormat(boolean readable)
static Scheme
getInstance()
LispReader
getLexer(gnu.kawa.io.InPort inp, SourceMessages messages)
String
getName()
int
getNamespaceOf(Declaration decl)
Return the namespace (e.g value or function) of a Declaration.static Environment
getR5rsEnvironment()
static Scheme
getR5rsInstance()
static Scheme
getR6rsInstance()
static Scheme
getR7rsInstance()
int
getStandardToFollow()
static Environment
getStdEnvironment()
protected HashMap<String,Type>
getTypeMap()
static Type
getTypeValue(Expression exp)
If exp is a "constant" Type, return that type, otherwise return null.boolean
keywordsAreSelfEvaluating()
Are keywords self-evaluating? True in CommonLisp.static Exception
loadClass(String path, Environment env)
static void
registerEnvironment()
The compiler insert calls to this method for applications and applets.-
Methods inherited from class gnu.kawa.lispexpr.LispLanguage
declFromField, decodeArrayType, defSntxStFld, defSntxStFld, fromLangSymbol, getNamedType, getPackageStyleType, getPrimaryPrompt, getSecondaryPrompt, getTypeFor, getTypeFor, langSymbolToSymbol, parse, resolve, selfEvaluatingSymbol
-
Methods inherited from class gnu.expr.Language
asType, booleanObject, booleanValue, coerceFromObject, coerceToObject, decodeType, defAliasStFld, define, defineFunction, defineFunction, defProcStFld, defProcStFld, defProcStFld, defProcStFldAs, detect, detect, detect, encodeType, eval, eval, eval, eval, eval, eval, eval, eval, eval, getCompilation, getCompilation, getDefaultLanguage, getEnvironment, getEnvPropertyFor, getEnvPropertyFor, getExtensions, getInstance, getInstance, getInstanceFromFilenameExtension, getLangEnvironment, getLangTypeFor, getLanguages, getNewEnvironment, getOutputConsumer, getSymbol, getTypeFor, getTypeFor, getTypeFor, hasNamespace, hasSeparateFunctionNamespace, isTrue, isValidJavaName, loadClass, lookup, lookupBuiltin, mangleName, noValue, parse, parse, parse, parse, registerLanguage, restoreCurrent, runAsApplication, setCurrentLanguage, setDefaults, setSaveCurrent, unionType
-
-
-
-
Field Detail
-
FOLLOW_R5RS
public static final int FOLLOW_R5RS
- See Also:
- Constant Field Values
-
FOLLOW_R6RS
public static final int FOLLOW_R6RS
- See Also:
- Constant Field Values
-
FOLLOW_R7RS
public static final int FOLLOW_R7RS
- See Also:
- Constant Field Values
-
kawaEnvironment
protected static final SimpleEnvironment kawaEnvironment
-
instance
public static final Scheme instance
-
booleanType
public static final LangPrimType booleanType
-
applyToArgs
public static final ApplyToArgs applyToArgs
-
apply
public static final Apply apply
-
instanceOf
public static final InstanceOf instanceOf
-
not
public static final Not not
-
isEq
public static final IsEq isEq
-
isEqv
public static final IsEqv isEqv
-
isEqual
public static final IsEqual isEqual
-
map
public static final Map map
-
forEach
public static final Map forEach
-
numEqu
public static final NumberCompare numEqu
-
numGrt
public static final NumberCompare numGrt
-
numGEq
public static final NumberCompare numGEq
-
numLss
public static final NumberCompare numLss
-
numLEq
public static final NumberCompare numLEq
-
isOdd
public static final NumberPredicate isOdd
-
isEven
public static final NumberPredicate isEven
-
emptyStringLeft
public static final String emptyStringLeft
-
emptyStringRight
public static final String emptyStringRight
-
-
Constructor Detail
-
Scheme
public Scheme()
-
Scheme
protected Scheme(Environment env)
-
-
Method Detail
-
getStandardToFollow
public int getStandardToFollow()
-
getInstance
public static Scheme getInstance()
-
loadClass
public static Exception loadClass(String path, Environment env)
-
getR5rsEnvironment
public static Environment getR5rsEnvironment()
-
getStdEnvironment
public static Environment getStdEnvironment()
-
getR5rsInstance
public static Scheme getR5rsInstance()
-
getR6rsInstance
public static Scheme getR6rsInstance()
-
getR7rsInstance
public static Scheme getR7rsInstance()
-
builtin
public static Environment builtin()
-
getCompilationClass
public String getCompilationClass()
- Overrides:
getCompilationClass
in classLispLanguage
-
eval
public static Object eval(String string, Environment env)
Evaluate Scheme expressions from string.- Parameters:
string
- the string containing Scheme expressionsenv
- the Environment to evaluate the string in- Returns:
- result of last expression, or Language.voidObject if none.
-
eval
public static Object eval(gnu.kawa.io.InPort port, Environment env)
Evaluate Scheme expressions from stream.- Parameters:
port
- the port to read Scheme expressions fromenv
- the Environment to evaluate the string in- Returns:
- result of last expression, or Language.voidObject if none.
-
eval
public static Object eval(Object sexpr, Environment env)
Evaluate Scheme expressions from an "S expression."- Parameters:
sexpr
- the S expression to evaluateenv
- the Environment to evaluate the string in- Returns:
- result of the expression.
-
getFormat
public gnu.kawa.format.AbstractFormat getFormat(boolean readable)
-
getLexer
public LispReader getLexer(gnu.kawa.io.InPort inp, SourceMessages messages)
- Overrides:
getLexer
in classLispLanguage
-
getNamespaceOf
public int getNamespaceOf(Declaration decl)
Description copied from class:Language
Return the namespace (e.g value or function) of a Declaration. Return a bitmask of all the namespaces "covered" by the Declaration. Note this isn't a namespace in the XML sense; if a Declaration has a specific namespace URI, then that is part of its symbol. This namespace bitmap is a separate dimension, for the use of languages that have separate namespaces for different kinds of declarations, such as variables and functions.- Overrides:
getNamespaceOf
in classLanguage
-
getTypeValue
public static Type getTypeValue(Expression exp)
If exp is a "constant" Type, return that type, otherwise return null.
-
getTypeMap
protected HashMap<String,Type> getTypeMap()
- Overrides:
getTypeMap
in classLispLanguage
-
formatType
public String formatType(Type type)
- Overrides:
formatType
in classLanguage
-
exp2Type
public static Type exp2Type(Expression exp)
Convert expression to a Type. Allow"TYPE"
or'TYPE
or<TYPE>
.
-
appendBodyValues
public boolean appendBodyValues()
Should the values of body/block be appended as multiple values? Otherwise, just return the result of the final expression.
-
keywordsAreSelfEvaluating
public boolean keywordsAreSelfEvaluating()
Description copied from class:LispLanguage
Are keywords self-evaluating? True in CommonLisp. Used to be true for Scheme also, but now in Scheme literal keywords should only be used for keyword arguments; if you want a Keyword value if should be quoted.- Overrides:
keywordsAreSelfEvaluating
in classLispLanguage
- Returns:
- true if we should treat keywords as self-evaluating.
-
createReadTable
public ReadTable createReadTable()
Description copied from class:LispLanguage
Create a freshReadTable
appropriate for this language.- Specified by:
createReadTable
in classLispLanguage
-
registerEnvironment
public static void registerEnvironment()
The compiler insert calls to this method for applications and applets.
-
-