Refactor.
This commit is contained in:
@@ -3,7 +3,7 @@ Compile a Script (to AST)
|
||||
|
||||
{{#include ../links.md}}
|
||||
|
||||
To repeatedly evaluate a script, _compile_ it first into an AST (abstract syntax tree) form:
|
||||
To repeatedly evaluate a script, _compile_ it first into an `AST` (abstract syntax tree) form:
|
||||
|
||||
```rust
|
||||
// Compile to an AST and store it for later evaluations
|
||||
|
8
doc/src/engine/index.md
Normal file
8
doc/src/engine/index.md
Normal file
@@ -0,0 +1,8 @@
|
||||
Using the Engine
|
||||
================
|
||||
|
||||
{{#include ../links.md}}
|
||||
|
||||
Rhai's interpreter resides in the [`Engine`] type under the master `rhai` namespace.
|
||||
|
||||
This section shows how to set up, configure and use this scripting engine.
|
@@ -4,13 +4,13 @@ Re-Optimize an AST
|
||||
{{#include ../../links.md}}
|
||||
|
||||
Sometimes it is more efficient to store one single, large script with delimited code blocks guarded by
|
||||
constant variables. This script is compiled once to an `AST`.
|
||||
constant variables. This script is compiled once to an [`AST`].
|
||||
|
||||
Then, depending on the execution environment, constants are passed into the [`Engine`] and the `AST`
|
||||
Then, depending on the execution environment, constants are passed into the [`Engine`] and the [`AST`]
|
||||
is _re_-optimized based on those constants via the `Engine::optimize_ast` method,
|
||||
effectively pruning out unused code sections.
|
||||
|
||||
The final, optimized `AST` is then used for evaluations.
|
||||
The final, optimized [`AST`] is then used for evaluations.
|
||||
|
||||
```rust
|
||||
// Compile master script to AST
|
||||
|
Reference in New Issue
Block a user