Mercury library 1.0 Translation of CFG grammars into an object model (Bachelor's thesis).

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | List of all members
Mercury.Interpreting.ArithmeticAction< T > Class Template Reference

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...

Inheritance diagram for Mercury.Interpreting.ArithmeticAction< T >:

## Public Member Functions
| ArithmeticAction (string name, Func< dynamic, dynamic, dynamic > f)
| Initializes a new instance of the ArithmeticAction{T} class. More...
override ArgumentType | InferReturnType (ArgumentType expected, ArgumentType[] actual)
| Infers the actual return type from provided parameter types More...
override 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...
Public Member Functions inherited from Mercury.Interpreting.GenericAction< T >
| GenericAction (string name, Tuple< int, int > arity, ArgumentType[] argtypes, bool allowswild=true)
| Initializes a GenericAction{T} instance. More...
Public Member Functions inherited from 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: More...

## Additional Inherited Members
Protected Member Functions inherited from Mercury.Interpreting.InterpreterAction< T >
void | CheckDefinition ()
Properties inherited from Mercury.Interpreting.InterpreterAction< T >
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

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)`

Template Parameters

  T |

Type Constraints

  T | : | class |

Definition at line 539 of file BasicActions.cs.

## Constructor & Destructor Documentation

Mercury.Interpreting.ArithmeticAction< T >.ArithmeticAction | ( | string | name,
|  | Func< dynamic, dynamic, dynamic > | f
| ) |  |

Initializes a new instance of the ArithmeticAction{T} class.

Parameters

  name | The name of the action
  f | The lambda function

Exceptions

  System.ArgumentNullException | When f is null

Definition at line 552 of file BasicActions.cs.

## Member Function Documentation

override ArgumentType Mercury.Interpreting.ArithmeticAction< T >.InferReturnType | ( | ArgumentType | expected,
|  | ArgumentType[] | actual
| ) |  |
| virtual

Infers the actual return type from provided parameter types

Parameters

  expected | Expected return type flags.
  actual | Actual argument types.

Returns
  The actual return type. Must contain exactly ONE bit set, unless it is `Integer | Real`

Implements Mercury.Interpreting.GenericAction< T >.

Definition at line 563 of file BasicActions.cs.

override object Mercury.Interpreting.ArithmeticAction< T >.Invoke | ( | Argument[] | arguments,
|  | RecursiveEval< T > | eval,
|  | InterpreterContext< T > | context
| ) |  |
| 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

  arguments | Arguments of the function.
  eval | The recursive evaluation of trees.
  context | Interpreter context.

Returns
  String value of evaluation or `null` if failed.

Implements Mercury.Interpreting.InterpreterAction< T >.

Definition at line 570 of file BasicActions.cs.

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

- Mercury/Mercury/Interpreting/BasicActions.cs