{"id":14991142,"url":"https://github.com/jackparsonss/fusion","last_synced_at":"2026-01-05T00:09:16.965Z","repository":{"id":242767877,"uuid":"797453007","full_name":"jackparsonss/fusion","owner":"jackparsonss","description":"a toy programming language","archived":false,"fork":false,"pushed_at":"2024-11-02T16:03:16.000Z","size":263,"stargazers_count":0,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T19:28:26.339Z","etag":null,"topics":["antlr4","cpp","llvm","mlir"],"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/jackparsonss.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":"2024-05-07T21:34:01.000Z","updated_at":"2024-07-22T01:26:49.000Z","dependencies_parsed_at":"2024-06-04T22:49:44.240Z","dependency_job_id":"024490fe-d9b5-4b06-9c4a-9b5d47646eab","html_url":"https://github.com/jackparsonss/fusion","commit_stats":{"total_commits":96,"total_committers":1,"mean_commits":96.0,"dds":0.0,"last_synced_commit":"7fae8949410b955b3528882be1bdee6fa243f679"},"previous_names":["jackparsonss/fusion"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackparsonss%2Ffusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackparsonss%2Ffusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackparsonss%2Ffusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackparsonss%2Ffusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackparsonss","download_url":"https://codeload.github.com/jackparsonss/fusion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890929,"owners_count":20527166,"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":["antlr4","cpp","llvm","mlir"],"created_at":"2024-09-24T14:21:34.566Z","updated_at":"2026-01-05T00:09:16.919Z","avatar_url":"https://github.com/jackparsonss.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fusion Lang\nA toy language to continue learning antlr4 and mlir/llvm and see where I go\n\n## Setting up environment\nIf you are on macos then I have made a simple install script which will install all requirements/dependencies needed to develop with antlr and mlir, located [here](https://github.com/jackparsonss/fusion/blob/main/scipts/setup_macos.bash)\n\n## Building\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n## Running\n```bash\ncd bin\n./fuse \u003cfilename\u003e.fuse\n```\n\n## Documentation\n### Declarations\nThe `let` keyword signifies that the variable can be later changed.\nThe `const` keyword signifies that the variable cannot be later changed;\n```\nlet x: i32 = 5;\nconst y: i32 = x;\n```\n\n### Types\n- **i32**: 32-bit integer\n- **i64**: 64-bit integer\n- **ch**: 8-bit ascii character\n- **bool**: 1-bit boolean(true/false)\n\n### Functions\n```\nfn foo(let x: i32, let y: ch): i32 {\n    print(x);\n    print(y);\n\n    return x + 1;\n}\n\nfn main(): i32 {\n    foo(5, '\\n');\n    return 0;\n}\n```\n\n#### Builtin Functions\n##### main\nMust be defined by the user, is the entry point to the fusion program\n```\nfn main(): i32 {\n    // do stuff\n    return 0;\n}\n```\n\n##### print\nPrints the argument passed to stdout\n```\nprint(5);\n```\n\n##### println\nPrints the argument passed to stdout with a newline at the end\n```\nprintln(100);\n```\n```\n```\n\n#### Arithmetic\n- addition: `+`\n- subtraction: `-`\n- power: `^`\n- multiplication: `*`\n- division: `/`\n- modulus: `%`\n- greater than(eq): `\u003e`, `\u003e=`\n- less than(eq): `\u003c`, `\u003c=`\n- equal: `==`\n- not equal: `!=`\n- and: `\u0026\u0026`\n- or: `||`\n```\nfn main(): i32 {\n    let a: i32 = 5 + 5;\n    let s: i32 = 5 - 5;\n    let p: i32 = 5 ^ 5;\n    let m: i32 = 5 * 5;\n    let d: i32 = 5 / 5;\n    let r: i32 = 5 % 5;\n\n    let gt: bool = 5 \u003e 4;\n    let lt: bool = 4 \u003c 5;\n    let gte: bool = 5 \u003e= 5;\n    let lte: bool = 5 \u003e= 5;\n    let eq: bool = 5 == 5;\n    let ne: bool = 5 != 5;\n    let o: bool = 5 != 5 || 5 == 5;\n    let a: bool = 5 != 5 \u0026\u0026 5 == 5;\n}\n```\n\n#### Conditionals\nJust like `if`/`else` statements in most languages\n```\nlet x: i32 = 5;\nif(x == 4){\n    println(0);\n} else if(x == 5) {\n    println(10);\n} else {\n    println(x);\n}\n```\nConditions **must** be booleans\n\n#### Loops\nSimilar to c-style for loops, they are composed of 4 parts\n- Variable declaration\n- Loop condition\n- Variable assignment\n- Body\n```\nfor(let i: i32 = 0; i \u003c 5; i = i + 1){\n    println(i);\n}\n```\n\nLoops also allow for control flow:\n- `continue`: goes to the next iteration of the loop\n- `break`: exits the loop early\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackparsonss%2Ffusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackparsonss%2Ffusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackparsonss%2Ffusion/lists"}