{"id":21865691,"url":"https://github.com/arnie97/milky","last_synced_at":"2026-04-13T09:32:28.349Z","repository":{"id":25239779,"uuid":"28664467","full_name":"Arnie97/milky","owner":"Arnie97","description":"Python-style syntactic sugar for C / C++","archived":false,"fork":false,"pushed_at":"2018-05-05T12:56:10.000Z","size":213,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T03:05:10.649Z","etag":null,"topics":["parser","syntax-sugar"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Arnie97.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}},"created_at":"2014-12-31T11:29:19.000Z","updated_at":"2020-09-24T15:00:19.000Z","dependencies_parsed_at":"2022-08-23T04:10:21.547Z","dependency_job_id":null,"html_url":"https://github.com/Arnie97/milky","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/Arnie97/milky","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnie97%2Fmilky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnie97%2Fmilky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnie97%2Fmilky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnie97%2Fmilky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arnie97","download_url":"https://codeload.github.com/Arnie97/milky/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnie97%2Fmilky/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["parser","syntax-sugar"],"created_at":"2024-11-28T04:17:30.407Z","updated_at":"2026-04-13T09:32:28.334Z","avatar_url":"https://github.com/Arnie97.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Milky - the Indent-based Language liKe pYthon\n\u003cimg src=\"milky.png\" alt=\"Logo of Milky\" width=\"200\"\u003e\n\n[![Build Status](https://travis-ci.org/Arnie97/milky.svg)](https://travis-ci.org/Arnie97/milky)\n[![Coverage Status](https://codecov.io/github/Arnie97/milky/coverage.svg?branch=master)](https://codecov.io/github/Arnie97/milky?branch=master)\n\n\n### Introduction\nMilky is a toy language that compiles into C, just like CoffeeScript compiles into JavaScript.\nAs its name suggests, the syntax of milky is heavily based on indentations, and is very similar to Python.\nIt is also inspired by Ruby, Go, Swift and many other programming languages.\n\nLet's have a look at some examples. The following is a milky version of the famous [FizzBuzz Test](http://c2.com/cgi/wiki?FizzBuzzTest):\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdbool.h\u003e\n\nint main(void):\n    for int i = 1; i \u003c= 100; i++:\n        bool fizz = (i % 3 == 0)\n        bool buzz = (i % 5 == 0)\n\n        if fizz:\n            fputs(\"Fizz\", stdout)\n        if buzz:\n            fputs(\"Buzz\", stdout)\n        if fizz || buzz:\n            putc('\\n', stdout)\n        else:\n            printf(\"%d\\n\", i)\n```\n\nIf you are new to milky, you can begin with a piece of C source code - basically, add proper indentations and colons, then remove redundant parentheses, braces and semicolons, and now you've got some code in milky.\n\nFor more examples on syntax details, don't forget the [source code](src) of milky compiler - it's also written in milky!\n\n\n### Build\nAs mentioned, the milky compiler is fully written in milky language itself.\nHence we'll need C toolchain and a copy of compiled milky compiler (version `0.13.6+`) to bootstrap the latest milky.\n\nTo build from scratch, you may build a milky compiler from the 'bootstrap' branch:\n\n```bash\n$ git clone https://github.com/Arnie97/milky\n$ cd milky\n$ git checkout bootstrap\n$ make\n$ sudo make install\n```\n\nOr, simply execute `sudo make bootstrap` to build from Github archive.\n\nThen we can get back to the latest milky source:\n\n```bash\n$ git checkout master\n$ make\n$ sudo make install\n```\n\n\n### Naming Conventions\nAssume that you've already installed milky in your `$PATH`:\n\n```c\n$ cat \u003e hello.c.k \u003c\u003c EOF\n#include \u003cstdio.h\u003e\nint main(int argc, char *argv[]):\n    puts(\"Hello, World!\")\nEOF\n\n$ milky hello.c.k           # prints \"hello.c.k: Well done.\"\n$ c99 -o hello hello.c\n$ ./hello                   # prints \"Hello, World!\"\n```\n\nAs shown above, milky source codes should be named with suffix `.k` (or `.milk`), i.e. `foo.c.k` for a C source file and `bar.h.k` for a C header file. Unless explicitly given, the output file will be named after the corresponding input, but without the `.k` suffix. You can specify the output file name with option `-o`:\n\n```bash\n$ milky in1.c.k -o out2.c in2.c.k -o out3.c in3.c.k\n```\n\nIn this example, the milky compiler will compile `in1.c.k` into `in1.c`, `in2.c.k` into `out2.c.k` and `in3.c.k` into `out3.c.k`.\nAs you can see, multiple inputs can be specified at the same time, hence the desired output name must be given just before the corresponding input file to prevent ambiguity.\n\n\n### Output Style\nMilky outputs are designed to be as similar to the corresponding inputs as possible.\nMatch on the line level is strictly guaranteed, which is useful when working with other tools, such as GDB or Gcov.\n\nTaking [hello.c.k above](#naming-conventions) and Gcov as an example:\n\n```bash\n$ milky hello.c.k\n$ gcc --coverage -o hello hello.c   # generates hello.gcno\n$ ./hello                           # generates hello.gcna\n$ cp hello.c.k hello.c              # uses milky source instead in Gcov\n$ gcov hello                        # creates coverage report\n```\n\nIf you prefer a cleaner programming style in your outputs, simply apply a code formatter.\n[Astyle](http://astyle.sourceforge.net) or [Uncrustify](http://uncrustify.sourceforge.net) might be handy.\n\n\n### C++ Support\nMilky was initially designed for the C language.\nAs C++ is almost a super set of C, and shares its basic syntaxes, milky should work with most C++ source codes, although not guaranteed.\n\nCurrently, the milky compiler is not deliberately designed to support C++ specific features, excepted for support of scope resolution operators (i.e. `::`) since version `0.8.9`.\n\nIn the future, milky might be developed to provide better C++ support.\n\n\n### License\nGPL.\n\n\n### Thanks\nThe initial versions of milky compiler was based on [sample codes](http://kmaebashi.com/programmer/devlang/book/download.html) from the book [「プログラミング言語を作る」](http://kmaebashi.com/programmer/devlang/book).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnie97%2Fmilky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnie97%2Fmilky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnie97%2Fmilky/lists"}