{"id":17791118,"url":"https://github.com/will62794/tlaplus_repl","last_synced_at":"2025-03-16T15:31:10.671Z","repository":{"id":83147446,"uuid":"117465889","full_name":"will62794/tlaplus_repl","owner":"will62794","description":"A simple REPL for TLA+.","archived":false,"fork":false,"pushed_at":"2024-03-15T00:43:23.000Z","size":22,"stargazers_count":39,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-19T00:02:02.279Z","etag":null,"topics":["formal-verification","model-checking","tla"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/will62794.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-01-14T20:53:57.000Z","updated_at":"2024-02-12T14:56:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"490d4022-ee3d-4b30-b2c2-fa49e7fc97a1","html_url":"https://github.com/will62794/tlaplus_repl","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/will62794%2Ftlaplus_repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will62794%2Ftlaplus_repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will62794%2Ftlaplus_repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will62794%2Ftlaplus_repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/will62794","download_url":"https://codeload.github.com/will62794/tlaplus_repl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665280,"owners_count":16860214,"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":["formal-verification","model-checking","tla"],"created_at":"2024-10-27T10:49:39.309Z","updated_at":"2024-10-27T10:49:39.964Z","avatar_url":"https://github.com/will62794.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TLA+ REPL\n\n**August 2023 Update**: In addition to the [REPL](https://github.com/tlaplus/tlaplus/blob/0e41129ebaf346dd6b2ee46a9dc977aaf954a2d0/tlatools/org.lamport.tlatools/src/tlc2/REPL.java) that is now included in TLC, see also the [web-based REPL prototype](https://will62794.github.io/tla-web/#!/home), which provides most of the same functionality with faster evaluation speed and without a need to install any TLA+ tools locally.\n\n**June 2020 Update**: The [newest versions](https://github.com/tlaplus/tlaplus/commit/97afa3c6952e343ee2409366a668ba12afceeef4) of TLC include a built in REPL that provides most of the same functionality provided in this Python tool with considerably lower evaluation latency. You can use it by running `java -cp tla2tools.jar tlc2.REPL` from the command line.\n\n----\n\nThis is a Python based REPL for evaluating TLA+ expressions. It provides an easy, interactive way to debug TLA+ expressions and can help when learning or experimenting with the language. It uses the TLC model checker to evaluate TLA+ expressions.\n\nUsage:\n\n```\n$ python tla_repl.py\n```\n\nHere is an example of evaluating expressions in a REPL session:\n\n```\n-------------------------------------------------------------------------------------\n Welcome to the TLA+ REPL! This REPL uses the TLC model checker\n to evaluate TLA+ expressions interactively. It is meant as an\n aid for learning TLA+ and debugging TLA+ specs.\n-------------------------------------------------------------------------------------\n(TLA+REPL) \u003e\u003e\u003e 2 + 2\n4\n(TLA+REPL) \u003e\u003e\u003e {1,2,3} \\X {3,4,5}\n{ \u003c\u003c1, 3\u003e\u003e,\n  \u003c\u003c1, 4\u003e\u003e,\n  \u003c\u003c1, 5\u003e\u003e,\n  \u003c\u003c2, 3\u003e\u003e,\n  \u003c\u003c2, 4\u003e\u003e,\n  \u003c\u003c2, 5\u003e\u003e,\n  \u003c\u003c3, 3\u003e\u003e,\n  \u003c\u003c3, 4\u003e\u003e,\n  \u003c\u003c3, 5\u003e\u003e }\n(TLA+REPL) \u003e\u003e\u003e CHOOSE x \\in {1,2,3,4} : x \u003e 2\n3\n(TLA+REPL) \u003e\u003e\u003e S == {1,2,3}\n(TLA+REPL) \u003e\u003e\u003e T == {4,5,6}\n(TLA+REPL) \u003e\u003e\u003e S \\cup T\n{1, 2, 3, 4, 5, 6}\n(TLA+REPL) \u003e\u003e\u003e quit\nGoodbye!\n```\n\nNote that you can define variables that can be used later on in the session, by using the standard TLA+ syntax for definitions i.e. `var == \u003csome_expr\u003e`.\n\nThe evaluation of expressions in the interactive REPL is a bit slow, since it starts up a new instance of the TLC model checker each time. The feedback loop for experimentation is still considerably better than what is currently provided by the TLA+ Toolbox IDE. Eventually TLC may support some kind of \"interactive\" mode natively, which would make it much easier to build a performant and robust REPL.\n\n# Setup\n\nIn order to use the REPL, you must have the TLA+ tools installed and they must be present in your `CLASSPATH` environment variable. There is a helper script that will download the tools and add their directory to your `CLASSPATH` for the current running shell. You can run:\n\n```\n$ source setup_tlc.sh\n```\n\nto set up the tools. After that, you should be able to start up the REPL and it should work correctly. You can always test if you have the TLA+ tools installed correctly by running the following command, which invokes the TLC model checker: \n\n```\n$ java tlc2.TLC\n```\n\nYou should get an output like the following:\n\n```\nTLC2 Version 2.11 of 05 January 2018\nError: Error: Missing input TLA+ module.\nUsage: java tlc2.TLC [-option] inputfile\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill62794%2Ftlaplus_repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwill62794%2Ftlaplus_repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill62794%2Ftlaplus_repl/lists"}