private AST Node(bool isFirstNode) { if (currentToken.Type == TokenType.PLUS || currentToken.Type == TokenType.MINUS) { OperatorToken unaryOpToken = Eat(currentToken.Type) as OperatorToken; return(new UnaryOpAST(unaryOpToken, Node(isFirstNode))); } else if (currentToken.Type == TokenType.LPAR) { Eat(TokenType.LPAR); BusAST busAST = Bus(); Eat(TokenType.RPAR); return(busAST); } else if (currentToken.Type == TokenType.DIGIT) { DigitToken digitToken = Eat(TokenType.DIGIT) as DigitToken; return(new DigitBlockAST(digitToken)); } else if (currentToken.Type == TokenType.LBRK) { if (isFirstNode) { return(MatrixMux()); } else { return(MatrixDeMux()); } } else { return(Selector()); } }
private Group Visit(BusAST busAST) { Group busGroup = new Group(); foreach (ChainAST chainAST in busAST.Chains) { Group group = Visit(chainAST); busGroup.Merge(group); } return(busGroup); }