Пример #1
0
 public SubstractNode(ExpressionNode leftNode, ExpressionNode rightNode)
     : base(leftNode,rightNode)
 {
     Rules.Add("IntTypexIntType", new IntType());
     Rules.Add("FloatTypexFloatType", new FloatType());
     Rules.Add("IntTypexFloatType", new FloatType());
     Rules.Add("FloatTypexIntType", new FloatType());
 }
Пример #2
0
 public MultiplicationNode(ExpressionNode leftNode, ExpressionNode rightNode)
     : base(leftNode, rightNode)
 {
     Rules.Add("IntTypexIntType", new IntType());
     Rules.Add("BooleanTypexBooleanType", new BooleanType());
     Rules.Add("FloatTypexFloatType", new FloatType());
     Rules.Add("IntTypexFloatType", new FloatType());
     Rules.Add("FloatTypexIntType", new FloatType());
 }
Пример #3
0
 public SumNode(ExpressionNode leftNode, ExpressionNode rightNode)
     : base(leftNode,rightNode)
 {
     Rules.Add("IntTypexIntType",new IntType());
     Rules.Add("StringTypexStringType", new StringType());
     Rules.Add("StringTypexIntType", new StringType());
     Rules.Add("BooleanTypexBooleanType", new BooleanType());
     Rules.Add("FloatTypexFloatType", new FloatType());
     Rules.Add("IntTypexFloatType", new FloatType());
     Rules.Add("FloatTypexIntType", new FloatType());
 }
Пример #4
0
 private ExpressionNode ExprP(ExpressionNode param)
 {
     if (CurrentToken.Type == TokenType.Sum)
     {
         ConsumeToken();
         var fvalor=Factor();
         return ExprP(new SumNode(param,fvalor));
     }
     else if (CurrentToken.Type == TokenType.Sub)
     {
         ConsumeToken();
         var fvalor = Factor();
         return ExprP(new SubstractNode(param , fvalor));
     }
     else
         return  param;
 }
Пример #5
0
 public AssignmentNode(IdNode idNode, ExpressionNode value)
 {
     ID_Node = idNode;
     Value = value;
 }
 public BinaryOperationNode(ExpressionNode leftNode, ExpressionNode rightNode)
 {
     LeftNode = leftNode;
     RightNode = rightNode;
 }
Пример #7
0
 public PrintNode(ExpressionNode value)
 {
     Value = value;
 }
Пример #8
0
 public ReadNode(ExpressionNode variable)
 {
     Variable = variable;
 }
Пример #9
0
 public WhileNodoStatement(ExpressionNode expr, List<StatementNode> list)
 {
     Condition = expr;
     Code = list;
 }
Пример #10
0
 public IfNodeStatement(ExpressionNode condition, List<StatementNode> statementList, List<StatementNode> falseCode)
 {
     Condition = condition;
     TrueCode = statementList;
     FalseCode = falseCode;
 }
Пример #11
0
 public AssignmentNode(ExpressionNode variable, ExpressionNode value)
 {
     Variable = variable;
     Value = value;
 }
Пример #12
0
 private ExpressionNode VariableP(ExpressionNode param)
 {
     if (CurrentToken.Type == TokenType.LeftBracket)
     {
         ConsumeToken();
         var expL =ExprList();
         if (CurrentToken.Type != TokenType.RightBracket)
             throw new ParserException("Se esperaba ] ");
         ConsumeToken();
         return VariableP(new VaribleArrayNode(param,expL));
     }
     else
     {
         return param;
     }
 }
Пример #13
0
        private ExpressionNode FactorP(ExpressionNode param)
        {
            if (CurrentToken.Type == TokenType.Mult)
            {
                ConsumeToken();
                var tvalor =Term();

                return FactorP(new MultiplicationNode(param,tvalor));
            }
            else if (CurrentToken.Type == TokenType.Div)
            {
                ConsumeToken();

                 var tvalor = Term();
                 return FactorP(new DivisionNode(param ,tvalor));
            }
            else
            {
                return param;
            }
        }
Пример #14
0
 public VaribleArrayNode(ExpressionNode expressionNode, List<ExpressionNode> expL)
 {
     Variable = expressionNode;
     Dimension = expL;
 }