| Crates.io | p101_enc |
| lib.rs | p101_enc |
| version | 0.11.0 |
| created_at | 2024-10-09 21:32:14.400632+00 |
| updated_at | 2025-08-11 14:58:33.829856+00 |
| description | Library to convert Olivetti P101 program to and from different encodings |
| homepage | |
| repository | https://gitlab.com/cokkaai/programma_101/-/tree/master/enc |
| max_upload_size | |
| id | 1403071 |
| size | 90,434 |
A simulator, as any computer, it is hardly useful with no programs. Since I didn't know how to program a P101, I started looking at other simulators for P101 sources. I found out that there is no standard format. So, in order to read all such formats I implemented a generic framework leveraging traits and a strongly typed instruction representation.
The Encoding trait defines how to convert a text line in an instruction and vice versa. There are two encodings:
On the web I found other encoding loosely based on CSV triples that I may support in the future. For instance https://github.com/Fabioamd87/P101, which is similar to the (retired?) emulator for University of Cassino.
Optionally one can implement the Annotator trait to comment each line during encoding. I find this improve code readability as P101 instruction are largely simbolic and you have to get used to.
Encodings are used by a generic Encoder to convert program into text and a generic Decoder to convert a text into a Program. The LariniDecoder is specialized for the format used by the simulator wrote by Claudio Larini that also has made available most P101 programs.