Mercury library  1.0
Translation of CFG grammars into an object model (Bachelor's thesis).
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Protected Member Functions | Properties | List of all members
Mercury.Interpreting.InterpreterAction< T > Class Template Referenceabstract

Function that wraps constant values in the RHS More...

Inheritance diagram for Mercury.Interpreting.InterpreterAction< T >:
Mercury.Interpreting.GenericAction< T > Mercury.Interpreting.InterpreterAction< T, U > Mercury.Interpreting.ArithmeticAction< T > Mercury.Interpreting.ConstantAction< T, U > Mercury.Interpreting.ConvertAction< T, U, V > Mercury.Interpreting.FoldingAction< T, U, V > Mercury.Interpreting.OperationAction< T, U, V >

Public Member Functions

 InterpreterAction (string name, Tuple< int, int > arity, ArgumentType[] argtypes, bool allowswild=true)
 Initializes a new instance of the InterpreterAction{T} class. The target application can inherit from this class, but rather one of Mercury.Interpreting.InterpreterAction{T,U} or Mercury.Interpreting.GenericAction{T} is recommended to derive.

Conditions:
More...
 
abstract object Invoke (Argument[] arguments, RecursiveEval< T > eval, InterpreterContext< T > context)
 Evaluates the arguments.
It is guaranteed to have a valid number of arguments (specified by Arity) and that no argument is null UNLESS the flag Mercury.Interpreting.ArgumentType contains Lazy or Null. More...
 

Protected Member Functions

void CheckDefinition ()
 

Properties

string Name [get, set]
 Action name. More...
 
Tuple< int, int > Arity [get, set]
 Minimum and maximum number of arguments. More...
 
ArgumentType ReturnType [get, set]
 Action return type. More...
 
ArgumentType[] ArgumentTypes [get, set]
 Allowed types of arguments. If more arguments specified (within range of Arity), the last type in this array will be used. It can be empty if and only if arity is (0,0). More...
 
bool AllowsWildcard [get, set]
 Indicates whether a Mercury.Interpreting.Wildcard can be an argument of this action. More...
 

Detailed Description

Function that wraps constant values in the RHS

Template Parameters
TInterpreter output type
Parameters
argsThe arguments
evalThe recusrive eval function
Returns

Function that wraps multiple action calls in the RHS into one

Template Parameters
T
Parameters
argsThe arguments.
Returns

Represents Actions taken in order to interpret trees.

Type Constraints
T :class 

Definition at line 46 of file InterpreterAction.cs.

Constructor & Destructor Documentation

Mercury.Interpreting.InterpreterAction< T >.InterpreterAction ( string  name,
Tuple< int, int >  arity,
ArgumentType[]  argtypes,
bool  allowswild = true 
)

Initializes a new instance of the InterpreterAction{T} class. The target application can inherit from this class, but rather one of Mercury.Interpreting.InterpreterAction{T,U} or Mercury.Interpreting.GenericAction{T} is recommended to derive.

Conditions:

  1. name
    - must not be null, empty nor consist of whitespaces only
  2. arity
    - Item1 is less than Item2
    • non-negative components
  3. types
    - non-empty (unless arity is (0, 0))
Parameters
nameThe name of the action.
arityThe arity, minimum and maximum number of allowed arguments.
argtypesThe types of arguments. If specified less than required, the last one will be repeated for unmatched arguments.
allowswildif set to true AND the maximum number of arguments equals System.Int32.MAX_VALUE, the action will support wildcards.
Exceptions
System.ArgumentNullExceptionWhen name , arity or argtypes are null.

Definition at line 94 of file InterpreterAction.cs.

Member Function Documentation

void Mercury.Interpreting.InterpreterAction< T >.CheckDefinition ( )
protected

Definition at line 51 of file InterpreterAction.cs.

abstract object Mercury.Interpreting.InterpreterAction< T >.Invoke ( Argument[]  arguments,
RecursiveEval< T >  eval,
InterpreterContext< T >  context 
)
pure virtual

Evaluates the arguments.
It is guaranteed to have a valid number of arguments (specified by Arity) and that no argument is null UNLESS the flag Mercury.Interpreting.ArgumentType contains Lazy or Null.

Parameters
argumentsArguments of the function.
evalThe recursive evaluation of trees.
contextInterpreter context.
Returns
String value of evaluation or null if failed.

Implemented in Mercury.Interpreting.ArithmeticAction< T >, and Mercury.Interpreting.InterpreterAction< T, U >.

Property Documentation

bool Mercury.Interpreting.InterpreterAction< T >.AllowsWildcard
getset

Indicates whether a Mercury.Interpreting.Wildcard can be an argument of this action.

Definition at line 132 of file InterpreterAction.cs.

ArgumentType [] Mercury.Interpreting.InterpreterAction< T >.ArgumentTypes
getset

Allowed types of arguments. If more arguments specified (within range of Arity), the last type in this array will be used. It can be empty if and only if arity is (0,0).

Definition at line 126 of file InterpreterAction.cs.

Tuple<int, int> Mercury.Interpreting.InterpreterAction< T >.Arity
getset

Minimum and maximum number of arguments.

Definition at line 116 of file InterpreterAction.cs.

string Mercury.Interpreting.InterpreterAction< T >.Name
getset

Action name.

Definition at line 113 of file InterpreterAction.cs.

ArgumentType Mercury.Interpreting.InterpreterAction< T >.ReturnType
getset

Action return type.

Definition at line 119 of file InterpreterAction.cs.


The documentation for this class was generated from the following file: