Crates.io | p101_is |
lib.rs | p101_is |
version | 0.9.0 |
source | src |
created_at | 2024-10-07 22:03:42.991357 |
updated_at | 2024-10-07 22:03:42.991357 |
description | Represent Olivetti Programma 101 programs |
homepage | |
repository | https://gitlab.com/cokkaai/programma_101/-/tree/master/is |
max_upload_size | |
id | 1400509 |
size | 82,043 |
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.