{"id":14008346,"url":"https://github.com/evmar/c-repl","last_synced_at":"2025-09-05T02:37:16.487Z","repository":{"id":426559,"uuid":"46677","full_name":"evmar/c-repl","owner":"evmar","description":"a C read-eval-print loop (abandoned)","archived":false,"fork":false,"pushed_at":"2020-09-07T05:21:11.000Z","size":93,"stargazers_count":203,"open_issues_count":1,"forks_count":24,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-12-08T12:11:56.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://neugierig.org/software/c-repl/","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evmar.png","metadata":{"files":{"readme":"README","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}},"created_at":"2008-08-27T15:56:34.000Z","updated_at":"2024-08-05T10:32:35.000Z","dependencies_parsed_at":"2022-08-16T10:25:12.769Z","dependency_job_id":null,"html_url":"https://github.com/evmar/c-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/evmar%2Fc-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmar%2Fc-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmar%2Fc-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmar%2Fc-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evmar","download_url":"https://codeload.github.com/evmar/c-repl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230423564,"owners_count":18223435,"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-08-10T11:01:36.510Z","updated_at":"2024-12-19T11:12:50.720Z","avatar_url":"https://github.com/evmar.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"c-repl: a C read-eval-print loop.\nCopyright (C) 2008 Evan Martin \u003cmartine@danga.com\u003e\n\nMany programming languages come with a REPL (read-eval-print loop),\nwhich allows you to type in code line by line and see what it does. This\nis quite useful for prototyping, experimentation, and debugging code.\n\nOther programming languages, and especially C, use a \"compile-run\"\nmodel, and don't provide a REPL. Let's fix that.\n\n== Dependencies\n- GHC 6.8\n- gcc\n- gccxml and hexpat\n  (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hexpat)\n- gdb and hgdbmi\n  (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hgdbmi)\n- readline\n\nDebian/Ubuntu users on recent releases can do something like:\n  sudo apt-get install ghc6 gccxml libghc6-parsec-dev libghc6-mtl-dev \\\n                       libghc6-hunit-dev\nhexpat, hgdbmi, and readline can be fetched and installed from Hackage\nvia the above URLs or via cabal-get, and they depend on\n  sudo apt-get install gdb libexpat1-dev c2hs libreadline-dev\n\nIf you get an error from c2hs like this:\n  /usr/include/bits/pthreadtypes.h:99: (column 6) [FATAL]\n  \u003e\u003e\u003e Syntax error!\n  The symbol `;' does not fit here.\nthen you unfortunately need a newer c2hs; the one in Ubuntu Hardy is\nat least recent enough.\n\n== Building\nAlmost list a normal cabal-managed app:\n  cabal configure\n  cabal install\nbut with one major exception, you must also run this at the end.\n  cabal copy\n\nWhy is this extra step necessary?  Read Setup.lhs and tell me what I've\ndone wrong; I've probably spent as much time trying to figure out Cabal\nas I have writing the actual app.  I'd love to apply a patch from someone\nsmarter than me.\n\n== Usage\nType normal lines of C code and hit enter.  Trailing semicolons are\noptional.  All variable and function declarations are implicitly global,\nbut can be initialized as if they were locals.\n  \u003e int x = 3\n  \u003e printf(\"at %p, %d\\n\", \u0026x, x)\n  at 0xb7f4a550, 3\n  \u003e FILE* f = fopen(\"README\", \"r\")\n\nBring in more headers by writing #include statements.  Library functions\nthat are in scope should be tab-completable at the prompt.\n  \u003e #include \u003cstdlib.h\u003e\n  \u003e op\u003cTAB\u003e\n  open            open_memstream  openat64        \n  open64          openat          \n  \u003e open\n\n== How it works\nThe approach is surprisingly simple: for each line of code you enter, we\ncompile a shared object in the background. If the compilation succeeds,\nthe object is loaded into a child process via dlopen().  Parsing of C\n#includes uses gccxml.  (Unfortunately, I can't figure out how to use\ngccxml to parse the user's input, and due to the complexity of parsing C\nthe input parser is currently hacky and heuristic.)\n\n== Debugging\nc-repl currently can take one flag, \"-v\", which causes it to output the\ninternal code that it's generating.  Please include this output with bug\nreports.\n\n== Credit\nThe original idea is due to Satoru Takabayashi (http://0xcc.net), who\nwas responsible for a prototype implementation and advice on the\noriginal version.\n\n\nvim: set tw=72 :\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmar%2Fc-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevmar%2Fc-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmar%2Fc-repl/lists"}