{"id":24394390,"url":"https://github.com/slava0135/stg-example","last_synced_at":"2026-04-20T21:33:00.726Z","repository":{"id":272801143,"uuid":"917802802","full_name":"Slava0135/stg-example","owner":"Slava0135","description":"Example Haskell program translated to STG and compiled to C","archived":false,"fork":false,"pushed_at":"2025-01-16T17:14:06.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T18:34:29.358Z","etag":null,"topics":["compiler","functional-programming","haskell","lazy-evaluation","stg"],"latest_commit_sha":null,"homepage":"","language":"C","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/Slava0135.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-01-16T17:13:18.000Z","updated_at":"2025-01-16T17:15:51.000Z","dependencies_parsed_at":"2025-01-16T18:34:31.450Z","dependency_job_id":"22daebde-02d7-4b7e-8c55-5e186f9675e3","html_url":"https://github.com/Slava0135/stg-example","commit_stats":null,"previous_names":["slava0135/stg-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slava0135%2Fstg-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slava0135%2Fstg-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slava0135%2Fstg-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slava0135%2Fstg-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Slava0135","download_url":"https://codeload.github.com/Slava0135/stg-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243325062,"owners_count":20273212,"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":["compiler","functional-programming","haskell","lazy-evaluation","stg"],"created_at":"2025-01-19T19:24:02.761Z","updated_at":"2025-12-28T01:20:11.937Z","avatar_url":"https://github.com/Slava0135.png","language":"C","readme":"# STG Example\n\nSTG (Spineless Tagless G-machine) is implementation of lazy functional language as described in:\n\n\u003e Simon Peyton Jones. Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-machine. Journal of Functional Programming 1992\n\n[haskell.hs](./haskell.hs) is example program written in Haskell (except there is no monad IO, i am sure you can figure it out).\n\n[stg.hs](./stg.hs) is the program translated to STG as explained in book (`.hs` extension is for better editing).\n\n[stgi.hs](./stgi.hs) is the program, but in format, supported by \u003chttps://github.com/quchen/stgi\u003e. The STG machine explained there too in details, so check it out!\n\n[stg.c](./stg.c) is the program, translated (compiled) from STG to C as explained in book.\n\nTo run:\n\n```sh\ngcc stg.c \u0026\u0026 ./a.out\n```\n\nYou should get the following results in the end:\n\n```text\n...\nResult = 91\nSteps = 281\nStack A size = 0\nStack B size = 0\nHeap size = 1008\nObjects allocated = 47\n```\n\nTested on Linux (gcc version 14.2.1)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslava0135%2Fstg-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslava0135%2Fstg-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslava0135%2Fstg-example/lists"}