Struct ProductionDefinition
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
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
Members
The terminals or nonterminals on the ProductionDefinition's right-hand side.
public ProductionMemberList Members { get; }
Property Value
Methods
Equals(ProductionDefinition)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ProductionDefinition other)
Parameters
otherProductionDefinitionAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
Operators
operator ==(ProductionDefinition, ProductionDefinition)
Compares two ProductionDefinitions for equality.
public static bool operator ==(ProductionDefinition left, ProductionDefinition right)
Parameters
leftProductionDefinitionThe first production.
rightProductionDefinitionThe second production.
Returns
operator !=(ProductionDefinition, ProductionDefinition)
Compares two ProductionDefinitions for inequality.
public static bool operator !=(ProductionDefinition left, ProductionDefinition right)
Parameters
leftProductionDefinitionThe first production.
rightProductionDefinitionThe second production.