45
|
1 |
using System;
|
|
2 |
using System.Collections.Generic;
|
|
3 |
using System.Text;
|
|
4 |
|
|
5 |
|
|
6 |
public abstract class Statement
|
|
7 |
{
|
|
8 |
}
|
|
9 |
|
|
10 |
public class DeclareVariable : Statement
|
|
11 |
{
|
|
12 |
public string Identifier;
|
|
13 |
public Expression Expression;
|
|
14 |
}
|
|
15 |
|
|
16 |
public class DeclareFunction : Statement
|
|
17 |
{
|
|
18 |
public string FunctionName;
|
|
19 |
public DeclareVariable Parameter1;
|
|
20 |
public DeclareVariable Parameter2;
|
|
21 |
public DeclareVariable Parameter3;
|
|
22 |
public String ReturnType;
|
|
23 |
public Statement Body;
|
|
24 |
}
|
|
25 |
|
|
26 |
public class CallFunction : Statement
|
|
27 |
{
|
|
28 |
public string FunctionName;
|
|
29 |
public Expression Parameter1;
|
|
30 |
public Expression Parameter2;
|
|
31 |
public Expression Parameter3;
|
|
32 |
public Identifier ReturnVariable;
|
|
33 |
}
|
|
34 |
|
|
35 |
public class Write : Statement
|
|
36 |
{
|
|
37 |
public Expression Expression;
|
|
38 |
}
|
|
39 |
|
|
40 |
public class Assignment : Statement
|
|
41 |
{
|
|
42 |
public string Identifier;
|
|
43 |
public Expression Expression;
|
|
44 |
}
|
|
45 |
|
|
46 |
public class For : Statement
|
|
47 |
{
|
|
48 |
public string Identifier;
|
|
49 |
public Expression From;
|
|
50 |
public Expression To;
|
|
51 |
public Statement Body;
|
|
52 |
}
|
|
53 |
|
|
54 |
public class IfThenElse : Statement
|
|
55 |
{
|
|
56 |
public Expression If;
|
|
57 |
public Statement Then;
|
|
58 |
public Statement Else;
|
|
59 |
}
|
|
60 |
|
|
61 |
public class IfThen : Statement
|
|
62 |
{
|
|
63 |
public Expression LeftExpression;
|
|
64 |
public RelationalOperands Operand;
|
|
65 |
public Expression RightExpression;
|
|
66 |
public Statement ThenBody;
|
|
67 |
public Statement ElseBody;
|
|
68 |
}
|
|
69 |
|
|
70 |
public class While : Statement
|
|
71 |
{
|
|
72 |
public Expression LeftExpression;
|
|
73 |
public RelationalOperands Operand;
|
|
74 |
public Expression RightExpression;
|
|
75 |
public Statement Body;
|
|
76 |
}
|
|
77 |
|
|
78 |
public class ReadInput : Statement
|
|
79 |
{
|
|
80 |
public string Identifier;
|
|
81 |
}
|
|
82 |
|
|
83 |
public class StatementSequence : Statement
|
|
84 |
{
|
|
85 |
public Statement Left;
|
|
86 |
public Statement Right;
|
|
87 |
}
|
|
88 |
|
|
89 |
public abstract class Expression
|
|
90 |
{
|
|
91 |
}
|
|
92 |
|
|
93 |
public class AlphaNumericValue : Expression
|
|
94 |
{
|
|
95 |
public string Value;
|
|
96 |
}
|
|
97 |
|
|
98 |
public class NumericValue : Expression
|
|
99 |
{
|
|
100 |
public int Value;
|
|
101 |
}
|
|
102 |
|
|
103 |
public class Identifier : Expression
|
|
104 |
{
|
|
105 |
public string IdentifierName;
|
|
106 |
}
|
|
107 |
|
|
108 |
public class ArithmaticExpression : Expression
|
|
109 |
{
|
|
110 |
public Expression Left;
|
|
111 |
public Expression Right;
|
|
112 |
public ArithmaticOperands Operand;
|
|
113 |
}
|
|
114 |
|
|
115 |
public enum ArithmaticOperands
|
|
116 |
{
|
|
117 |
Add,
|
|
118 |
Subtract,
|
|
119 |
Multiply,
|
|
120 |
Division
|
|
121 |
}
|
|
122 |
|
|
123 |
public class LogicalExpression : Expression
|
|
124 |
{
|
|
125 |
public Expression Left;
|
|
126 |
public Expression Right;
|
|
127 |
public LogicalOperands Operand;
|
|
128 |
}
|
|
129 |
|
|
130 |
public enum LogicalOperands
|
|
131 |
{
|
|
132 |
Or,
|
|
133 |
And,
|
|
134 |
Xor,
|
|
135 |
Not
|
|
136 |
}
|
|
137 |
|
|
138 |
public class RelationalExpression : Expression
|
|
139 |
{
|
|
140 |
public Expression Left;
|
|
141 |
public Expression Right;
|
|
142 |
public RelationalOperands Operand;
|
|
143 |
}
|
|
144 |
|
|
145 |
public class CompareVariable : Statement
|
|
146 |
{
|
|
147 |
public string Identifier;
|
|
148 |
public Expression Expression;
|
|
149 |
public RelationalOperands Operand;
|
|
150 |
}
|
|
151 |
|
|
152 |
public enum RelationalOperands
|
|
153 |
{
|
|
154 |
EqualTo,
|
|
155 |
NotEqualTo,
|
|
156 |
LessThan,
|
|
157 |
LessThanOrEqualTo,
|
|
158 |
GreaterThan,
|
|
159 |
GreaterThanOrEqualTo
|
|
160 |
}
|