17 using System.Collections.Generic;
41 private TextWriter output;
58 #region printIndentation
64 private void printIndentation(
int lenght)
66 for (
int i = 0; i < lenght * 2; i++)
68 this.output.Write(
" ");
70 this.output.Write(
"|_ ");
75 #region Visit(SourceFile node, Object obj)
79 int indent = Convert.ToInt32(obj);
80 this.printIndentation(indent);
81 this.output.WriteLine(
"Source code [{0}:{1}]", node.Location.Line, node.Location.Column);
82 this.printIndentation(indent + 1);
83 this.output.WriteLine(
"Usings");
84 for (
int i = 0; i < node.Usings.Count; i++)
86 this.printIndentation(indent + 2);
87 this.output.WriteLine(node.Usings[i]);
90 foreach (
string key
in node.Namespacekeys)
92 int count = node.GetNamespaceDefinitionCount(key);
93 for (
int i = 0; i < count; i++)
95 node.GetNamespaceDeclarationElement(key, i).Accept(
this, indent + 1);
99 for (
int i = 0; i < node.DeclarationCount; i++)
101 this.printIndentation(indent + 1);
102 this.output.WriteLine(
"Definition");
103 node.GetDeclarationElement(i).Accept(
this, indent + 2);
110 #region Visit(Namespace node, Object obj)
114 int indent = Convert.ToInt32(obj);
116 this.printIndentation(indent);
117 this.output.WriteLine(
"Namespace: {0} [{1}:{2}]", node.Identifier.Identifier, node.Location.Line, node.Location.Column);
119 for (
int i = 0; i < node.NamespaceMembersCount; i++)
121 this.printIndentation(indent + 1);
122 this.output.WriteLine(
"Definition");
123 node.GetDeclarationElement(i).Accept(
this, indent + 2);
137 return type.ToString();
139 return "ERROR!! NO ASIGNADO";
145 #region Visit(IdDeclaration node, Object obj
149 int indent = Convert.ToInt32(obj);
150 this.printIndentation(indent);
152 this.output.WriteLine(
"Declaration: {0}{1} [{2}:{3}]", node.Identifier, node.IdentifierExp.IndexOfSSA, node.Location.Line, node.Location.Column);
154 this.output.WriteLine(
"Declaration: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
155 this.printIndentation(indent + 1);
156 this.output.Write(
"Type: ");
157 this.output.WriteLine(printType(node.
TypeExpr));
163 #region Visit(PropertyDefinition node, Object obj)
167 int indent = Convert.ToInt32(obj);
168 this.printIndentation(indent);
169 this.output.WriteLine(
"Property: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
171 this.printIndentation(indent + 1);
172 this.output.Write(
"Type: ");
173 this.output.WriteLine(printType(node.
TypeExpr));
177 this.printIndentation(indent + 1);
178 this.output.WriteLine(
"GetAccesor");
179 node.GetBlock.Accept(
this, indent + 2);
183 this.printIndentation(indent + 1);
184 this.output.WriteLine(
"SetAccesor");
185 node.SetBlock.Accept(
this, indent + 2);
192 #region Visit(Definition node, Object obj)
196 int indent = Convert.ToInt32(obj);
197 this.printIndentation(indent);
199 this.output.WriteLine(
"Definition: {0}{1} [{2}:{3}]", node.Identifier, node.IdentifierExp.IndexOfSSA, node.Location.Line, node.Location.Column);
201 this.output.WriteLine(
"Definition: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
202 this.printIndentation(indent + 1);
203 this.output.Write(
"Type: ");
204 this.output.WriteLine(printType(node.
TypeExpr));
205 return node.Init.Accept(
this, indent + 1);
210 #region Visit(ConstantDefinition node, Object obj)
214 int indent = Convert.ToInt32(obj);
215 this.printIndentation(indent);
217 this.output.WriteLine(
"Constant Definition: {0}{1} [{2}:{3}]", node.Identifier, node.IdentifierExp.IndexOfSSA, node.Location.Line, node.Location.Column);
219 this.output.WriteLine(
"Constant Definition: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
220 this.printIndentation(indent + 1);
221 this.output.Write(
"Type: ");
222 this.output.WriteLine(printType(node.
TypeExpr));
224 return node.Init.Accept(
this, indent + 1);
229 #region Visit(ClassDefinition node, Object obj)
233 int indent = Convert.ToInt32(obj);
234 this.printIndentation(indent);
235 this.output.WriteLine(
"Class: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
237 this.printIndentation(indent + 1);
238 this.output.Write(
"Type: ");
239 this.output.WriteLine(printType(node.
TypeExpr));
241 for (
int i = 0; i < node.MemberCount; i++)
243 node.GetMemberElement(i).Accept(
this, indent + 1);
250 #region Visit(InterfaceDefinition node, Object obj)
254 int indent = Convert.ToInt32(obj);
255 this.printIndentation(indent);
256 this.output.WriteLine(
"Interface: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
258 this.printIndentation(indent + 1);
259 this.output.Write(
"Type: ");
260 this.output.WriteLine(printType(node.
TypeExpr));
262 for (
int i = 0; i < node.MemberCount; i++)
264 node.GetMemberElement(i).Accept(
this, indent + 1);
271 #region Visit(FieldDeclaration node, Object obj)
275 int indent = Convert.ToInt32(obj);
276 this.printIndentation(indent);
277 this.output.WriteLine(
"Field: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
279 this.printIndentation(indent + 1);
280 this.output.Write(
"Type: ");
281 this.output.WriteLine(printType(node.
TypeExpr));
288 #region Visit(FieldDefinition node, Object obj)
292 int indent = Convert.ToInt32(obj);
293 this.printIndentation(indent);
294 this.output.WriteLine(
"Field: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
296 this.printIndentation(indent + 1);
297 this.output.Write(
"Type: ");
298 this.output.WriteLine(printType(node.
TypeExpr));
300 return node.Init.Accept(
this, indent + 1);
305 #region Visit(ConstantFieldDefinition node, Object obj)
309 int indent = Convert.ToInt32(obj);
310 this.printIndentation(indent);
311 this.output.WriteLine(
"Constant Field: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
312 this.printIndentation(indent + 1);
313 this.output.Write(
"Type: ");
314 this.output.WriteLine(printType(node.
TypeExpr));
316 return node.Init.Accept(
this, indent + 1);
321 #region Visit(MethodDeclaration node, Object obj)
325 int indent = Convert.ToInt32(obj);
326 this.printIndentation(indent);
327 this.output.WriteLine(
"Method: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
329 this.printIndentation(indent + 1);
330 this.output.Write(
"Type: ");
331 this.output.WriteLine(printType(node.
TypeExpr));
338 #region Visit(MethodDefinition node, Object obj)
342 int indent = Convert.ToInt32(obj);
343 this.printIndentation(indent);
344 this.output.WriteLine(
"Method: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
346 this.printIndentation(indent + 1);
347 this.output.Write(
"Type: ");
348 this.output.WriteLine(printType(node.
TypeExpr));
350 return node.Body.Accept(
this, indent + 1);
355 #region Visit(ConstructorDefinition node, Object obj)
359 int indent = Convert.ToInt32(obj);
360 this.printIndentation(indent);
361 this.output.WriteLine(
"Constructor: {0} [{1}:{2}]", node.Identifier, node.Location.Line, node.Location.Column);
363 this.printIndentation(indent + 1);
364 this.output.Write(
"Type: ");
365 this.output.WriteLine(printType(node.
TypeExpr));
368 node.Initialization.Accept(
this, indent + 1);
369 return node.Body.Accept(
this, indent + 1);
376 #region Visit(ArgumentExpression node, Object obj)
380 int indent = Convert.ToInt32(obj);
381 this.printIndentation(indent);
382 this.output.WriteLine(
"Argument [{0}:{1}]", node.Location.Line, node.Location.Column);
383 return node.Argument.Accept(
this, indent + 1);
388 #region Visit(ArithmeticExpression node, Object obj)
392 int indent = Convert.ToInt32(obj);
393 this.printIndentation(indent);
394 this.output.Write(
"ArithmeticExpression ");
397 case ArithmeticOperator.Minus: this.output.Write(
"-");
break;
398 case ArithmeticOperator.Plus: this.output.Write(
"+");
break;
399 case ArithmeticOperator.Mult: this.output.Write(
"*");
break;
400 case ArithmeticOperator.Div: this.output.Write(
"/");
break;
401 case ArithmeticOperator.Mod: this.output.Write(
"%");
break;
403 this.output.WriteLine(
" Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
404 node.FirstOperand.Accept(
this, indent + 1);
405 node.SecondOperand.Accept(
this, indent + 1);
411 #region Visit(ArrayAccessExpression node, Object obj)
415 int indent = Convert.ToInt32(obj);
416 this.printIndentation(indent);
417 this.output.WriteLine(
"ArrayAccessExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
418 node.FirstOperand.Accept(
this, indent + 1);
419 node.SecondOperand.Accept(
this, indent + 1);
425 #region Visit(AssignmentExpression node, Object obj)
429 int indent = Convert.ToInt32(obj);
430 this.printIndentation(indent);
431 this.output.Write(
"AssignmentExpression ");
434 case AssignmentOperator.Assign: this.output.Write(
"=");
break;
435 case AssignmentOperator.PlusAssign: this.output.Write(
"+=");
break;
436 case AssignmentOperator.MinusAssign: this.output.Write(
"-=");
break;
437 case AssignmentOperator.MultAssign: this.output.Write(
"*=");
break;
438 case AssignmentOperator.DivAssign: this.output.Write(
"/=");
break;
439 case AssignmentOperator.ModAssign: this.output.Write(
"%=");
break;
440 case AssignmentOperator.ShiftRightAssign: this.output.Write(
">>=");
break;
441 case AssignmentOperator.ShiftLeftAssign: this.output.Write(
"<<=");
break;
442 case AssignmentOperator.BitwiseAndAssign: this.output.Write(
"&=");
break;
443 case AssignmentOperator.BitwiseXOrAssign: this.output.Write(
"^=");
break;
444 case AssignmentOperator.BitwiseOrAssign: this.output.Write(
"|=");
break;
446 this.output.WriteLine(
" Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column); node.FirstOperand.Accept(
this, indent + 1);
447 node.SecondOperand.Accept(
this, indent + 1);
449 node.MoveStat.Accept(
this, indent + 1);
455 #region Visit(BaseCallExpression node, Object obj)
459 int indent = Convert.ToInt32(obj);
460 this.printIndentation(indent);
461 this.output.WriteLine(
"BaseCallExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
462 return node.Arguments.Accept(
this, indent + 1);
467 #region Visit(BitwiseExpression node, Object obj)
471 int indent = Convert.ToInt32(obj);
472 this.printIndentation(indent);
473 this.output.Write(
"BitwiseExpression ");
476 case BitwiseOperator.BitwiseOr: this.output.Write(
"|");
break;
477 case BitwiseOperator.BitwiseAnd: this.output.Write(
"&");
break;
478 case BitwiseOperator.BitwiseXOr: this.output.Write(
"^");
break;
479 case BitwiseOperator.ShiftLeft: this.output.Write(
"<<");
break;
480 case BitwiseOperator.ShiftRight: this.output.Write(
">>");
break;
482 this.output.WriteLine(
" Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
483 node.FirstOperand.Accept(
this, indent + 1);
484 node.SecondOperand.Accept(
this, indent + 1);
490 #region Visit(CastExpression node, Object obj)
494 int indent = Convert.ToInt32(obj);
495 this.printIndentation(indent);
496 this.output.WriteLine(
"CastExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
497 return node.Expression.Accept(
this, indent + 1);
502 #region Visit(FieldAccessExpression node, Object obj)
506 int indent = Convert.ToInt32(obj);
507 this.printIndentation(indent);
508 this.output.WriteLine(
"FieldAccessExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
509 node.Expression.Accept(
this, indent + 1);
510 node.FieldName.Accept(
this, indent + 1);
516 #region Visit(InvocationExpression node, Object obj)
520 int indent = Convert.ToInt32(obj);
521 this.printIndentation(indent);
522 this.output.WriteLine(
"InvocationExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
523 node.Identifier.Accept(
this, indent + 1);
524 node.Arguments.Accept(
this, indent + 1);
530 #region Visit(IsExpression node, Object obj)
534 int indent = Convert.ToInt32(obj);
535 this.printIndentation(indent);
536 this.output.WriteLine(
"IsExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
537 node.Expression.Accept(
this, indent + 1);
538 this.printIndentation(indent + 1);
539 this.output.WriteLine(printType(node.
TypeExpr));
545 #region Visit(LogicalExpression node, Object obj)
549 int indent = Convert.ToInt32(obj);
550 this.printIndentation(indent);
551 this.output.Write(
"LogicalExpression ");
554 case LogicalOperator.Or: this.output.Write(
"||");
break;
555 case LogicalOperator.And: this.output.Write(
"&&");
break;
557 this.output.WriteLine(
" Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
558 node.FirstOperand.Accept(
this, indent + 1);
559 node.SecondOperand.Accept(
this, indent + 1);
565 #region Visit(NewArrayExpression node, Object obj)
569 int indent = Convert.ToInt32(obj);
570 this.printIndentation(indent);
571 this.output.WriteLine(
"NewArrayExpression: {0} rank: {1} Type: {2} [{3}:{4}]", node.TypeInfo, node.Rank, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
572 if (node.
Size != null)
574 this.printIndentation(indent + 1);
575 this.output.WriteLine(
"Size:");
576 node.Size.Accept(
this, indent + 2);
578 if (node.
Init != null)
579 node.Init.Accept(
this, indent + 1);
585 #region Visit(NewExpression node, Object obj)
589 int indent = Convert.ToInt32(obj);
590 this.printIndentation(indent);
591 this.output.WriteLine(
"NewExpression: {0} Type: {1} [{2}:{3}]", node.TypeInfo, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
592 return node.Arguments.Accept(
this, indent + 1);
597 #region Visit(QualifiedIdentifierExpression node, Object obj)
601 int indent = Convert.ToInt32(obj);
602 this.printIndentation(indent);
603 this.output.WriteLine(
"QualifiedIdentifierExpression Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
604 node.IdName.Accept(
this, indent + 1);
605 node.IdExpression.Accept(
this, indent + 1);
611 #region Visit(RelationalExpression node, Object obj)
615 int indent = Convert.ToInt32(obj);
616 this.printIndentation(indent);
617 this.output.Write(
"RelationalExpression ");
620 case RelationalOperator.NotEqual: this.output.Write(
"!=");
break;
621 case RelationalOperator.Equal: this.output.Write(
"==");
break;
622 case RelationalOperator.LessThan: this.output.Write(
"<");
break;
623 case RelationalOperator.GreaterThan: this.output.Write(
">");
break;
624 case RelationalOperator.LessThanOrEqual: this.output.Write(
"<=");
break;
625 case RelationalOperator.GreaterThanOrEqual: this.output.Write(
">=");
break;
627 this.output.WriteLine(
" Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
628 node.FirstOperand.Accept(
this, indent + 1);
629 node.SecondOperand.Accept(
this, indent + 1);
635 #region Visit(TernaryExpression node, Object obj)
639 int indent = Convert.ToInt32(obj);
640 this.printIndentation(indent);
641 this.output.WriteLine(
"TernaryExpression ? Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
642 node.FirstOperand.Accept(
this, indent + 1);
643 node.SecondOperand.Accept(
this, indent + 1);
644 node.ThirdOperand.Accept(
this, indent + 1);
650 #region Visit(UnaryExpression node, Object obj)
654 int indent = Convert.ToInt32(obj);
655 this.printIndentation(indent);
656 this.output.Write(
"UnaryExpression ");
659 case UnaryOperator.BitwiseNot: this.output.Write(
"~");
break;
660 case UnaryOperator.Minus: this.output.Write(
"-");
break;
661 case UnaryOperator.Not: this.output.Write(
"!");
break;
662 case UnaryOperator.Plus: this.output.Write(
"+");
break;
663 case UnaryOperator.PostfixDecrement:
664 case UnaryOperator.PrefixDecrement: this.output.Write(
"--");
break;
665 case UnaryOperator.PostfixIncrement:
666 case UnaryOperator.PrefixIncrement: this.output.Write(
"++");
break;
668 this.output.WriteLine(
"Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
669 node.Operand.Accept(
this, indent + 1);
680 #region Visit(BaseExpression node, Object obj)
684 this.printIndentation(Convert.ToInt32(obj));
685 this.output.WriteLine(
"base Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
691 #region Visit(BoolLiteralExpression node, Object obj)
695 this.printIndentation(Convert.ToInt32(obj));
696 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.BoolValue, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
702 #region Visit(CharLiteralExpression node, Object obj)
706 this.printIndentation(Convert.ToInt32(obj));
707 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.CharValue, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
713 #region Visit(DoubleLiteralExpression node, Object obj)
717 this.printIndentation(Convert.ToInt32(obj));
718 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.DoubleValue, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
724 #region Visit(IntLiteralExpression node, Object obj)
728 this.printIndentation(Convert.ToInt32(obj));
729 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.IntValue, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
735 #region Visit(NullExpression node, Object obj)
739 this.printIndentation(Convert.ToInt32(obj));
740 this.output.WriteLine(
"null Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
746 #region Visit(SingleIdentifierExpression node, Object obj)
750 this.printIndentation(Convert.ToInt32(obj));
752 this.output.WriteLine(
"{0}{1} Type: {2} [{3}:{4}]", node.Identifier, node.IndexOfSSA, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
754 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.Identifier, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
760 #region Visit(StringLiteralExpression node, Object obj)
764 this.printIndentation(Convert.ToInt32(obj));
765 this.output.WriteLine(
"{0} Type: {1} [{2}:{3}]", node.StringValue, printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
771 #region Visit(ThisExpression node, Object obj)
775 this.printIndentation(Convert.ToInt32(obj));
776 this.output.WriteLine(
"this Type: {0} [{1}:{2}]", printType(node.
ExpressionType), node.Location.Line, node.Location.Column);
784 #region Visit(BreakStatement node, Object obj)
788 this.printIndentation(Convert.ToInt32(obj));
789 this.output.WriteLine(
"break [{0}:{1}]", node.Location.Line, node.Location.Column);
795 #region Visit(CatchStatement node, Object obj)
799 int indent = Convert.ToInt32(obj);
800 this.printIndentation(indent);
801 this.output.WriteLine(
"CatchStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
802 node.Exception.Accept(
this, indent + 1);
803 node.Statements.Accept(
this, indent + 1);
809 #region Visit(ContinueStatement node, Object obj)
813 this.printIndentation(Convert.ToInt32(obj));
814 this.output.WriteLine(
"continue [{0}:{1}]", node.Location.Line, node.Location.Column);
820 #region Visit(DoStatement node, Object obj)
824 int indent = Convert.ToInt32(obj);
825 this.printIndentation(indent);
826 this.output.WriteLine(
"DoStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
827 this.printIndentation(indent + 1);
828 this.output.WriteLine(
"Init");
829 for (
int i = 0; i < node.InitDo.Count; i++)
831 node.InitDo[i].Accept(
this, indent + 2);
833 this.printIndentation(indent + 1);
834 this.output.WriteLine(
"Before Body");
835 for (
int i = 0; i < node.BeforeBody.Count; i++)
837 node.BeforeBody[i].Accept(
this, indent + 2);
839 this.printIndentation(indent + 1);
840 this.output.WriteLine(
"Statements");
841 node.Statements.Accept(
this, indent + 2);
842 this.printIndentation(indent + 1);
843 this.output.WriteLine(
"Condition");
844 node.Condition.Accept(
this, indent + 2);
850 #region Visit(ForeachStatement node, Object obj)
854 int indent = Convert.ToInt32(obj);
855 this.printIndentation(indent);
856 this.output.WriteLine(
"ForeachStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
857 node.ForEachDeclaration.Accept(
this, indent + 1);
858 node.ForeachExp.Accept(
this, indent + 1);
859 node.ForeachBlock.Accept(
this, indent + 1);
865 #region Visit(ForStatement node, Object obj)
869 int indent = Convert.ToInt32(obj);
870 this.printIndentation(indent);
871 this.output.WriteLine(
"ForStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
872 this.printIndentation(indent + 1);
873 this.output.WriteLine(
"Initialization");
874 for (
int i = 0; i < node.InitializerCount; i++)
876 node.GetInitializerElement(i).Accept(
this, indent + 2);
878 this.printIndentation(indent + 1);
879 this.output.WriteLine(
"After initialization");
880 for (
int i = 0; i < node.AfterInit.Count; i++)
882 node.AfterInit[i].Accept(
this, indent + 2);
884 this.printIndentation(indent + 1);
885 this.output.WriteLine(
"Before condition");
886 for (
int i = 0; i < node.BeforeCondition.Count; i++)
888 node.BeforeCondition[i].Accept(
this, indent + 2);
890 this.printIndentation(indent + 1);
891 this.output.WriteLine(
"Condition");
892 node.Condition.Accept(
this, indent + 2);
894 this.printIndentation(indent + 1);
895 this.output.WriteLine(
"After condition");
896 for (
int i = 0; i < node.AfterCondition.Count; i++)
898 node.AfterCondition[i].Accept(
this, indent + 2);
900 this.printIndentation(indent + 1);
901 this.output.WriteLine(
"Statements");
902 node.Statements.Accept(
this, indent + 2);
904 this.printIndentation(indent + 1);
905 this.output.WriteLine(
"Iterators");
906 for (
int i = 0; i < node.IteratorCount; i++)
908 node.GetIteratorElement(i).Accept(
this, indent + 2);
916 #region Visit(IfElseStatement node, Object obj)
920 int indent = Convert.ToInt32(obj);
921 this.printIndentation(indent);
922 this.output.WriteLine(
"IfElseStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
923 this.printIndentation(indent + 1);
924 this.output.WriteLine(
"Condition");
925 node.Condition.Accept(
this, indent + 2);
926 this.printIndentation(indent + 1);
927 this.output.WriteLine(
"After Condition");
928 for (
int i = 0; i < node.AfterCondition.Count; i++)
930 node.AfterCondition[i].Accept(
this, indent + 2);
932 this.printIndentation(indent + 1);
933 this.output.WriteLine(
"True branch");
934 node.TrueBranch.Accept(
this, indent + 2);
935 this.printIndentation(indent + 1);
936 this.output.WriteLine(
"False branch");
937 node.FalseBranch.Accept(
this, indent + 2);
938 this.printIndentation(indent + 1);
939 this.output.WriteLine(
"Theta functions");
940 for (
int i = 0; i < node.ThetaStatements.Count; i++)
942 node.ThetaStatements[i].Accept(
this, indent + 2);
949 #region Visit(ReturnStatement node, Object obj)
953 int indent = Convert.ToInt32(obj);
954 node.Assigns.Accept(
this, indent);
955 this.printIndentation(indent);
956 this.output.WriteLine(
"ReturnStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
958 return node.ReturnExpression.Accept(
this, indent + 1);
964 #region Visit(SwitchLabel node, Object obj)
968 int indent = Convert.ToInt32(obj);
969 this.printIndentation(indent);
972 this.output.WriteLine(
"Case [{0}:{1}]", node.Location.Line, node.Location.Column);
973 node.Condition.Accept(
this, indent + 1);
976 this.output.WriteLine(
"Default [{0}:{1}]", node.Location.Line, node.Location.Column);
982 #region Visit(SwitchSection node, Object obj)
986 int indent = Convert.ToInt32(obj);
987 this.printIndentation(indent);
988 this.output.WriteLine(
"Switch section [{0}:{1}]", node.Location.Line, node.Location.Column);
989 this.printIndentation(indent + 1);
990 this.output.WriteLine(
"Switch label");
991 for (
int i = 0; i < node.LabelSection.Count; i++)
993 node.LabelSection[i].Accept(
this, indent + 2);
995 this.printIndentation(indent + 1);
996 this.output.WriteLine(
"Statements");
997 for (
int i = 0; i < node.SwitchBlock.StatementCount; i++)
999 node.SwitchBlock.GetStatementElement(i).Accept(
this, indent + 2);
1006 #region Visit(SwitchStatement node, Object obj)
1010 int indent = Convert.ToInt32(obj);
1011 this.printIndentation(indent);
1012 this.output.WriteLine(
"SwitchStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
1013 this.printIndentation(indent + 1);
1014 this.output.WriteLine(
"Condition");
1015 node.Condition.Accept(
this, indent + 2);
1016 this.printIndentation(indent + 1);
1017 this.output.WriteLine(
"After Condition");
1018 for (
int i = 0; i < node.AfterCondition.Count; i++)
1020 node.AfterCondition[i].Accept(
this, indent + 2);
1022 this.printIndentation(indent + 1);
1023 this.output.WriteLine(
"Switch block");
1024 for (
int i = 0; i < node.SwitchBlockCount; i++)
1026 node.GetSwitchSectionElement(i).Accept(
this, indent + 2);
1028 this.printIndentation(indent + 1);
1029 this.output.WriteLine(
"Theta functions");
1030 for (
int i = 0; i < node.ThetaStatements.Count; i++)
1032 node.ThetaStatements[i].Accept(
this, indent + 2);
1039 #region Visit(ThrowStatement node, Object obj)
1043 int indent = Convert.ToInt32(obj);
1044 this.printIndentation(indent);
1045 this.output.WriteLine(
"ThrowStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
1048 return node.ThrowExpression.Accept(
this, indent + 1);
1053 #region Visit(ExceptionManagementStatement node, Object obj)
1057 int indent = Convert.ToInt32(obj);
1058 this.printIndentation(indent);
1059 this.output.WriteLine(
"TryStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
1060 node.TryBlock.Accept(
this, indent + 1);
1061 this.printIndentation(indent);
1062 this.output.WriteLine(
"Catch [{0}:{1}]", node.Location.Line, node.Location.Column);
1063 for (
int i = 0; i < node.CatchCount; i++)
1065 node.GetCatchElement(i).Accept(
this, indent + 1);
1068 this.printIndentation(indent);
1069 this.output.WriteLine(
"Finally [{0}:{1}]", node.Location.Line, node.Location.Column);
1070 node.FinallyBlock.Accept(
this, indent + 1);
1077 #region Visit(WhileStatement node, Object obj)
1081 int indent = Convert.ToInt32(obj);
1082 this.printIndentation(indent);
1083 this.output.WriteLine(
"WhileStatement [{0}:{1}]", node.Location.Line, node.Location.Column);
1084 this.printIndentation(indent + 1);
1085 this.output.WriteLine(
"Init");
1086 for (
int i = 0; i < node.InitWhile.Count; i++)
1088 node.InitWhile[i].Accept(
this, indent + 2);
1090 this.printIndentation(indent + 1);
1091 this.output.WriteLine(
"Before Condition");
1092 for (
int i = 0; i < node.BeforeCondition.Count; i++)
1094 node.BeforeCondition[i].Accept(
this, indent + 2);
1096 this.printIndentation(indent + 1);
1097 this.output.WriteLine(
"Condition");
1098 node.Condition.Accept(
this, indent + 2);
1099 this.printIndentation(indent + 1);
1100 this.output.WriteLine(
"After Condition");
1101 for (
int i = 0; i < node.AfterCondition.Count; i++)
1103 node.AfterCondition[i].Accept(
this, indent + 2);
1105 this.printIndentation(indent + 1);
1106 this.output.WriteLine(
"Statements");
1107 node.Statements.Accept(
this, indent + 2);
1113 #region Visit(MoveStatement node, Object obj)
1117 this.printIndentation(Convert.ToInt32(obj));
1120 this.output.Write(
"{0}{1}", node.LeftExp.Identifier, node.LeftExp.IndexOfSSA);
1122 this.output.Write(
"{0}", node.LeftExp.Identifier);
1125 this.output.Write(
" <-- ");
1128 this.output.Write(
"{0}{1}", node.RightExp.Identifier, node.RightExp.IndexOfSSA);
1130 this.output.Write(
"{0}", node.RightExp.Identifier);
1135 node.MoveStat.Accept(
this, obj);
1141 #region Visit(ThetaStatement node, Object obj)
1145 this.printIndentation(Convert.ToInt32(obj));
1146 this.output.Write(
"{0}{1} = 0(", node.ThetaId.Identifier, node.ThetaId.IndexOfSSA);
1147 for (
int i = 0; i < node.ThetaList.Count - 1; i++)
1150 this.output.Write(
"{0}{1}", node.ThetaList[i].Identifier, node.ThetaList[i].IndexOfSSA);
1152 this.output.Write(
"{0}", node.ThetaList[i].Identifier);
1154 this.output.Write(
" ({0}), ", printType(node.
ThetaList[i].ExpressionType));
1158 this.output.Write(
"{0}{1}", node.ThetaList[node.ThetaList.Count - 1].Identifier, node.ThetaList[node.ThetaList.Count - 1].IndexOfSSA);
1160 this.output.Write(
"{0}", node.ThetaList[node.ThetaList.Count - 1].Identifier);
1162 this.output.WriteLine(
" ({0}))", printType(node.
ThetaList[node.
ThetaList.Count - 1].ExpressionType));
Encapsulates a Return statement of our programming languages.
Encapsulates a 'base' expression.
Encapsulates a definition of a concrete method.
override Object Visit(ThetaStatement node, Object obj)
override Object Visit(IdDeclaration node, Object obj)
Encapsulates a Break statement of our programming languages.
Encapsulates the qualified name expression.
Encapsulates a Case statement of our programming languages.
override Object Visit(IsExpression node, Object obj)
Statement GetBlock
Gets the statements associated to the get accessor.
Encapsulates a Do statement of our programming language.
Encapsulates a string literal expression.
Encapsulates the expression to access a field.
override Object Visit(SingleIdentifierExpression node, Object obj)
AssignmentOperator Operator
Gets the operator of the binary expression
override Object Visit(CatchStatement node, Object obj)
Encapsulates a namespace definition.
Encapsulates a Catch statement of our programming languages.
Encapsulates a logical binary expression.
Encapsulates a invocation expression.
Encapsulates a boolean literal expression.
Encapsulates a cast expression.
Encapsulates a definition of a concrete field.
TypeExpression ExpressionType
Gets or sets the type of the expression.
SectionType SwitchSectionType
Gets the type of the Case statement (case or default)
override Object Visit(ArithmeticExpression node, Object obj)
override Object Visit(ForStatement node, Object obj)
override Object Visit(BitwiseExpression node, Object obj)
MoveStatement MoveStat
Gets or sets a move statement associated to the assignment expression.
override Object Visit(FieldDefinition node, Object obj)
override Object Visit(NewArrayExpression node, Object obj)
override Object Visit(IntLiteralExpression node, Object obj)
Encapsulates a constant field definition.
override Object Visit(PropertyDefinition node, Object obj)
Encapsulates a definition.
override Object Visit(SwitchStatement node, Object obj)
Encapsulates arithmetic binary expressions.
SingleIdentifierExpression RightExp
Gets the right expression
Abstract class that represents all different types.
RelationalOperator Operator
Gets the operator of the binary expression
Encapsulates a For statement of our programming languages.
Encapsulates a While statement of our programming languages.
override Object Visit(ExceptionManagementStatement node, Object obj)
Encapsulates a null expression.
Encapsulates a Is expression.
Encapsulates a definition of a concrete interface.
Encapsulates a switch label (Case + condition or Default section).
override Object Visit(DoStatement node, Object obj)
Encapsulates a identifier expression of our programming language.
override Object Visit(StringLiteralExpression node, Object obj)
override Object Visit(LogicalExpression node, Object obj)
override Object Visit(Namespace node, Object obj)
Encapsulates a declaration of a concrete method.
override Object Visit(InterfaceDefinition node, Object obj)
override Object Visit(NewExpression node, Object obj)
override Object Visit(ContinueStatement node, Object obj)
Encapsulates a Theta function to use in SSA algorithm.
Expression ThrowExpression
Gets the throw expression.
TypeExpression TypeExpr
Gets the type to check with the expression.
Encapsulates a relational binary expression.
Encapsulates a bitwise binary expression.
override Object Visit(FieldAccessExpression node, Object obj)
SingleIdentifierExpression IdentifierExp
Gets the identifier expression
Encapsulates assignment binary expressions.
override Object Visit(BaseCallExpression node, Object obj)
CompoundExpression Init
Gets or sets the array initialization
override Object Visit(ForeachStatement node, Object obj)
Encapsulates a ternary expression of our programming language.
Encapsulates a If-Else statement of our programming language.
override Object Visit(ArrayAccessExpression node, Object obj)
Encapsulates a new array expression.
Encapsulates a definition of a concrete constructor.
override Object Visit(QualifiedIdentifierExpression node, Object obj)
MoveStatement MoveStat
Gets or sets a move statement associated to the current move statement.
override Object Visit(SwitchSection node, Object obj)
override Object Visit(BreakStatement node, Object obj)
Encapsulates the source code.
override Object Visit(FieldDeclaration node, Object obj)
Encapsulates a Try-Catch-finally statement of our programming languages. As C# states catch blcok and...
override Object Visit(DoubleLiteralExpression node, Object obj)
Encapsulates a string literal expression.
This class shows the information of the abstract syntax tree.
SingleIdentifierExpression LeftExp
Gets the left expression
override Object Visit(ClassDefinition node, Object obj)
Encapsulates a declaration.
Encapsulates a argument expression of our programming language.
VisitorDebug(TextWriter writer)
Constructor of VisitorDebug
int IndexOfSSA
Gets or sets the index associated with SSA algorithm
Encapsulates a 'this' expression.
override Object Visit(CastExpression node, Object obj)
Encapsulates a unary expression of our programming language.
List< SingleIdentifierExpression > ThetaList
Gets the parameter of theta funcion
override Object Visit(TernaryExpression node, Object obj)
override Object Visit(ThrowStatement node, Object obj)
override Object Visit(Definition node, Object obj)
BitwiseOperator Operator
Gets the operator of the binary expression
override Object Visit(MethodDefinition node, Object obj)
override Object Visit(ReturnStatement node, Object obj)
Expression Size
Gets or sets the array size
override Object Visit(ConstantFieldDefinition node, Object obj)
LogicalOperator Operator
Gets the operator of the binary expression
override Object Visit(ThisExpression node, Object obj)
InvocationExpression Initialization
Gets the base or this initialization of the constructor definition
Expression ReturnExpression
Gets the return expression.
override Object Visit(IfElseStatement node, Object obj)
SectionType
Indicates if it is a case statement or a default case.
override Object Visit(WhileStatement node, Object obj)
Encapsulates a integer literal expression.
Encapsulates a declaration of a concrete field.
override Object Visit(InvocationExpression node, Object obj)
Encapsulates a constant definition.
Encapsulates the array expression to access the concrete position.
ArithmeticOperator Operator
Gets the operator of the binary expression
Block FinallyBlock
Gets the statements executed in Finally block. if there is no finally statementes can be null ...
override Object Visit(ConstructorDefinition node, Object obj)
Encapsulates a Move instruction to use in SSA algorithm
override Object Visit(ArgumentExpression node, Object obj)
override Object Visit(BoolLiteralExpression node, Object obj)
Encapsulates a Continue statement of our programming languages.
override Object Visit(ConstantDefinition node, Object obj)
override Object Visit(BaseExpression node, Object obj)
UnaryOperator Operator
Gets the operator of the unary operation
Statement SetBlock
Gets the statements associated to the set accessor.
override Object Visit(MoveStatement node, Object obj)
Encapsulates a Throw statement of our programming languages.
override Object Visit(RelationalExpression node, Object obj)
Encapsulates a Foreach statement of our programming languages.
Encapsulates a invocation expression to base class.
Encapsulates a new expression.
override Object Visit(MethodDeclaration node, Object obj)
Encapsulates a property definition.
Encapsulates a definition of a concrete class.
override Object Visit(CharLiteralExpression node, Object obj)
override Object Visit(SwitchLabel node, Object obj)
TypeExpression TypeExpr
Gets or sets the type of the declaration
Encapsulates a Switch statement of our programming languages.
override Object Visit(UnaryExpression node, Object obj)
override Object Visit(NullExpression node, Object obj)
override Object Visit(SourceFile node, Object obj)
override Object Visit(AssignmentExpression node, Object obj)