public class Compiler extends Object
Modifier and Type | Class and Description |
---|---|
class |
Compiler.ABSTRACT_SET_OP |
class |
Compiler.AbstractForm
Base class for special forms and regular functions.
|
class |
Compiler.Builtin
Abstract class for Builtins.
|
class |
Compiler.BuiltinForm |
class |
Compiler.BuiltinFunc |
static class |
Compiler.CodeProxy |
class |
Compiler.COND |
class |
Compiler.Ctx |
class |
Compiler.DEFUN
(DEFUN FOO (arg1 arg2...) block block...)
|
class |
Compiler.DLET |
class |
Compiler.Eargs
Context adepted for function arguments.
|
static class |
Compiler.ErrorMissHandler |
class |
Compiler.FOREACH |
class |
Compiler.FUNCTION |
static interface |
Compiler.ICtx
Context - The execution context containing Map of values of dynamic variables, map of variables
properties and link to parent context.
|
class |
Compiler.IF |
static interface |
Compiler.IMissHandler |
static class |
Compiler.InstanceProxy |
class |
Compiler.LAMBDA |
class |
Compiler.LET |
static class |
Compiler.NilMissHandler |
class |
Compiler.PROGN |
class |
Compiler.QUOTE |
class |
Compiler.SEARCH |
class |
Compiler.SETF |
class |
Compiler.SETL |
class |
Compiler.SETQ |
class |
Compiler.SETV |
class |
Compiler.TH_1ST |
class |
Compiler.TH_AS |
class |
Compiler.TH_BASE |
class |
Compiler.TH_LAST |
class |
Compiler.TH_PIPE |
class |
Compiler.TH_X |
class |
Compiler.TRY |
class |
Compiler.WHEN |
class |
Compiler.WHILE |
class |
Compiler.WITH_BINDINGS |
class |
Compiler.WITH_CTX |
Modifier and Type | Field and Description |
---|---|
protected List<String> |
argv |
protected boolean |
enforcePackages |
protected boolean |
failOnMissingVariables |
protected IStringConverter |
funcNameConverter |
protected Set<String> |
packages |
protected IParser |
parser |
protected static Threads |
threads |
Constructor and Description |
---|
Compiler()
Construct compiler with default configuration.
|
Compiler(IStringConverter converter)
Construct compiler with given list of packages.
|
Compiler(IStringConverter fnameConverter,
Set<String> packages)
Construct compiler with given list of packages and with given function name converter.
|
Compiler(Set<String> packages)
Construct compiler with given list of packages.
|
Modifier and Type | Method and Description |
---|---|
void |
addBuiltIn(String name,
Class<?> cls)
Add mapping for a Builtin.
|
boolean |
checkBuiltinPackage(Class<?> cls,
Set<String> pkgs)
Check if Builtin's package is contaimed in the set of packages.
|
ICompiled |
compile(ASTN ast)
Compile AST into executable data structures.
|
List<ICompiled> |
compileExpList(ASTNList params)
Compile parameters.
|
Object |
evalBlocks(Backtrace backtrace,
List<ICompiled> blocks,
Compiler.ICtx ctx)
Evaluate block of compiled expressions.
|
Object |
evalBlocksWithReturn(Backtrace backtrace,
List<ICompiled> blocks,
Compiler.ICtx ctx)
Evaluate block of compiled expressions, handling return statement if present.
|
static Set<String> |
getAllPackages()
Return list of available packages.
|
String |
getBuiltinPackage(Class<?> cls)
Get Builtin's package.
|
List<String> |
getCommandlineArgs()
Set command line args.
|
static Set<String> |
getDefaultPackages()
Return default list of enabled packages for a Compiler instance.
|
ICode |
getFun(String name)
Return named function.
|
Set<String> |
getFunKeys() |
ICode |
getFunOrStub(String name)
Return named function or function stub if not defined.
|
Set<String> |
getPackages()
Return set of enabled packages.
|
IParser |
getParser()
Get configured parser.
|
boolean |
isEnforcePackages()
Get status of package enforcement.
|
Backtrace |
newBacktrace() |
Compiler.ICtx |
newCtx() |
Compiler.ICtx |
newCtx(Compiler.ICtx ctx) |
Compiler.ICtx |
newCtx(Map<String,Object> vars) |
Compiler.ICtx |
newCtxFromROMap(Map<String,Object> vars) |
Compiler.Eargs |
newEargs(Object[] result,
boolean[] needEval,
ArgList argList,
Compiler.ICtx ctx) |
ICode |
putFun(String name,
ICode code)
Put function definition into function table.
|
void |
setCommandlineArgs(List<String> argv)
Set command line args.
|
void |
setEnforcePackages(boolean val)
Set status of package enforcement.
|
void |
setFailOnMissingVariables(boolean val)
Configure behaviour on dereference of non-existing variables.
|
void |
setFnameConverter(IStringConverter converter)
Configure function name converter.
|
void |
setPackages(Set<String> packages)
Configure set of enabled packages.
|
void |
setParser(IParser parser)
Configure parser.
|
void |
usePackages(Collection<String> pkgSpecs)
Add package specifications to the list of used packages.
|
void |
usePackages(String... pkgSpecs)
Add package specifications to the list of used packages.
|
protected static Threads threads
protected IParser parser
protected boolean failOnMissingVariables
protected IStringConverter funcNameConverter
protected boolean enforcePackages
public Compiler()
The compiler created with NO OP string converter and with default list of enabled packages.
public Compiler(Set<String> packages)
The compiler created with NO OP string converter and with given list of packages.
public Compiler(IStringConverter converter)
The compiler created with given function name converter and default list of packages.
public Compiler(IStringConverter fnameConverter, Set<String> packages)
public static Set<String> getDefaultPackages()
public void setFnameConverter(IStringConverter converter)
public void setFailOnMissingVariables(boolean val)
public IParser getParser()
public void setParser(IParser parser)
public boolean isEnforcePackages()
public void setEnforcePackages(boolean val)
public void usePackages(String... pkgSpecs)
public void usePackages(Collection<String> pkgSpecs)
public boolean checkBuiltinPackage(Class<?> cls, Set<String> pkgs)
public void addBuiltIn(String name, Class<?> cls)
Add builtin mapping. If packages are enforced the builtin will be checked against the list of enabled packages.
public ICode getFunOrStub(String name)
public Compiler.ICtx newCtx()
public Compiler.ICtx newCtx(Compiler.ICtx ctx)
public Compiler.ICtx newCtx(Map<String,Object> vars)
public Compiler.ICtx newCtxFromROMap(Map<String,Object> vars)
public Backtrace newBacktrace()
public Object evalBlocks(Backtrace backtrace, List<ICompiled> blocks, Compiler.ICtx ctx)
public Object evalBlocksWithReturn(Backtrace backtrace, List<ICompiled> blocks, Compiler.ICtx ctx)
public Compiler.Eargs newEargs(Object[] result, boolean[] needEval, ArgList argList, Compiler.ICtx ctx)
Copyright © 2022. All rights reserved.