Wyrm.CESIL
1.1.0
dotnet add package Wyrm.CESIL --version 1.1.0
NuGet\Install-Package Wyrm.CESIL -Version 1.1.0
<PackageReference Include="Wyrm.CESIL" Version="1.1.0" />
<PackageVersion Include="Wyrm.CESIL" Version="1.1.0" />
<PackageReference Include="Wyrm.CESIL" />
paket add Wyrm.CESIL --version 1.1.0
#r "nuget: Wyrm.CESIL, 1.1.0"
#:package Wyrm.CESIL@1.1.0
#addin nuget:?package=Wyrm.CESIL&version=1.1.0
#tool nuget:?package=Wyrm.CESIL&version=1.1.0
Wyrm.CESIL
An interpreter library for the CESIL language written as an excercise in writing interpreters.
Getting Started
A CESIL Intepreter instance can be created trivially as:
using Wyrm.CESIL;
using Wyrm.CESIL.Executing;
using Wyrm.CESIL.Lexical;
using Wyrm.CESIL.Parsing;
...
var interpreter = new Interpreter(
new Analyser(new CesilTokenRules()),
new Parser(new CesilInstructionBuilder()),
new Executor(new CesilOperator(), new OperationStateFactory()));
Which you'd typically call in a factory method. You can also implement this in dependency injection by adding the following service/implementation types:
| Service | Implementation |
|---|---|
| ITokenMatcher | CesilTokenRules |
| ILexer | Analyser |
| IInstructionBuilder | CesilInstructionBuilder |
| IParser | Parser |
| IOperator | CesilOperator |
| IOperationStateFactory | OperationStateFactory |
| IExecutor | Executor |
| IInterpreter | Interpreter |
Then simply inject IInterpreter into your class constructor.
You call the Load method to load the program (and data). Then you can call the Run method to run it. If you call Load again then it will append to the existing program. This is useful if you have data separate to the program. To clear the program and data you can call the Clear method.
Introduction to CESIL
CESIL (Computer Education in Schools Instruction Language) was an early attempt by ICL to introduce children to software development. It was prevalent in the late 60's and throughout the 70's. Essentially a very basic Assembly Language, it was excellent for getting children to learn how to do a lot with a few instructions. Any line in CESIL that starts with an asterisk is treated as a comment, as are any lines beginning with '('. A valid CESIL line of code is made up of an optional label, followed by a space (required), then followed by an instruction. There are 14 instructions in total that operate either on a single integer 'accumulator' or named stores (variables). Labels and stores must start with a letter and contain letters and digits only. After the last instruction there must be a '%' character on a new line which can then be followed by one or more new lines of space separated integer data values.
CESIL Instructions
| Instruction | Description |
|---|---|
| IN | Read data item into accumulator. |
| OUT | Print content of accumulator. |
| LOAD VALUE | Load accumulator with an integer constant or from a named store. |
| STORE VALUE | Store the integer in the accumulator into a named store. |
| ADD VALUE | Add an integer constant or value in a named store to the accumulator. |
| SUBTRACT VALUE | Subtract an integer constant or value in a named store from the accumulator. |
| MULTIPLY VALUE | Multiply accumulator with an integer constant or value in a named store. |
| DIVIDE VALUE | Divide accumulator with an integer constant or value in a named store and truncate to an integer. |
| JUMP LABEL | Jump to the instruction at the label. |
| JIZERO LABEL | Jump to the instruction at the label if the accumulator is 0. |
| JINEG LABEL | Jump to the instruction at the label if the accumulator is negative. |
| LINE | Print a new line. |
| PRINT "string" | Print the string in quotes (use "" to include a quote in the string). |
| HALT | Stop execution. |
Example Program
** Squares
** Example Program
LOOP IN
JINEG END
OUT
STORE NUMBER
PRINT " squared is "
MULTIPLY NUMBER
OUT
LINE
JUMP LOOP
END HALT
%
5 72 111
67 -1
*
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 23 | 11/17/2025 |
| 1.0.0 | 143 | 7/12/2025 |
| 0.1.0 | 160 | 7/22/2024 |
| 0.1.0-alpha.3 | 89 | 7/19/2024 |
| 0.1.0-alpha.2 | 82 | 7/19/2024 |
| 0.1.0-alpha.1 | 73 | 7/17/2024 |