{"id":16724376,"url":"https://github.com/badboy/small-step-simple-rust","last_synced_at":"2025-03-15T14:41:04.083Z","repository":{"id":19622011,"uuid":"22873671","full_name":"badboy/small-step-simple-rust","owner":"badboy","description":"https://fnordig.de/2014/08/12/first-experience-with-rust/","archived":false,"fork":false,"pushed_at":"2015-03-03T19:50:04.000Z","size":710,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T19:52:09.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Microsoft/CNTK","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/badboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-12T10:33:31.000Z","updated_at":"2019-04-17T23:50:24.000Z","dependencies_parsed_at":"2022-07-23T13:16:16.366Z","dependency_job_id":null,"html_url":"https://github.com/badboy/small-step-simple-rust","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/badboy%2Fsmall-step-simple-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fsmall-step-simple-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fsmall-step-simple-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fsmall-step-simple-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badboy","download_url":"https://codeload.github.com/badboy/small-step-simple-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243746132,"owners_count":20341202,"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":[],"created_at":"2024-10-12T22:45:00.787Z","updated_at":"2025-03-15T14:41:04.062Z","avatar_url":"https://github.com/badboy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# small-step approach to the SIMPLE language in Rust\n\n[Blog post about my first experience with Rust](https://fnordig.de/2014/08/12/first-experience-with-rust/)\n\n---\n\nThis is an implementation of the small-step approach to the SIMPLE language as introduced by\n[Tom Stuart](https://twitter.com/tomstuart) in \"Understanding Computation\", Chapter 1, \"The Meaning of Programs\".\nSee his website: \u003chttp://computationbook.com/\u003e.\n\nThe usage is pretty simple. As there is no parser for SIMPLE (yet?) you have to write the AST\nyourself. A few macros are provided for easy access. You can then create a virtual machine and\npass this AST plus an environment hash. When calling `run`, the machine steps through the code,\nreducing it until it reaches a point where no further reduction is possible.\n\n```rust\nlet mut env = HashMap::new();\nenv.insert(\"y\".to_string(), number!(1));\n\nlet mut m = Machine::new(\n    sequence!(\n        assign!(\"x\", number!(3)),\n        assign!(\"res\", add!(add!(number!(38), variable!(\"x\")), variable!(\"y\")))\n        ),\n        env\n    );\n\nm.run();\n// At this point `res` in the HashMap will be `Number(42)`\n```\n\n\nThe code is much larger as the equivalent Ruby code. This is both due to the restricitions\nof Rust (explicit types and everything, a good thing) and my non-existing experience with Rust\nat all (this is my first Rust code larger than a simple \"Hello World\")\n\n\n## License\n\nJust like the [original Ruby source code](https://github.com/tomstuart/computationbook), this Rust source code is released under the [CC0 1.0 Public Domain Dedication](http://creativecommons.org/publicdomain/zero/1.0/), which means that you can do whatever you like with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fsmall-step-simple-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadboy%2Fsmall-step-simple-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fsmall-step-simple-rust/lists"}