Mercury library  1.0
Translation of CFG grammars into an object model (Bachelor's thesis).
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Classes | Enumerations | Functions
Package Mercury.Interpreting

Classes

class  ActionCall< T >
 This class represents the application of Mercury.Interpreting.InterpreterAction{T} on the Mercury.Interpreting.IFormalParameter list. More...
 
class  Alternative
 Represents an alternative of elements. It may match specified symbols or symboltypes (Nonterminals, ...). More...
 
class  ArgsCountAction< T >
 
class  Argument
 Represents an argument passed to the Mercury.Interpreting.InterpreterAction{T}, the actual parameter given to the Mercury.Interpreting.Evaluator{T} in place of a formal parameter. More...
 
class  ArithmeticAction< T >
 Represents the arithmetic action. It is similar to the Mercury.Interpreting.FoldingAction{T,U,V} but does not require initial value. The minimal number of arguments is therefore 2. For instance, "1 2 3" would be evaluated as f(f(1, 2), 3) More...
 
class  BasicActions< T >
 Contains basic actions for interpretation.

Type specifiers of actions are defined as follows:
More...
 
class  CaseAction< T >
 
class  ConcatAction< T >
 
class  Constant
 Constant element. Basically equivalent of Mercury.Interpreting.Alternative. More...
 
class  ConstantAction< T, U >
 Wraps a value as an action with no parameters More...
 
class  ConstantParameter
 Constant parameter. More...
 
class  ConvertAction< T, U, V >
 Applies the lambda function on a single value. More...
 
interface  DataEntry
 Entry base (dummy) interface. More...
 
class  EmptyContextFactory
 Produces contexts with no custom data More...
 
class  EntryWriter< T >
 An auxiliary class that formats the DataEntry structure and writes it into a stream. More...
 
class  EvaluateAction< T >
 
class  Evaluator< T >
 Carries out the actual evaluation of Mercury.Interpreting.InterpreterAction{T} and its arguments arguments.
 
class  FailAction< T >
 
class  FlattenAction< T >
 
class  FoldingAction< T, U, V >
 "Folds" all its arguments into one value. For instance, for "x y z" arguments this action computes f(f(f(s,x), y), z) where f is the lamda function and s is the seed parameter of the constructor More...
 
class  GenericAction< T >
 Represents an action that infers its return type only after it is provided with types of its arguments. More...
 
class  IdentityAction< T >
 
interface  IElement
 Element interface More...
 
class  IfAction< T >
 
interface  IFormalParameter
 Represents formal parameters. More...
 
interface  IInterpreter< T >
 Interface for interpreters that create objects from derivation trees according to RewriteRules. More...
 
interface  IInterpreterContextFactory
 Factory of context. More...
 
class  Instance
 Represents a binding between a Mercury.Interpreting.Variable and its value More...
 
class  InstanceList
 Represents the list of instances More...
 
class  InternalContext< T >
 
class  Interpreter< T >
 Interprets derivation trees using rewrite rules. The type parameter T represents the target language.

More...
 
class  InterpreterAction< T >
 Function that wraps constant values in the RHS More...
 
class  InterpreterAction< T, U >
 Interpreter action with a safer return type. More...
 
class  InterpreterContext< T >
 Interpreter Context class. Some languages may use it to override it and remember data when parse trees are being interpreted. More...
 
class  InterpreterResult< T >
 Result of the interpretation. More...
 
class  JoinAction< T >
 
class  LetAction< T >
 
class  MemoEntry< T >
 Represents memoized value More...
 
class  OperationAction< T, U, V >
 Represents an operation on two values. More...
 
class  RewriteRule< T >
 Interpreter rewrite rule More...
 
class  RewriteRuleCollection< T >
 A read-only collection of rewrite rules More...
 
class  RewriteRuleCollectionBuilder< T >
 Can be used to construct Mercury.Interpreting.RewriteRuleCollection{T} More...
 
class  RewriteRuleValidator< T >
 
class  RuleEntry< T >
 Describes a rule that has been used to interpret a tree. More...
 
class  SelectAction< T >
 
class  SemanticInterpreter< T >
 Represent the semantic analysis with interpretation. Consists of two interpreters, the first one rewrites parse trees, the second one interprets them. This class serves as a wrapper so it could be used in the Mercury.Analyser{T,TResult} class. More...
 
class  SimpleAction< T >
 
class  Structure
 Represents a tree of Mercury.Interpreting.IElement instances. Must match precisely to the parse tree. More...
 
class  SubTreeAction< T >
 
class  TextEntry
 Stores informations logged by actions or internal Evaluator. More...
 
class  TraceAction< T >
 
class  TreeEntry< T >
 Represents an entry for tree interpretation. More...
 
class  TryAction< T >
 
class  VarAction< T >
 
class  Variable
 Represents a variable element that captures value and can be used on the RHS of the RewriteRule as an argument More...
 
class  VariableParameter
 Represents a named parameter that will be replaced by an actual value of a variable captured by interpreter. More...
 
class  Wildcard
 An element that matches zero or more values. Can be used as a variable, but the actioncall must be of arity (0, int.MAX_VALUE) and must accept Tree or Symbol as the argument. More...
 

Enumerations

enum  ArgumentType {
  ArgumentType.None = 0, ArgumentType.Integer = 1, ArgumentType.Real = 2, ArgumentType.Boolean = 4,
  ArgumentType.String = 8, ArgumentType.Symbol = 16, ArgumentType.Tree = 32, ArgumentType.TValue = 64,
  ArgumentType.Primitive = Integer | Real | String | Boolean, ArgumentType.ParserEntity = Symbol | Tree, ArgumentType.Any = Primitive | ParserEntity | TValue, ArgumentType.Null = 128,
  ArgumentType.Lazy = 256 | Null, ArgumentType.Flags = Null | Lazy
}
 Defines argument types using in the Mercury library More...
 
enum  ElementType { ElementType.Constant, ElementType.Variable, ElementType.Wildcard, ElementType.Structure }
 Element Type enumeration More...
 
enum  ParameterType {
  ParameterType.IntegralConstant, ParameterType.RealConstant, ParameterType.StringConstant, ParameterType.BooleanConstant,
  ParameterType.Variable, ParameterType.ActionCall
}
 Formal Parameter Type More...
 

Functions

delegate T RecursiveEval< T > (Tree< Symbol > tree, InterpreterContext< T > context)
 Delegate type for recursive evaluation (interpretation) More...
 

Enumeration Type Documentation

Defines argument types using in the Mercury library

Enumerator
None 

Invalid argument type

Integer 

Integer value

Real 

Real value

Boolean 

Boolean value

String 

String value

Symbol 

A single symbol

Tree 

A derivation tree

TValue 

A value of the type passed to the interpreter

Primitive 

Primitive data types

ParserEntity 

Grammar entity

Any 

Any argument

Null 

Accepts null value. Must be used with other types to have effect

Lazy 

Lazy evaluation flag. Must be used with other types to have effect

Flags 

All flags

Definition at line 11 of file Argument.cs.

Element Type enumeration

Enumerator
Constant 

Constant - must match precisely

Variable 

Variable - must match type and carries value to the RHS

Wildcard 

Wildcard - an arbitrary number of matches

Structure 

Structure - subtree (recursive) match

Definition at line 15 of file Element.cs.

Formal Parameter Type

Enumerator
IntegralConstant 

Integral constant

RealConstant 

Real (double) constant

StringConstant 

String constant

BooleanConstant 

Boolean constant

Variable 

Variable

ActionCall 

Action call result

Definition at line 11 of file FormalParameter.cs.

Function Documentation

delegate T Mercury.Interpreting.RecursiveEval< T > ( Tree< Symbol tree,
InterpreterContext< T >  context 
)

Delegate type for recursive evaluation (interpretation)

Template Parameters
TInterpreter output type
Parameters
treeThe tree to interpret
contextInterpreter context (see Mercury.Interpreting.InterpreterContext{T}).
Returns
The result of interpreter or null if failed
Type Constraints
T :class