{"id":27296032,"url":"https://github.com/gmisail/moxlang","last_synced_at":"2026-04-16T12:01:44.078Z","repository":{"id":88422646,"uuid":"255212925","full_name":"gmisail/moxlang","owner":"gmisail","description":"🐶 Mox Programming Language","archived":false,"fork":false,"pushed_at":"2020-09-01T00:52:21.000Z","size":1156,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T05:04:24.759Z","etag":null,"topics":["antlr4","c","compiler","java","language","programming-language","transpiler"],"latest_commit_sha":null,"homepage":"","language":"Java","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/gmisail.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,"zenodo":null}},"created_at":"2020-04-13T02:28:36.000Z","updated_at":"2024-01-14T00:01:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"b735ffa6-de33-49cb-a581-60b5f2a2ac8e","html_url":"https://github.com/gmisail/moxlang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gmisail/moxlang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmisail%2Fmoxlang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmisail%2Fmoxlang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmisail%2Fmoxlang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmisail%2Fmoxlang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmisail","download_url":"https://codeload.github.com/gmisail/moxlang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmisail%2Fmoxlang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["antlr4","c","compiler","java","language","programming-language","transpiler"],"created_at":"2025-04-11T23:29:56.279Z","updated_at":"2026-04-16T12:01:44.055Z","avatar_url":"https://github.com/gmisail.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mox Programming Language\n\nMox is a programming language which focuses on combining simplicity with power. It achieves this by leveraging\na simple syntax which compiles directly into C (which in turn compiles into machine code.) Since it compiles into C,\nit is painless to interface with native C code (and for C to interface with Mox code.) There is manual memory management, however all pointer manipulation is done under the hood (the compiler manages pointers for you for ease-of-use and safety.)\n\nMox's syntax is similar to that of Lua with hints of Java and Haxe. Instead of being garbage collected like its inspiration, it uses manual memory allocation. So, all classes must be explicitly deleted unless explicitly marked to automatically delete when it goes out of scope. It uses ANTLR4 for generating its lexer and parser, however this dependency may be removed if it is decided to make the compiler self-hosted. Until then, ANTLR4 works just fine.\n\nFeatures \u0026 Updates : [Trello page](https://trello.com/b/elTGCpm0/mox-programming-language)\n\n### Installation\n\nMox is distributed through NPM. It can be installed using the: `npm install moxlang -g` command (you may need to add `sudo`.) To compile, you use the following command.\n\n```\nmoxc build main.mox\n```\n\nThe output will be two files; `main.c` and `main.out`. The former is the C output, while `main.out` is your outputted program which can be executed.\n\n### Code Examples\n\n#### Declaring Variables \u0026 Functions\n\n```lua\nfunction add(x : int, y : int) -\u003e int\n    return x + y\nend\n\nfunction sub(x : int, y : int) -\u003e int\n    return x - y\nend\n\nfunction main() -\u003e int\n    var test : int = 100\n    var another : int = test + test\n\n    var foo : int = add(test, another)\n    var bar : int = sub(foo, 10)\n\n    var fizz : int = foo + bar\n\n    if(fizz == bar and fizz != foo)\n        while(fizz == bar or fizz != foo)\n            fizz = fizz + 1\n        end\n    end\n\n    return 0\nend\n```\n\n#### Defining Objects\n\n```lua\nclass Pair\n\n    var x : int\n    var y : int\n\n    function init()\n        self.x = 0\n        self.y = 0\n    end\n    \n    function destroy()\n    \n    end\n\n    function getProduct() -\u003e int\n        return self.x * self.y\n    end\n\nend\n\nfunction main() -\u003e int\n    var pair : Pair = new Pair()\n    pair.x = 4\n    pair.y = 10\n\n    printf(\"(%i, %i)\\n\", pair.x, pair.y)\n\n    var temp : int = pair.x\n    pair.x = pair.y\n    pair.y = temp\n\n    printf(\"(%i, %i)\\n\", pair.x, pair.y)\n\n    delete pair\n\n    return 0\nend\n```\n\n### Vector implementation\n\n```lua\nclass Vector\n\n    var data : Pointer\u003cint\u003e = NULL\n    var size : int = 0\n    var count : int = 0\n\n    function init()\n\n    end\n\n    function destroy()\n        free(self.data)\n    end\n\n    function count() -\u003e int\n        return self.count\n    end\n\n    function push(value : int)\n        if(self.size == 0)\n            self.size = 4\n            self.data = calloc(self.size, sizeof(int))\n\n            for(i from 0 to self.size)\n                self.data[i] = 0\n            end\n        end\n\n        if(self.size == self.count)\n            self.size = self.size * 2\n            self.data = realloc(self.data, sizeof(int) * self.size)\n        end\n\n        self.data[self.count] = value\n        self.count = self.count + 1\n    end\n\n    function set(index : int, value : int)\n        if(index \u003c self.count and index \u003e= 0)\n            self.data[index] = value\n        end\n    end\n\n    function get(index : int) -\u003e int\n        if(index \u003c self.count and index \u003e= 0)\n            return self.data[index]\n        end\n\n        return 0\n    end\n\n    function pop() -\u003e int\n        var val : int = self.get(self.count - 1)\n        self.set(self.count - 1, 0)\n        self.count = self.count - 1\n\n        return val\n    end\n\n    function print()\n        printf(\"[\")\n        for(i from 0 to self.count)\n            if(i \u003e 0)\n                printf(\", \")\n            end\n\n            printf(\"%i\", self.get(i))\n        end\n        printf(\"]\\n\")\n    end\n\nend\n\n#\n#   Simple example which allocates a vector, pushes 15 values and then pops all 15 values.\n#\nfunction main() -\u003e int\n    var vector : Vector = new Vector()\n\n    for(i from 0 to 15)\n        vector.push(i)\n        vector.print()\n    end\n\n    for(i from 0 to 15)\n        vector.pop()\n        vector.print()\n    end\n\n    delete vector\n\n    return 0\nend\n```\n\nNotice how in the class there is a `init()` and `destroy()` function? These are the constructor and destructor, and both are required for every Mox class. Both are called implicitly when needed (`init()` on construction and `destroy()` before it is deallocated.) Although `init()` and `destroy()` are created automatically if they are not defined (the compiler assumes that every class has `init` and `destroy` methods), it is best practice to manually define them.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmisail%2Fmoxlang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmisail%2Fmoxlang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmisail%2Fmoxlang/lists"}