Pseudocode Interpreter
Github
Enter UK style Pseudocode, and it compiles to Python
// Bubblesort Tech // Notice how it still works even with inconsistencies in the FOR loops and Assignment statements DECLARE a : ARRAY[3] OF INTEGER a[0] = 1 a[1] = 0 a[2] = -1 a[3] = -2 length = 3 PROCEDURE BubbleSort(arr , length) exchanges <- True WHILE exchanges == True exchanges <- False FOR i <- 0 TO length - 2 IF arr[i] > arr[i+1] THEN temp <- arr[i] arr[i] <- arr[i+1] arr[i+1] <- temp exchanges <- True ENDIF NEXT i ENDWHILE ENDPROCEDURE CALL BubbleSort(a, length) FOR i <- 0 TO length - 1 OUTPUT a[i] ENDFOR
Compile to Python
Run
Output: