{"id":27275199,"url":"https://github.com/jabbalaci/c-repl","last_synced_at":"2026-04-30T14:35:47.051Z","repository":{"id":286572644,"uuid":"961782779","full_name":"jabbalaci/c-repl","owner":"jabbalaci","description":"A simple REPL for the C programming language","archived":false,"fork":false,"pushed_at":"2025-04-07T08:41:07.000Z","size":1059,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T15:58:25.602Z","etag":null,"topics":["c","python","repl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jabbalaci.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-07T06:48:38.000Z","updated_at":"2025-04-10T17:02:04.000Z","dependencies_parsed_at":"2025-04-07T09:23:43.573Z","dependency_job_id":"918af070-3ef2-40fb-8207-24007b07774e","html_url":"https://github.com/jabbalaci/c-repl","commit_stats":null,"previous_names":["jabbalaci/c-repl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jabbalaci/c-repl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fc-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fc-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fc-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fc-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabbalaci","download_url":"https://codeload.github.com/jabbalaci/c-repl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabbalaci%2Fc-repl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32468009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["c","python","repl"],"created_at":"2025-04-11T15:47:49.707Z","updated_at":"2026-04-30T14:35:47.035Z","avatar_url":"https://github.com/jabbalaci.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C REPL\n\nA simple REPL for the C programming language.\n\n## Motivation\n\nPython has an excellent REPL that is very useful\nto try something quickly. I always wanted something\nsimilar for the C programming language. If, for instance,\nI want to evaluate a simple expression, then why should I\nwrite a complete program?\n\n## Demo\n\n![demo](demo/demo.gif)\n\n## Other Features\n\nYou can also use `struct`s and `typedef`s:\n\n```text\n\u003e\u003e\u003e typedef struct {\n...   int x;\n...   int y;\n... } Pont;\n\u003e\u003e\u003e\n\u003e\u003e\u003e Pont a = (Pont){1, 2}\n\u003e\u003e\u003e %d a.x\n1\n\u003e\u003e\u003e %d a.y\n2\n```\n\nA Python shell is also available if you need it.\nQuit from the Python shell with `Ctrl + d`.\n\n```text\n\u003e\u003e\u003e _py\nPython 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e 2 ** 31 - 1\n2147483647\n\u003e\u003e\u003e\n# C REPL again:\n\u003e\u003e\u003e long n = 2147483647\n\u003e\u003e\u003e %ld n\n2147483647\n```\n\nYou can also use a Python one-liner:\n\n```text\n\u003e\u003e\u003e (p) hex(2025)\n0x7e9\n\u003e\u003e\u003e string s = \"0x7e9\"\n\u003e\u003e\u003e %s s\n0x7e9\n```\n\nYou can also write `while` loops:\n\n```text\n\u003e\u003e\u003e int i = 0\n\u003e\u003e\u003e while (i \u003c 3) {\n...   puts(\"hello\");\n...   ++i;\n... }\n\u003e\u003e\u003e _run\nhello\nhello\nhello\n```\n\nIt's also possible to check for memory leaks with `valgrind`:\n\n```text\n\u003e\u003e\u003e _reset\n\u003e\u003e\u003e char *p = malloc(10)\n\u003e\u003e\u003e _val\n...\n==318347== HEAP SUMMARY:\n==318347==     in use at exit: 10 bytes in 1 blocks\n==318347==   total heap usage: 1 allocs, 0 frees, 10 bytes allocated\n...\n```\n\nTo simplify reading a text from the keyboard,\nyou can use a \"built-in\" function called `get_string()`:\n\n```text\n\u003e\u003e\u003e string s = get_string(\"Name: \")\n\u003e\u003e\u003e printf(\"Hello %s!\\n\", s)\n\u003e\u003e\u003e\n\u003e\u003e\u003e _run\nName: Laszlo\nHello Laszlo!\n```\n\nIf you use this function, then the necessary header\nfile (`prog1.h`) will be auto-included.\n\n## Notes\n\nWhen I generate the C source code, I add some special\ncomments (e.g. `// tmp`, `// def`). I need those\ncomments when I read the modified source code. When\nyou edit the C code with a text editor, I need to parse\nand re-read the whole source code. These special comments\nare there to facilitate the parsing. **So don't delete these comments!**\n\n## Installation\n\nI highly encourage using the [uv](https://docs.astral.sh/uv/) package manager. Then, it's enough\nto just start `./start.sh`, which will **(1)** create\na virt. env. for you, and then **(2)** start the project.\n\nFor Debian-based distros, I made an installer script (`setup.sh`).\nBefore executing it, verify its content. It installs the uv\npackage manager via pipx, and it also installs some external\nprograms that are used by C REPL (e.g. `gcc`, `valgrind`, etc.).\n\nOnce everything is installed, just start the launcher script:\n\n```shell\n$ ./start.sh\n```\n\n## Supported Platforms\n\nTested on Linux only.\n\nThe program uses several external Linux commands.\nThey are collected in named constants at the beginning\nof the source code. Make sure that they are all installed\non your system (e.g. `gcc`, `valgrind`, etc.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabbalaci%2Fc-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabbalaci%2Fc-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabbalaci%2Fc-repl/lists"}