{"id":13782430,"url":"https://github.com/JamesHinshelwood/RegisterMachineInterpreter","last_synced_at":"2025-05-11T15:32:30.156Z","repository":{"id":103592864,"uuid":"120330569","full_name":"JamesHinshelwood/RegisterMachineInterpreter","owner":"JamesHinshelwood","description":"Register machine interpreter written in C","archived":false,"fork":false,"pushed_at":"2018-03-03T00:24:12.000Z","size":74,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-17T17:43:16.813Z","etag":null,"topics":["computation-theory","interpreter","packer","register-machine","register-machine-interpreter","register-programs","registers","turing"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesHinshelwood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-05T16:26:58.000Z","updated_at":"2018-03-19T01:10:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f9f339ab-fb54-44bb-b53c-4e5ac11c733c","html_url":"https://github.com/JamesHinshelwood/RegisterMachineInterpreter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHinshelwood%2FRegisterMachineInterpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHinshelwood%2FRegisterMachineInterpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHinshelwood%2FRegisterMachineInterpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesHinshelwood%2FRegisterMachineInterpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesHinshelwood","download_url":"https://codeload.github.com/JamesHinshelwood/RegisterMachineInterpreter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253588740,"owners_count":21932313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computation-theory","interpreter","packer","register-machine","register-machine-interpreter","register-programs","registers","turing"],"created_at":"2024-08-03T18:01:36.983Z","updated_at":"2025-05-11T15:32:29.809Z","avatar_url":"https://github.com/JamesHinshelwood.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Register Machine Interpreter and Packer\nRegister machine interpreter written in C.  \nRegister machines and packed integer form are implemented as described [here](http://www.cl.cam.ac.uk/teaching/1718/CompTheory/CompTheory.pdf).\n\n### Compiling\n\nCan be compiled with `make`. You might have to change the compiler in `Makefile`.\n\n### Running\n\n#### Interpreter\n\n`interpreter` reads a program from stdin, and takes initial register values as arguments.\n\nFor example, `cat add.r | ./interpreter 0 7 8`, will run a register machine that computes R0=R1+R2=7+8.\n\n#### Packer\n\n`packer [-p|-u]` packs or unpacks a program from stdin and outputs the result. `-p` converts from a normal program to a packed integer. `-u` converts from a packed integer into a program.\n\nFor example, `cat add.r | ./packer -p` will convert the add program into an integer representation of it.  \n`cat add.r | ./packer -p | ./packer -u | ./interpreter 0 81 129` will convert add to an integer and back again, then run the program.\n\n### Register Machine Programs\n\nThe syntax of register programs is from [here](https://github.com/SophieDurrant/RegisterMachineSimulator). Thank you 🙂\n\nEach line of a file must be in one of the following formats:\n\n1. `HALT` will stop the program\n2. `INC REGISTER NEXT_LABEL` will increment `REGISTER` and jump to `NEXT_LABEL`\n3. `DEC REGISTER LABEL_1 LABEL_2` will decrement `REGISTER` and jump to `LABEL_1` if `REGISTER` is greater than zero, otherwise it will jump to `LABEL_2`\n\n`REGISTER`, `NEXT_LABEL`, `LABEL_1`, and `LABEL_2` must be nonnegative integers.\n\nThe first line of the file is L0 in the register machine, the second line is L1, and so on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJamesHinshelwood%2FRegisterMachineInterpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJamesHinshelwood%2FRegisterMachineInterpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJamesHinshelwood%2FRegisterMachineInterpreter/lists"}