TEXT   11

tests.txt

Guest on 25th July 2021 04:55:12 PM

  1. TEST CASES:
  2.  
  3. x = 2; y = (x + 1);
  4. print y
  5. !
  6.  
  7.  
  8. x = 3;
  9. y = 0;
  10. while x :
  11.   x = (x - 1);
  12.   y = (y+1)
  13. end ;
  14. print x;  print y
  15. !
  16.  
  17.  
  18. STAGE 1: ADD MULTIPLICATION:
  19.  
  20. x = (2 * 3);  y = (x * x)
  21. !
  22.  
  23.  
  24. x = ((2 * 3) + 1);
  25. y = (2 * x)
  26. !
  27.  
  28.  
  29. STAGE 2: ADD CONDTIONAL COMMANDS:
  30.  
  31. x = 2;
  32. if x :
  33.    y = 1
  34. else  y = 0 end
  35. !
  36.  
  37.  
  38. x = 4; y = 0;
  39. while x :
  40.   if (x - y):  y = (y+1)  else  x = 0 end;
  41.   print y
  42. end
  43. !
  44.  
  45.  
  46.  
  47. STAGE 3: ADD ARRAY CONSTRUCTION:
  48.  
  49.  
  50. x = 2;  print x;
  51. x = newarray 6;
  52. print x
  53. !
  54.  
  55.  
  56. x = 2;
  57. x = newarray (x + 1);
  58. print x
  59. !
  60.  
  61.  
  62.  
  63. STAGE 4: ADD ARRAY INDEXING:
  64.  
  65. y = 5;
  66. x = newarray y;
  67. x[2] = y;
  68. print x
  69. !
  70.  
  71.  
  72. x = newarray 5;  x[4] = 99;
  73. y = 0;
  74. x[y] = x[(y + 4)]
  75. !
  76.  
  77.  
  78. x = 6;  y = newarray x;
  79. while x :
  80.   x = (x-1);
  81.   y[x] = (x+1)
  82. end
  83. !

Raw Paste


Login or Register to edit or fork this paste. It's free.