java.lang.Object
coneforest.psylla.runtime.Interpreter
- All Implemented Interfaces:
PsyContext,PsyObject,Runnable
The Psylla language interpreter.
-
Field Summary
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_YIELDFields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the interpreter’s class loader.Returns the current dictionary (the topmost on the dictionary stack).Returns the current namespace.Returns the dictionary stack.intReturns the size of the execution stack.Returns the execution stack.voidfork()longgetId()booleanReturns the value of the stopped flag.voidhandleExecutionStack(int level) voidInterprets the Psylla code from thereaderobject.voidvoidvoidinterpretBraced(PsyReader oReader) voidjoin()voidjoin(long millis) booleanloadLibraryResource(String resourceName) booleanReturns the namespace pool.Returns the operand stack.operandStackBacked(int count) prompt()Returns the REPL prompt.<T extends PsyObject>
TpsyLoad(PsyTextual oKey) voidpsyRequire(PsyTextual oResourceName) voidquit()voidrepl()voidrun()voidsetClassPath(String[] classPath) voidsetEnvironment(Map<String, String> env) voidsetErrorWriter(Writer writer) Sets the interpreter’s standard error writer.voidsetLibraryPath(String[] libraryPath) voidsetRandomSeed(Long randomSeed) Reseeds the interpreter’s standard pseudorandom generator, using the given seed.voidSets the interpreter’s standard reader.voidsetScriptName(String scriptName) voidsetShellArguments(String[] args) voidsetStopped(boolean stopped) Sets the stopped flag to the specified value.voidSets the interpreter’s standard writer.voidvoidstart()voidstop()Returns the system dictionary.userDict()Returns the user dictionary.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface coneforest.psylla.core.PsyContext
psyCurrentContext, psyWhere, toSyntaxStringMethods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, typeName
-
Constructor Details
-
Interpreter
public Interpreter()Creates a new Psylla language interpreter.
-
-
Method Details
-
fork
- Specified by:
forkin interfacePsyContext- Throws:
PsyStackUnderflowExceptionPsyUnmatchedMarkException
-
operandStack
Description copied from interface:PsyContextReturns the operand stack.- Specified by:
operandStackin interfacePsyContext- Returns:
- the operand stack
-
operandStackBacked
- Specified by:
operandStackBackedin interfacePsyContext- Throws:
PsyStackUnderflowException
-
dictStack
Description copied from interface:PsyContextReturns the dictionary stack.- Specified by:
dictStackin interfacePsyContext- Returns:
- the dictionary stack
-
executionStack
Description copied from interface:PsyContextReturns the execution stack.- Specified by:
executionStackin interfacePsyContext- Returns:
- the execution stack
-
classLoader
Returns the interpreter’s class loader.- Returns:
- the interpreter’s class loader
-
psyLoad
- Specified by:
psyLoadin interfacePsyContext- Throws:
PsyUndefinedException
-
handleExecutionStack
public void handleExecutionStack(int level) - Specified by:
handleExecutionStackin interfacePsyContext
-
currentDict
Description copied from interface:PsyContextReturns the current dictionary (the topmost on the dictionary stack).- Specified by:
currentDictin interfacePsyContext- Returns:
- the current dictionary (the topmost on the dictionary stack)
-
systemDict
Description copied from interface:PsyContextReturns the system dictionary.- Specified by:
systemDictin interfacePsyContext- Returns:
- the system dictionary
-
userDict
Description copied from interface:PsyContextReturns the user dictionary.- Specified by:
userDictin interfacePsyContext- Returns:
- the user dictionary
-
namespacePool
Description copied from interface:PsyContextReturns the namespace pool.- Specified by:
namespacePoolin interfacePsyContext- Returns:
- the namespace pool
-
currentNamespace
Returns the current namespace.- Returns:
- the current namespace
-
setReader
Sets the interpreter’s standard reader.- Parameters:
reader- the reader.
-
setWriter
Sets the interpreter’s standard writer.- Parameters:
writer- the writer.
-
setErrorWriter
Sets the interpreter’s standard error writer.- Parameters:
writer- the error writer.
-
setRandomSeed
Reseeds the interpreter’s standard pseudorandom generator, using the given seed.- Parameters:
randomSeed- the seed.- Throws:
PsyUndefinedException- when TODO
-
setClassPath
public void setClassPath(String[] classPath) throws PsyLimitCheckException, PsyRangeCheckException, PsyUndefinedException -
setLibraryPath
public void setLibraryPath(String[] libraryPath) throws PsyLimitCheckException, PsyRangeCheckException, PsyUndefinedException -
interpret
-
interpret
-
interpret
Description copied from interface:PsyContextInterprets the Psylla code from thereaderobject.- Specified by:
interpretin interfacePsyContext- Parameters:
oReader- thereaderobject.
-
interpretBraced
- Specified by:
interpretBracedin interfacePsyContext- Throws:
PsyLimitCheckException
-
errorDict
- Throws:
PsyUndefinedException
-
showStacks
- Specified by:
showStacksin interfacePsyContext
-
execLevel
public int execLevel()Description copied from interface:PsyContextReturns the size of the execution stack.- Specified by:
execLevelin interfacePsyContext- Returns:
- the size of the execution stack
-
getStopped
public boolean getStopped()Description copied from interface:PsyContextReturns the value of the stopped flag.- Specified by:
getStoppedin interfacePsyContext- Returns:
- the value of the stopped flag
-
setStopped
public void setStopped(boolean stopped) Description copied from interface:PsyContextSets the stopped flag to the specified value.- Specified by:
setStoppedin interfacePsyContext- Parameters:
stopped- the value of the stopped flag.
-
setScriptName
-
setShellArguments
-
setEnvironment
-
quit
public void quit()- Specified by:
quitin interfacePsyContext
-
repl
- Specified by:
replin interfacePsyContext- Throws:
PsyIOErrorException
-
prompt
Returns the REPL prompt.- Returns:
- the REPL prompt
-
start
public void start() -
run
public void run() -
join
- Specified by:
joinin interfacePsyContext- Throws:
InterruptedException
-
join
- Throws:
InterruptedException
-
getId
public long getId()- Specified by:
getIdin interfacePsyContext
-
stop
public void stop()- Specified by:
stopin 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:
psyRequirein interfacePsyContext- Throws:
PsyFileAccessDeniedExceptionPsyFileNotFoundExceptionPsyIOErrorExceptionPsySecurityErrorExceptionPsyUndefinedExceptionPsyErrorException
-