Table of Contents

Class NcExpressionEvaluator

Namespace
Hi.NcParsers.LogicSyntaxs.Evaluation
Assembly
HiMech.dll

Walks an NcExpr AST and produces an EvalResult. Resolves #nnn via an IVariableLookup; built-in function names are matched case-insensitively against a fixed table.

Phase-1 supports: SIN COS TAN ASIN ACOS ATAN SQRT ABS ROUND FIX FUP LN EXP POW. Trigonometric arguments and results are in degrees, matching Fanuc Custom Macro B convention. Unknown function names surface as UnsupportedFunctionCode; arity mismatches as ArgumentMismatchCode; division / MOD by zero and domain errors (e.g. SQRT[-1]) as MathErrorCode; vacant operands as VacantErrorCode.

public sealed class NcExpressionEvaluator
Inheritance
NcExpressionEvaluator
Inherited Members
Extension Methods

Fields

ArgumentMismatchCode

Diagnostic code for built-in functions called with the wrong number of arguments.

public const string ArgumentMismatchCode = "BuiltinFunction--ArgumentMismatch"

Field Value

string

MathErrorCode

Diagnostic code for division / MOD by zero and domain errors.

public const string MathErrorCode = "Arithmetic--MathError"

Field Value

string

UnsupportedFunctionCode

Diagnostic code for unrecognised built-in function names.

public const string UnsupportedFunctionCode = "BuiltinFunction--Unsupported"

Field Value

string

VacantErrorCode

Diagnostic code emitted when an evaluated #nnn is vacant.

public const string VacantErrorCode = "Variable--Vacant"

Field Value

string

Methods

Evaluate(NcExpr, IVariableLookup)

Evaluates expr against variables.

public EvalResult Evaluate(NcExpr expr, IVariableLookup variables)

Parameters

expr NcExpr
variables IVariableLookup

Returns

EvalResult