java.lang.Object
java.lang.Thread
coneforest.psylla.Interpreter
- All Implemented Interfaces:
PsyContext
,PsyObject
,Runnable
An interpreter.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Fields inherited from interface coneforest.psylla.core.PsyContext
PSY_BEGIN, PSY_CLEARDICTSTACK, PSY_CLEARSTACK, PSY_CLEARTOMARK, PSY_COPY, PSY_COUNTDICTSTACK, PSY_COUNTEXECSTACK, PSY_COUNTSTACK, PSY_COUNTTOMARK, PSY_CURRENTCONTEXT, PSY_CURRENTDICT, PSY_DEF, PSY_DICTSTACK, PSY_DUP, PSY_EDITLINE, PSY_END, PSY_EXCH, PSY_EXEC, PSY_EXECSTACK, PSY_EXECUTIVE, PSY_EXIT, PSY_FOR, PSY_FORK, PSY_HALT, PSY_IF, PSY_IFELSE, PSY_INDEX, PSY_JOIN, PSY_LOAD, PSY_LOOP, PSY_NAMESPACE, PSY_POP, PSY_PRETTYPRINT, PSY_PRINT, PSY_QUIT, PSY_REPEAT, PSY_REQUIRE, PSY_ROLL, PSY_SAY, PSY_SLEEP, PSY_STACK, PSY_STOP, PSY_STOPPED, PSY_STORE, PSY_TOKENS, PSY_WARN, PSY_WHERE, PSY_YIELD
Fields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TONAME, PSY_TOSTRING, PSY_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbanner()
Returns the Psylla banner.Returns the current dictionary (the topmost on the dictionary stack).int
Returns the topmost execution level at the loop stack or-1
if the loop stack is empty.Returns the current namespace.int
Returns the topmost execution level at the stop stack or-1
if the stop stack is empty.Returns the dictionary stack.int
Returns the execution stack.void
fork()
boolean
void
handleExecutionStack
(int level) void
void
void
void
interpretBraced
(PsyReader oReader) <T extends PsyObject>
Tboolean
loadLibraryResource
(String resourceName) boolean
Returns the namespace pool.Returns the operand stack.operandStackBacked
(int count) int
Removes the execution level from the loop stack and returns this level or-1
if the loop stack is empty.int
Removes the execution level from the stop stack and returns this level or-1
if the stop stack is empty.prompt()
Returns the REPL prompt.<T extends PsyObject>
TpsyLoad
(PsyTextual oKey) void
psyRequire
(PsyTextual oResourceName) int
Pushes the current execution level onto the loop stack and returns this level.int
Pushes the current execution level onto the stop stack and returns this level.void
quit()
void
repl()
void
setClassPath
(String[] classPath) void
setEnvironment
(Map<String, String> env) void
setErrorWriter
(Writer writer) void
setLibraryPath
(String[] libraryPath) void
setRandomSeed
(Long randomSeed) void
void
setScriptName
(String scriptName) void
setShellArguments
(String[] args) void
setStopped
(boolean stopped) void
void
void
stop_()
Returns system dictionary.userDict()
Returns the user dictionary.Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface coneforest.psylla.core.PsyContext
getId, join, psyWhere, toSyntaxString
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, typeName
-
Constructor Details
-
Interpreter
public Interpreter()Creates a new Psylla language interpreter.
-
-
Method Details
-
fork
- Specified by:
fork
in interfacePsyContext
- Throws:
PsyStackUnderflowException
PsyUnmatchedMarkException
-
operandStack
Returns the operand stack.- Specified by:
operandStack
in interfacePsyContext
- Returns:
- the operand stack.
-
operandStackBacked
- Specified by:
operandStackBacked
in interfacePsyContext
- Throws:
PsyStackUnderflowException
-
dictStack
Description copied from interface:PsyContext
Returns the dictionary stack.- Specified by:
dictStack
in interfacePsyContext
- Returns:
- the dictionary stack.
-
executionStack
Description copied from interface:PsyContext
Returns the execution stack.- Specified by:
executionStack
in interfacePsyContext
- Returns:
- the execution stack.
-
classLoader
-
load
- Throws:
PsyUndefinedException
-
psyLoad
- Specified by:
psyLoad
in interfacePsyContext
- Throws:
PsyUndefinedException
-
handleExecutionStack
public void handleExecutionStack(int level) - Specified by:
handleExecutionStack
in interfacePsyContext
-
currentDict
Description copied from interface:PsyContext
Returns the current dictionary (the topmost on the dictionary stack).- Specified by:
currentDict
in interfacePsyContext
- Returns:
- the current dictionary.
-
systemDict
Returns system dictionary.- Specified by:
systemDict
in interfacePsyContext
- Returns:
- the system dictionary.
-
userDict
Returns the user dictionary.- Returns:
- the user dictionary.
-
namespacePool
Description copied from interface:PsyContext
Returns the namespace pool.- Specified by:
namespacePool
in interfacePsyContext
- Returns:
- the namespace pool.
-
currentNamespace
Returns the current namespace.- Returns:
- the current namespace.
-
setReader
-
setWriter
-
setErrorWriter
-
setRandomSeed
- Throws:
PsyUndefinedException
-
setClassPath
public void setClassPath(String[] classPath) throws PsyLimitCheckException, PsyRangeCheckException, PsyUndefinedException -
setLibraryPath
public void setLibraryPath(String[] libraryPath) throws PsyLimitCheckException, PsyRangeCheckException, PsyUndefinedException -
interpret
-
interpret
-
interpret
- Specified by:
interpret
in interfacePsyContext
-
interpretBraced
- Specified by:
interpretBraced
in interfacePsyContext
- Throws:
PsyLimitCheckException
-
errorDict
- Throws:
PsyUndefinedException
-
showStacks
public void showStacks() -
execLevel
public int execLevel()- Specified by:
execLevel
in interfacePsyContext
-
getStopped
public boolean getStopped()- Specified by:
getStopped
in interfacePsyContext
-
setStopped
public void setStopped(boolean stopped) - Specified by:
setStopped
in interfacePsyContext
-
pushLoopLevel
public int pushLoopLevel()Description copied from interface:PsyContext
Pushes the current execution level onto the loop stack and returns this level.- Specified by:
pushLoopLevel
in interfacePsyContext
- Returns:
- the current execution level.
-
popLoopLevel
public int popLoopLevel()Description copied from interface:PsyContext
Removes the execution level from the loop stack and returns this level or-1
if the loop stack is empty.- Specified by:
popLoopLevel
in interfacePsyContext
- Returns:
- the execution level on the top of the loop stack or
-1
if the loop stack is empty.
-
currentLoopLevel
public int currentLoopLevel()Description copied from interface:PsyContext
Returns the topmost execution level at the loop stack or-1
if the loop stack is empty.- Specified by:
currentLoopLevel
in interfacePsyContext
- Returns:
- the topmost execution level at the loop stack or
-1
if the loop stack is empty.
-
pushStopLevel
public int pushStopLevel()Description copied from interface:PsyContext
Pushes the current execution level onto the stop stack and returns this level.- Specified by:
pushStopLevel
in interfacePsyContext
- Returns:
- the current execution level.
-
popStopLevel
public int popStopLevel()Description copied from interface:PsyContext
Removes the execution level from the stop stack and returns this level or-1
if the stop stack is empty.- Specified by:
popStopLevel
in interfacePsyContext
- Returns:
- the execution level on the top of the stop stack or
-1
if the stop stack is empty.
-
currentStopLevel
public int currentStopLevel()Description copied from interface:PsyContext
Returns the topmost execution level at the stop stack or-1
if the stop stack is empty.- Specified by:
currentStopLevel
in interfacePsyContext
- Returns:
- the topmost execution level at the stop stack or
-1
if the stop stack is empty.
-
setScriptName
-
setShellArguments
-
setEnvironment
-
quit
public void quit()- Specified by:
quit
in interfacePsyContext
-
repl
- Specified by:
repl
in interfacePsyContext
- Throws:
PsyIOErrorException
-
banner
Returns the Psylla banner.- Returns:
- the banner.
-
prompt
Returns the REPL prompt.- Returns:
- the REPL prompt.
-
stop_
public void stop_()- Specified by:
stop_
in interfacePsyContext
-
loadLibraryResource
public boolean loadLibraryResource(String resourceName) throws PsyFileAccessDeniedException, PsyFileNotFoundException, PsyIOErrorException, PsySecurityErrorException, PsyUndefinedException, PsyErrorException -
loadType
-
psyRequire
public void psyRequire(PsyTextual oResourceName) throws PsyFileAccessDeniedException, PsyFileNotFoundException, PsyIOErrorException, PsySecurityErrorException, PsyUndefinedException, PsyErrorException - Specified by:
psyRequire
in interfacePsyContext
- Throws:
PsyFileAccessDeniedException
PsyFileNotFoundException
PsyIOErrorException
PsySecurityErrorException
PsyUndefinedException
PsyErrorException
-