The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
ArithmeticExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: ArithmeticExpression.cs //
6 // Authors: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Francisco Ortin - francisco.ortin@gmail.com //
8 // Description: //
9 // Encapsulates arithmetic binary expressions. //
10 // Inheritance: BinaryExpression. //
11 // Implements Composite pattern [Composite]. //
12 // Implements Visitor pattern [Concrete Element]. //
13 // -------------------------------------------------------------------------- //
14 // Create date: 05-12-2006 //
15 // Modification date: 06-04-2007 //
17 
18 using System;
19 using System.Collections.Generic;
20 using System.Text;
21 
22 using Tools;
23 using ErrorManagement;
24 
25 namespace AST {
26  #region ArithmeticOperator
27 
31  public enum ArithmeticOperator {
35  Minus = 1,
36 
40  Plus = 2,
41 
45  Mult = 3,
46 
50  Div = 4,
51 
55  Mod = 5,
56  }
57  #endregion
58 
68  #region Fields
69 
73  private ArithmeticOperator op;
74 
75  #endregion
76 
77  #region Properties
78 
83  get { return op; }
84  }
85 
86  #endregion
87 
88  #region Constructor
89 
100  : base(operand1, operand2, location) {
101  this.op = op;
102  }
103 
104  #endregion
105 
106  #region Accept()
107 
114  public override Object Accept(Visitor v, Object o) {
115  return v.Visit(this, o);
116  }
117 
118  #endregion
119 
120  #region ToString()
121  public override string ToString() {
122  return this.op.ToString();
123  }
124  #endregion
125  }
126 }
Encapsulates a binary expression of our programming language.
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
a % b
Abstract class to define different visits over the abstract syntax tree.
Definition: Visitor.cs:29
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Definition: Location.cs:24
Encapsulates arithmetic binary expressions.
a * b
a + b
ArithmeticOperator
Arithmetic binary operators
ArithmeticExpression(Expression operand1, Expression operand2, ArithmeticOperator op, Location location)
Constructor de la clase ArithmeticExpression
a / b
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
a - b
ArithmeticOperator Operator
Gets the operator of the binary expression