Class Parser
- Namespace
- Albatross.Expression.Parsing
- Assembly
- Albatross.Expression.dll
An immutable implementation of the IParser interface.
public class Parser : IParser
- Inheritance
-
Parser
- Implements
- Inherited Members
- Extension Methods
Constructors
Parser(IEnumerable<IExpressionFactory<IToken>>, bool)
public Parser(IEnumerable<IExpressionFactory<IToken>> factories, bool caseSensitive)
Parameters
factoriesIEnumerable<IExpressionFactory<IToken>>caseSensitivebool
Properties
CaseSensitive
Indicates whether this parser performs case-sensitive matching for keywords and identifiers.
public bool CaseSensitive { get; }
Property Value
Methods
BuildPostfixStack(Queue<IToken>)
Converts a token queue from infix notation to postfix (reverse Polish) notation using the shunting-yard algorithm.
public Stack<IToken> BuildPostfixStack(Queue<IToken> queue)
Parameters
Returns
CreateTree(Stack<IToken>)
Constructs an abstract syntax tree from a postfix token stack.
public IExpression CreateTree(Stack<IToken> postfix)
Parameters
Returns
- IExpression
The root expression node of the constructed syntax tree.
Tokenize(string)
Parses an expression string from left to right and produces a queue of tokens in infix notation.
public Queue<IToken> Tokenize(string expression)
Parameters
expressionstringThe expression string to tokenize.