Table of Contents

Struct ProductionDefinition

Namespace
Farkle.Grammars
Assembly
Farkle.dll

Provides information about a production of a Grammar.

public readonly struct ProductionDefinition : IEquatable<ProductionDefinition>
Implements

Remarks

A production is a rule of the form A ::= b, where A (the Head) is a NonterminalDefinition and b (the Members) is a possibly empty sequence of terminals or nonterminals such that when the right-hand side symbols are encountered, they can derive and be substituted by the left-hand side symbol.

Properties

Handle

public ProductionHandle Handle { get; }

Property Value

ProductionHandle

Remarks

In earlier versions of Farkle the Handle property referred to the property that is now called Members.

Head

The nonterminal on the ProductionDefinition's left-hand side.

public NonterminalDefinition Head { get; }

Property Value

NonterminalDefinition

Members

The terminals or nonterminals on the ProductionDefinition's right-hand side.

public ProductionMemberList Members { get; }

Property Value

ProductionMemberList

Methods

Equals(ProductionDefinition)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ProductionDefinition other)

Parameters

other ProductionDefinition

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns a string describing the ProductionDefinition.

public override string ToString()

Returns

string

Operators

operator ==(ProductionDefinition, ProductionDefinition)

Compares two ProductionDefinitions for equality.

public static bool operator ==(ProductionDefinition left, ProductionDefinition right)

Parameters

left ProductionDefinition

The first production.

right ProductionDefinition

The second production.

Returns

bool

operator !=(ProductionDefinition, ProductionDefinition)

Compares two ProductionDefinitions for inequality.

public static bool operator !=(ProductionDefinition left, ProductionDefinition right)

Parameters

left ProductionDefinition

The first production.

right ProductionDefinition

The second production.

Returns

bool

See Also