private void Expacc() { _currentNode.AddChild(new ParseNode(ParseEnum.ExpressionAccent)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; if (_current is AddSub) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Term(); Expacc(); } else if (_current is Equals) { _currentNode.AddChild(new ParseNode(ParseEnum.Equals)); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Expressie(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } _currentNode = _currentNode.GetParent(); }
private void Expressie() { _currentNode.AddChild(new ParseNode(ParseEnum.Expression)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; Term(); Expacc(); _currentNode = _currentNode.GetParent(); }
private void Factor() { _currentNode.AddChild(new ParseNode(ParseEnum.Factor)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; if (_current is OpenParenthesis) { _currentNode.AddChild(new ParseNode(ParseEnum.OpenParenthesis)); _current = _lex.GetNextToken(); Expressie(); if (_current is CloseParenthesis) { _currentNode.AddChild(new ParseNode(ParseEnum.CloseParenthesis)); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } } } else if (_current is Variable) { _currentNode.AddChild(new ParseNode(ParseEnum.Variable, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } } else if (_current is Number) { _currentNode.AddChild(new ParseNode(ParseEnum.Number, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } } else { Console.WriteLine("Syntaxfout."); Stop(); } _currentNode = _currentNode.GetParent(); }
private void Termacc() { _currentNode.AddChild(new ParseNode(ParseEnum.TermAccent)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; if (_current is Operator) { _currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue())); if (!_lex.EndOfInput) { _current = _lex.GetNextToken(); } Factor(); Termacc(); } else { _currentNode.AddChild(new ParseNode(ParseEnum.Empty)); } _currentNode = _currentNode.GetParent(); }
private void Term() { _currentNode.AddChild(new ParseNode(ParseEnum.Term)); _currentNode = _currentNode.GetChildren()[_currentNode.GetChildren().Count - 1]; Factor(); Termacc(); _currentNode = _currentNode.GetParent(); }