Documentation ¶
Overview ¶
Package lemur implements the capabilities to take lemur source code and execute it. Execution can be ran multiple times with different inputs holding state from the previous execution
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct { // Type gives back what underlying lemur type the result is Type string // contains filtered or unexported fields }
Result represents the output after the lemur source code has been ran
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime represents and encapsulates the entire runtime of lemur source code program(s). Runtime is design to hold states of compiler constants and runtime globals along with the compiler symbol table so it can be reused in the next execution
func NewRuntime ¶
func NewRuntime() *Runtime
NewRuntime is a simple constructor to create a fresh Runtime. NewRuntime can be used to start up a fresh set of execution or if there is no interested in maintaining state from a previous lemur source code execution
func (*Runtime) Execute ¶
Execute runs the lemur source code input. It will return the last popped element from the stack at the end of execution or any error that may have occurred during execution (including lexer, parser, compiler and vm errors).
Execute will also retain the state from the just executed lemur source code to help facilitate use cases such as REPLs. This state retention can be avoided by just creating a fresh runtime via NewRuntime
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
ast
Package ast implements the nodes that form the abstract syntax tree once the lemur code has been parsed
|
Package ast implements the nodes that form the abstract syntax tree once the lemur code has been parsed |
compiler
Package compiler implements the translation layer of lemur from the generate AST produced by the parser to a set of instructions that consist of byte code made up of operations which are define in the op package
|
Package compiler implements the translation layer of lemur from the generate AST produced by the parser to a set of instructions that consist of byte code made up of operations which are define in the op package |
lexer
Package lexer implements the tokenisation of the lemur source code input.
|
Package lexer implements the tokenisation of the lemur source code input. |
op
Package op implements all the operation codes that can be created during compilation and used to drive what to execute during run time within the VM.
|
Package op implements all the operation codes that can be created during compilation and used to drive what to execute during run time within the VM. |
parser
Package parser implements a parser for Lemur source files.
|
Package parser implements a parser for Lemur source files. |
repl
Package repl implements your typical read, lex, parse, evaluate program for lemur source code.
|
Package repl implements your typical read, lex, parse, evaluate program for lemur source code. |
vm
Package vm implements the backend runtime of lemur.
|
Package vm implements the backend runtime of lemur. |