{"id":18672116,"url":"https://github.com/dfirebaugh/punch","last_synced_at":"2025-11-06T21:30:40.242Z","repository":{"id":101931376,"uuid":"447339335","full_name":"dfirebaugh/punch","owner":"dfirebaugh","description":"a tiny language that targets web assembly","archived":false,"fork":false,"pushed_at":"2025-01-04T17:43:02.000Z","size":1228,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-04T18:19:28.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/dfirebaugh.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":"2022-01-12T19:07:10.000Z","updated_at":"2025-01-02T23:13:56.000Z","dependencies_parsed_at":"2024-12-27T19:38:53.186Z","dependency_job_id":null,"html_url":"https://github.com/dfirebaugh/punch","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/dfirebaugh%2Fpunch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fpunch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fpunch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfirebaugh%2Fpunch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfirebaugh","download_url":"https://codeload.github.com/dfirebaugh/punch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239513345,"owners_count":19651321,"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-11-07T09:09:31.757Z","updated_at":"2025-11-06T21:30:40.203Z","avatar_url":"https://github.com/dfirebaugh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PUNCH 🥊\n`punch` is a hobby programming language.  \n\u003e I'm mainly working on this as a learning experience.\n\n[demo playground](https://dfirebaugh.github.io/punch/)\n\nI have some aspirations of working on a backend for this.  To work out some issues with the AST, I added a js code generation step (to easily produce runnable code). I'm not sure if i'll fully commit to that.\n\n### Build\nTo build you will need [golang installed](https://go.dev/doc/install).\n\nTo run code locally, you will need `node` or `bun` installed in your PATH.\n\n```bash\ngo build ./cmd/punch/\n\n./punch ./examples/simple.pun # output: Hello, World!\n```\n\n#### Functions\n\n```rust\n// function declaration\nbool is_best(i32 a, i32 b)\n\n// simple function\ni8 add(i32 a, i32 b) {\n    return a + b\n}\n\n// exported function\npub i32 add_two(i32 a, i32 b) {\n    return a + b\n}\n\n// multiple return types\n(i32, bool) add_eq(i32 a, i32 b) {\n    return a + b, a == b\n}\n\n// no return\nfn main() {\n    println(\"hello world\")\n}\n```\n\n#### Conditions\n\n```rust\nif a \u0026\u0026 b {\n    println(\"abc\")\n}\n```\n\n#### Assignment\n\n```rust\ni32 c    = 42\ni64 d    = 42\nu32 g    = 42\nu64 h    = 42\nf32 k    = 42.0\nf64 l    = 42.0\nbool m   = true\nstr n    = \"hello\"\n```\n\n#### Structs\n\n```rust\nstruct message {\n    i8  sender\n    i8 \trecipient\n    str body\n}\nmessage msg = {\n    sender: 5,\n    recipient: 10,\n    body: \"hello\"\n}\n\nprintln(msg.sender, msg.recipient, msg.body)\n```\n\n#### Loops\n\n```go\n// traditional for loop\nfor i := 0; i \u003c 10 ; i = i + 1 {\n\n}\n\n// loop while true\nfor true {\n\n}\n\n// loop forever\nfor {\n\n}\n```\n\n#### Simple Program\n\n```rust\npkg main\n\nimport (\n    \"fmt\"\n)\n\nfn main() {\n    fmt.Println(\"hello, world!\")\n}\n```\n\n#### Status\n\u003e work in progress\n\n| Feature | ast | wasm | js |\n| - | - | - | - |\n| function declaration | ✅ | ✅ | ✅ |\n| function calls | ✅ | ✅ | ✅ |\n| function multiple returns | ❌ | ❌ | ❌ |\n| if/else | ✅ | ✅ | ✅ |\n| strings | ✅ | ✅ | ✅ |\n| integers | ✅ | ✅ | ✅ |\n| floats | ✅ |  ✅ | ❌ |\n| structs | ✅ | ❌ | ✅ |\n| struct access | ✅ | ❌ | ✅ |\n| loops | ✅ | ❌ | ✅ |\n| lists | ✅ | ❌ | ✅ |\n| maps | ❌ | ❌ | ❌ |\n| pointers | ❌ | ❌ | ❌ |\n| enums | ❌ | ❌ | ❌ |\n| modules | ❌ | ❌ | ❌ |\n| type inference | ❌ | ❌ | ❌ |\n| interfaces | ❌ | ❌ | ❌ |\n\n## Reference\n- [WebAssembly Text Format (WAT)](https://webassembly.github.io/spec/core/text/index.html)\n- [WebAssembly Binary Format Specification](https://webassembly.github.io/spec/core/binary/index.html)\n- [WABT - The WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt)\n    - [wasm-validate](https://webassembly.github.io/wabt/doc/wasm-validate.1.html) (included in wabt)\n- [wat2wasm in browser](https://webassembly.github.io/wabt/demo/wat2wasm/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfirebaugh%2Fpunch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfirebaugh%2Fpunch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfirebaugh%2Fpunch/lists"}