PURE
Acronym for Pseudo-code Universally Readable for Examinations.
Developed by IBCA for use within the International Baccalaureate (IB) Computer Science course. (See also IBO).
Its main purposes are to present algorithms to students during examinations in a standardized and coherent manner, and to give students guidelines for answering problems requiring algorithmic solutions. However, in their answers, students need not adhere completely to the syntax outlined in the syllabus.
PURE includes such conventions as writing reserved words in lower-case, bold-faced text, whereas names of programs, libraries, user-defined data structures, constants, variables, subprograms, and functions (subprograms returning a single value as opposed to returning no value; PURE differentiates between subprograms and functions).
Being designed for such a formal purpose, PURE is generally stricter than ordinary pseudocode, but areas such as I/O, file access, and library functions are still relatively arbitrary, so as to ensure a high degree of portability of PURE-represented algorithmic solutions.
In the internally assessed portfolio project, which is part of the IB CS course, PURE is a stipulated step of the development process.
PURE is also an excellent example of the Anglo-Saxon practice of creating contrived titles for things in order to have a "cool" acronym for it (see backronym).
Example:
Assuming DATAFILE is declared as a file of a defined record type with a field of type integer, called NUMBER, and that this file is open:
function BINARY_SEARCH(val SEARCH integer, val BEGINNING integer, val END integer)
result integer
declare CURRENT, POSITION integer
CURRENT <-- BEGINNING + truncate((END - BEGINNING + 1)/2)
moveto(DATAFILE, CURRENT)
if SEARCH < DATAFILE.NUMBER then
END <-- CURRENT - 1
elsif SEARCH = DATAFILE.NUMBER then
BEGINNING <-- CURRENT
END <-- CURRENT
elsif SEARCH > FIL_CD.NAME then
BEGINNING <-- CURRENT
endif
if not END = BEGINNING then /* continue the search */
BEGINNING <-- BINARY_SEARCH(SEARCH, BEGINNING, END)
endif
return BEGINNING
endfunction BINARY_SEARCH