Class AlangExpr
Represents an expression in the Alang
(Automata language) used for defining finite-state automata.
Inherited Members
Namespace: Automata.Core.Alang
Assembly: Automata.Core.dll
Syntax
public abstract class AlangExpr
Remarks
For more information about the Alang
language, see the Alang Grammar Specification.
Constructors
| Edit this page View SourceAlangExpr()
Initializes a new instance of the AlangExpr class.
Declaration
protected AlangExpr()
Properties
| Edit this page View SourceAlangExpressionString
String representation of this expression in valid Alang language syntax.
Declaration
public abstract string AlangExpressionString { get; }
Property Value
Type | Description |
---|---|
string |
IsEmptyString
Indicates whether this expression is an empty string. An empty string is not a valid expression in Alang. Used internally by the Parser to handle empty strings.
Declaration
public bool IsEmptyString { get; }
Property Value
Type | Description |
---|---|
bool |
Precedence
Precedence level of this expression according to Alang grammar specification.
Declaration
public abstract int Precedence { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceParam(AlangExpr, AlangExpr)
Returns the expression string of the given expression, enclosed in parentheses only if necessary based on operator precedence.
Declaration
protected static string Param(AlangExpr expr, AlangExpr parent)
Parameters
Type | Name | Description |
---|---|---|
AlangExpr | expr | The expression to get the string representation of. |
AlangExpr | parent | The parent expression of |
Returns
Type | Description |
---|---|
string | The expression string, potentially enclosed in parentheses. |
Remarks
Parentheses are added if the precedence of the given expression is lower than the precedence of the parent.
Parse(string)
Parses the specified input string into an AlangExpr.
Declaration
public static AlangExpr Parse(string input)
Parameters
Type | Name | Description |
---|---|---|
string | input | The input string to parse. |
Returns
Type | Description |
---|---|
AlangExpr | An AlangExpr representing the parsed expression. |
Exceptions
Type | Condition |
---|---|
AlangFormatException | Thrown when the input is invalid. |
ToString()
String that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The expression string of this expression. |