This is an interactive programming environment for CESIL, an educational low-level programming language introduced in the 1970s. You can find out more on the Wikipedia page.
Accumulator | |
Program counter | |
Variables |
Copyright © 2024, Andrew Bovett. Licensed under GPL v3. Component attributions and licenses
Select one of these example CESIL programs to load it.
hello.cesil | A hello world program. |
timestable.cesil | Print a multiplication table. |
polynomial_graph.cesil | Plot a graph of a quartic polynomial. |
sinewave.cesil | Plot a graph of a sine wave. |
factors.cesil | Calculate the prime factors of a number. |
maze.cesil | Generate a psuedorandom maze with a single route. |
CESIL is a very simple low-level programming language, introduced as a teaching language in the 1970s. It is rather limited, having only two registers (an integer accumulator and the program counter) and 14 instructions. It is designed for batch processing and has no form of interactive or file input or output. Notable limitations are the lack of any form of subroutine call, and the absence of any form of indexing or arrays. However, creative programming can overcome even these limitations, as illustrated by the "maze" program on the examples page.
The Wikipedia page contains a summary of the language, and a brief reference to the language is available on the reference card.
Programs may be typed directly into the source code editor window, or loaded from a file on disk by clicking the Load button and navigating to the file. Alternatively, one of the example programs can be loaded via the Load example programs link. Programs can be saved to disk via the Save button.
The Format button will tidy up the column alignment of a program, should you wish to. This is done by converting all indentation to tabs. Tabs are set to 12 characters wide to ensure they are larger than the longest instructions (SUBTRACT and MULTIPLY).
Before executing a program it must be converted to a runnable form by clicking Compile. Any errors will be listed in the output window and highlighted in the source code. Clicking on the line number in an error message will jump to that line in the source code.
Once successfully compiled, clicking Run will execute the program, stopping when a HALT statement or a breakpoint is encountered. Clicking Run again after stopping at a breakpoint will continue execution at the next instruction.
The Step button can be used to execute one instruction at a time - this can be used from the start of the program, or after it has been halted via a breakpoint or use of the Stop button (which will halt a runaway program).
Breakpoints can be set or cleared by clicking on a line number in the source code - the line number will turn red when a breakpoint is set. The Clear breakpoints button will remove all breakpoints.
When stopped or single stepping, the next instruction to be executed will be highlighted in blue. The Reset button will reset the execution point to the start of the program (i.e. reset the program counter to 0).
Whenever the program is stopped, the values of the registers and variable will be shown in the "Computer state" window. The program counter is internal but is shown for completeness.
The code editor supports normal editing operations such as cursor and mouse navigation, and cut and paste, using the standard keys and mouse actions for the browser/operating system it is running under. It also supports the following:
Clicking the button (or typing any of the keyboard shortcuts listed below) will reveal the Find/Replace bar at the bottom of the screen. This supports the following functions:
Button | Keyboard | Action |
---|---|---|
Ctrl-f | Find forwards from the current position. | |
Ctrl-b | Find backwards from the current position. | |
Ctrl-r | If a find result is highlighted, replace it with the replacement text. | |
Ctrl-d | If a find result is highlighted, replace it with the replacement text. Then search down for the next occurrence of the find text. | |
Ctrl-u | If a find result is highlighted, replace it with the replacement text. Then search up for the previous occurrence of the find text. | |
Ctrl-Shift-F | Set the focus on the find input field. | |
Ctrl-Shift-R | Set the focus on the replace input field. | |
Ignore case | Ctrl-Shift-I | Toggle the "Ignore case" option. |
Whole words | Ctrl-Shift-O | Toggle the "Whole words" option. |
× | Escape | Close the find/replace bar. |
This CESIL implementation deviates in a few details from the original ICL CES reference card. In some ways it is more liberal:
However, it also has a few minor restrictions:
All source code for the CESIL application is licensed under the GPL v3 with the exception of the icons. The sources, licenses and attributions for the icons are shown below.