Editor

OCR Exam Reference Language runner

Run the pseudocode OCR's GCSE papers are written in, and see exactly where a program goes wrong.

Tab indents, Ctrl+Enter runs.

The rules it follows

= assigns, == compares
total = total + 1 changes a variable; if total == 10 then asks a question. Mixing them up is an error on that line.
Arrays have a fixed size and start at 0
array scores[5] holds scores[0] to scores[4]. scores[5] stops the program with an error that names the array.
input() gives text
Comparing it with a number is an error that says to use int() or float() first.
for loops include the end
for i = 0 to 9 runs ten times; step -1 counts down.
Constants stay constant
const VAT = 0.2 cannot be changed later in the program.
global inside the main program
A subroutine can read a main-program variable; to change one, declare it global.
Strings count from 0
word.substring(1, 3) is three characters from the second; .length, .left(n), .right(n), .upper and .lower work too.
Text files
newFile("out.txt"), open, readLine, writeLine, endOfFile and close. The files live in the Text files panel.

Learning Python alongside? The Python lessons cover the same ideas with exercises that check your code.

Frequently asked questions

Which specification does it follow?
OCR's Exam Reference Language for GCSE (9-1) Computer Science J277, the language paper 2 questions are written in. Keywords are in lowercase; AND, OR, NOT, MOD and DIV are in capitals as OCR writes them, and lowercase versions are accepted too.
Is it just Python?
No. It looks close to Python, but arrays have a fixed size, for loops include their end value, blocks end with endif, endwhile and next, and random(1, 6) includes both ends. Python habits such as len(), range() or elif give an error that says how ERL writes it.
What is not supported?
Passing by reference (byRef is not part of J277), records and classes, and exception handling. Each gives a message saying so.
Is my work saved?
Your program and its text files are kept in this browser. Copy link makes a link to the program to share with a teacher or a friend.
Can I see the same program in Python?
Write it in Python in the editor and the Python to pseudocode converter shows it as structured English or Cambridge-style pseudocode, a good start for the ERL version.

More: All pseudocode runners · Cambridge pseudocode · Python to pseudocode · Python to flowchart

OCR (Oxford Cambridge and RSA Examinations) publishes the Exam Reference Language for GCSE Computer Science J277. OCR is not affiliated with this site and does not endorse it.