fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class Program
  5.  
  6. {
  7.  
  8. static void Main()
  9. {
  10.  
  11. Stack<string> sti = new Stack<string>();
  12. sti.Push("E");
  13. string ip;
  14. //ip=Console.ReadLine();
  15. ip="i+i";
  16. ip=ip+"$";
  17.  
  18. Dictionary<string, string> E = new Dictionary<string, string>();
  19. E.Add("+", "Te");
  20. E.Add("-", "Te");
  21. E.Add("*", "Te");
  22. E.Add("/", "Te");
  23. E.Add("(", "Te");
  24. E.Add(")", "Te");
  25. E.Add("i", "Te");
  26. E.Add("c", "Te");
  27. E.Add("$", "Te");
  28.  
  29. Dictionary<string, string> e = new Dictionary<string, string>();
  30. e.Add("+", "TTe");
  31. e.Add("-", "-Te");
  32. e.Add("*", "");
  33. e.Add("/", "");
  34. e.Add("i", "");
  35. e.Add("c", "");
  36. e.Add("(", "");
  37. e.Add(")", "");
  38. e.Add("$", "");
  39.  
  40. Dictionary<string, string> T = new Dictionary<string, string>();
  41. T.Add("+", "Ft");
  42. T.Add("-", "Ft");
  43. T.Add("*", "Ft");
  44. T.Add("/", "Ft");
  45. T.Add("i", "Ft");
  46. T.Add("c", "Ft");
  47. T.Add("(", "Ft");
  48. T.Add(")", "Ft");
  49. T.Add("$", "Ft");
  50.  
  51. Dictionary<string, string> t = new Dictionary<string, string>();
  52. t.Add("+", "X");
  53. t.Add("-", "X");
  54. t.Add("*", "*Ft");
  55. t.Add("/", "/Ft");
  56. t.Add("i", "");
  57. t.Add("c", "");
  58. t.Add("(", "");
  59. t.Add(")", "");
  60. t.Add("$", "");
  61.  
  62. Dictionary<string, string> F = new Dictionary<string, string>();
  63. F.Add("+", "X");
  64. F.Add("-", "X");
  65. F.Add("*", "X");
  66. F.Add("/", "X");
  67. F.Add("i", "iA");
  68. F.Add("c", "C");
  69. F.Add("(", "(E)");
  70. F.Add(")", "X");
  71. F.Add("$", "X");
  72.  
  73. Dictionary<string, string> A = new Dictionary<string, string>();
  74. A.Add("+", "");
  75. A.Add("-", "");
  76. A.Add("*", "");
  77. A.Add("/", "");
  78. A.Add("i", "");
  79. A.Add("c", "");
  80. A.Add("(", "(E)");
  81. A.Add(")", "");
  82. A.Add("$", "");
  83. int j;
  84. for(int i=0;i<ip.Length;i++)
  85. {
  86. string tmp;
  87. while(true)
  88. {
  89. tmp=sti.Pop();
  90.  
  91. if(tmp=="E")
  92. {
  93. for(j=E[ip[i]].Length-1;j>=0;j--)
  94. sti.Push(E[ip[i]][j]);
  95. }
  96.  
  97. if(tmp=="e")
  98. {
  99. for(j=e[ip[i]].Length-1;j>=0;j--)
  100. sti.Push(e[ip[i]][j]);
  101. }
  102. if(tmp=="T")
  103. {
  104. for(j=T[ip[i]].Length-1;j>=0;j--)
  105. sti.Push(T[ip[i]][j]);
  106. }
  107. if(tmp=="t")
  108. {
  109. for(j=t[ip[i]].Length-1;j>=0;j--)
  110. sti.Push(t[ip[i]][j]);
  111. }
  112. if(tmp=="F")
  113. {
  114. for(j=F[ip[i]].Length-1;j>=0;j--)
  115. sti.Push(F[ip[i]][j]);
  116. }
  117. if(tmp=="A")
  118. {
  119. for(j=A[ip[i]].Length-1;j>=0;j--)
  120. sti.Push(A[ip[i]][j]);
  121. }
  122.  
  123. if(sti.Peak()==ip[i])
  124. break;
  125. ////////////
  126.  
  127. }
  128. }
  129. foreach (string i in sti)
  130. {
  131. Console.WriteLine(i);
  132. }
  133.  
  134. }
  135.  
  136. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(93,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(93,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(94,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(94,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(94,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(94,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(99,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(99,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(100,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(100,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(100,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(100,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(104,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(104,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(105,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(105,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(105,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(105,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(109,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(109,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(110,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(110,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(110,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(110,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(114,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(114,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(115,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(115,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(115,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(115,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(119,48): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(119,48): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(120,51): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<string,string>.this[string]' has some invalid arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(120,51): error CS1503: Argument `#1' cannot convert `char' expression to type `string'
prog.cs(120,45): error CS1502: The best overloaded method match for `System.Collections.Generic.Stack<string>.Push(string)' has some invalid arguments
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(120,45): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
prog.cs(123,40): error CS1061: Type `System.Collections.Generic.Stack<string>' does not contain a definition for `Peak' and no extension method `Peak' of type `System.Collections.Generic.Stack<string>' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
Compilation failed: 37 error(s), 0 warnings
stdout
Standard output is empty