|
Mercury library
1.0
Translation of CFG grammars into an object model (Bachelor's thesis).
|
Interprets derivation trees using rewrite rules. The type parameter T represents the target language.
More...
Public Member Functions | |
| Interpreter (RewriteRuleCollection< T > rules, IInterpreterContextFactory factory, bool logging=true, int boostlim=4) | |
| Creates a new Interpreter instance. More... | |
| InterpreterResult< T > | Interpret (Tree< Symbol > tree) |
| Interprets the tree using rewrite rules. More... | |
| IReadOnlyList < InterpreterResult< T > > | Interpret (IReadOnlyList< Tree< Symbol >> trees) |
Interprets the specified trees. If the number of trees is at least boostlim specified in the constructor, the method will use memoization and parallelism. More... | |
Properties | |
| RewriteRuleCollection< T > | RewriteRules [get, set] |
| The collection of rewrite rules. More... | |
Properties inherited from Mercury.Interpreting.IInterpreter< T > | |
| RewriteRuleCollection< T > | RewriteRules [get] |
| The collection of rewrite rules used by the interpreter More... | |
Interprets derivation trees using rewrite rules. The type parameter T represents the target language.
Achtung: if T equals dynamic, the type check will assume all possible values on arguments and actions that take (or return for that matter) TValue.
The method Interpret parametrized with lists uses parallelism and memory caching. If number of interpreted trees is at least boostlim, the method will use System.Runtime.Caching.MemoryCache and System.Threading.Tasks.Parallel components to speed up the analysis. The value boostlim is 4 by default.
| T | : | class |
Definition at line 57 of file Interpreter.cs.
| Mercury.Interpreting.Interpreter< T >.Interpreter | ( | RewriteRuleCollection< T > | rules, |
| IInterpreterContextFactory | factory, | ||
| bool | logging = true, |
||
| int | boostlim = 4 |
||
| ) |
Creates a new Interpreter instance.
| rules | A collection of rewrite rules. |
| factory | The context factory or null to use the default factory. |
| logging | If false, the interpreter will throw away logging structure to save memory |
| boostlim | Specifies the amount of trees required for the method Interpret on list of trees to use memoisation and parallelism. The default value is 4. |
| System.ArgumentNullException | When rules reference is null. |
Definition at line 367 of file Interpreter.cs.
Interprets the tree using rewrite rules.
| tree | The tree to interpret. |
Implements Mercury.Interpreting.IInterpreter< T >.
Definition at line 391 of file Interpreter.cs.
| IReadOnlyList<InterpreterResult<T> > Mercury.Interpreting.Interpreter< T >.Interpret | ( | IReadOnlyList< Tree< Symbol >> | trees | ) |
Interprets the specified trees. If the number of trees is at least boostlim specified in the constructor, the method will use memoization and parallelism.
| trees | The list of trees. |
Implements Mercury.Interpreting.IInterpreter< T >.
Definition at line 401 of file Interpreter.cs.
|
getset |
The collection of rewrite rules.
Definition at line 382 of file Interpreter.cs.
1.8.7