{"id":31209672,"url":"https://github.com/upvalue/tcl3","last_synced_at":"2025-09-21T02:27:36.656Z","repository":{"id":310118226,"uuid":"1029982791","full_name":"upvalue/tcl3","owner":"upvalue","description":"A Tcl interpreter derived from Picol written in C++, Rust and Zig ","archived":false,"fork":false,"pushed_at":"2025-09-11T04:49:04.000Z","size":275,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-11T05:54:33.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/upvalue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-31T22:36:05.000Z","updated_at":"2025-09-11T04:49:08.000Z","dependencies_parsed_at":"2025-08-15T22:34:53.378Z","dependency_job_id":"90b6d177-fff8-4898-9e66-9fe69f2102a0","html_url":"https://github.com/upvalue/tcl3","commit_stats":null,"previous_names":["upvalue/tcl3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/upvalue/tcl3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upvalue%2Ftcl3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upvalue%2Ftcl3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upvalue%2Ftcl3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upvalue%2Ftcl3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upvalue","download_url":"https://codeload.github.com/upvalue/tcl3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upvalue%2Ftcl3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276183931,"owners_count":25599248,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-21T02:27:33.943Z","updated_at":"2025-09-21T02:27:36.632Z","avatar_url":"https://github.com/upvalue.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tcl3\n\nThis was an experiment in implementing a simple Tcl interpreter in C++, Zig and Rust. Just to get a sense of how they feel.\n\nRead the article here: [Trialing Zig and Rust with a Tcl interpreter](https://upvalue.io/posts/trialing-zig-and-rust-by-writing-a-tcl-interpreter/)\n\n# Building\n\nYou can run the script `./build.sh` which will attempt to build all\nimplementations and report status -- it assumes the toolchain for each language\nis accessible in the environment so if you don't have e.g. Zig installed then\nthat build will fail. It also assumes you have GNU make installed as `make`.\n\nZig was at 0.14.1, not tested on 0.15 and will likely fail. \n\n# Low hanging fruit\n\nSome low hanging fruit if you wanted to improve:\n\n- Use hash tables for commands at the least, maybe variables\n- Cache integer parsing, make individual math commands\n- Add some basic metaprogramming and list functionality\n- Could reduce allocs further by keeping a buffer around for result\n- Make the code more idiomatic for languages (e.g. use iterators for Parser)\n- Fix ProcPrivdata -- it's intended to be user extensible but is just a little\n  silly in Zig and Rust code\n- A lot more tests, I bet there's a few bugs lurking\n\n# Testing \n\nThere is a hand-rolled testing framework in `test.py` that tests the parser and\ninterpreter, to make sure that behavior matches across implementations. \n\n\u003e python test.py \n\nWill test picol itself.\n\n\u003e python test.py --impl ./cpp/repl\n\nWill test the C++ implementation, etc.\n\nFinally\n\n\u003e python test.py --update\n\nWill update test results with the actual results.\n\nThis is a snapshot testing approach: the parser can output token information\n(token type, body, start and end) as JSON lines to stderr, and the interpreter\ncan simply use the `puts` function to output some calculation to stdout. If the\noutput doesn't match the given `out` file or the output file doesn't exist the\ntest is considered a failure, and the implementation should be fixed before\nupdating the snapshots.\n\nNote that picol \"fails\" a couple of the parser tests because I rewrote the parser for the other\nimplementations -- aside from fixing a small bug in the Picol parser I don't think there are any\nmeaningful differences.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupvalue%2Ftcl3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupvalue%2Ftcl3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupvalue%2Ftcl3/lists"}