{"id":18048799,"url":"https://github.com/marcelgarus/martinaise","last_synced_at":"2025-04-10T09:52:56.606Z","repository":{"id":210093914,"uuid":"712366941","full_name":"MarcelGarus/martinaise","owner":"MarcelGarus","description":"A small, statically typed, low-level programming language.","archived":false,"fork":false,"pushed_at":"2024-04-30T17:20:42.000Z","size":1529,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T15:33:46.673Z","etag":null,"topics":["language"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarcelGarus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-10-31T10:29:09.000Z","updated_at":"2024-05-06T11:59:15.098Z","dependencies_parsed_at":"2023-11-30T19:31:05.888Z","dependency_job_id":"75b450a2-097a-4196-b539-0e55558a89ea","html_url":"https://github.com/MarcelGarus/martinaise","commit_stats":null,"previous_names":["marcelgarus/martinaise"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fmartinaise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fmartinaise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fmartinaise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fmartinaise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarcelGarus","download_url":"https://codeload.github.com/MarcelGarus/martinaise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198213,"owners_count":21063626,"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":["language"],"created_at":"2024-10-30T20:15:25.131Z","updated_at":"2025-04-10T09:52:56.587Z","avatar_url":"https://github.com/MarcelGarus.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Martinaise\n\nA small, statically typed, low-level language.\n\nFor a quick tour of the language, have a look at the [tour.mar](tour.mar) file.\nTo get a feeling for how Martinaise programs look, take a look at the files in the [advent](advent/) folder.\nTo get an in-depth understanding of Martinaise, take a look at the standard library and the compiler, both of which are in the compiler folder.\n\n\u003e [!IMPORTANT]\n\u003e Martinaise is mostly a small recreational project.\n\u003e Martinaise is **not meant for serious projects**.\n\n## Why?\n\n- I wanted to write a low-level, statically-typed language.\n  Martinaise has `Address`es, references, and a `malloc` implementation.\n  Implementing monomorphizing and overloading was fun.\n- I wanted to write an entire compiler, not just an LLVM frontend.\n  This compiler goes from source code all the way to x86_64 machine code.\n  The compiler computes efficient memory layouts, the functions have their own calling convention, etc.\n- I wanted to write a project in [Zig](https://ziglang.org).\n  Of course, by now, the compiler is written in Martinaise itself.\n\n## Usage\n\nMartinaise is self-hosting – the compiler is written in Martinaise itself.\nSo, you first need to bootstrap Martinaise.\n\n1. In the command line, navigate to the project root (the folder where this README is).\n2. Install [Soil](https://github.com/MarcelGarus/soil).\n   The soil executable should be somewhere in your path.\n3. **Option A:** Install [Zig](https://ziglang.org).  \n   **Option B (TODO: fix this):** Run `make skip-zig`.\n   This repo contains the Soil byte code of a stable self-hosted compiler.\n   This command starts with that instead of compiling all the way from the original compiler written in Zig.\n4. Run `make`. This builds all compiler generations. The newest compiler will be placed into the project root as the `martinaise` executable.\n5. Run `soil martinaise.soil help` for help and go from there.  \n   Martinaise programs can be compiled and run using `soil martinaise.soil run tour.mar`.\n\n## Editor\n\n\u003e [!IMPORTANT]\n\u003e The editor is still a work in progress.\n\nThere's an editor for Martinaise written in Martinaise.\nIt's not up-to-date (and uses compiler 4, if I'm correct).\nRun `./martinaise compile editor.mar` to get the `editor`.\nThen run `./editor some-file.mar` to edit a file.\nSpecial thanks to @antoniusnaumann for the color theme.\n\n## Language History\n\nThe language evolved substantially over time.\nEach `compiler/\u003cversion\u003e` folder contains a compiler.\nEach compiler can be compiled using the previous compiler.\n\n- Compiler 0\n  - Written in Zig\n- Compiler 1\n  - Written in Martinaise (every compiler after this as well)\n  - Makes `orelse` customizable (not just work on `Maybe`)\n  - Ints support radixes such as `8#666:U32`\n  - Fixes inner variables replacing ones in outer scopes\n  - Ensures all struct fields are set during creation\n  - Supports global variables\n  - Allows omitting types\n  - Introduces `Str`, `Char`, `OsStr`\n  - Char literals use `#` instead of `'`\n  - String literals support interpolation, including metaness\n- Compiler 2\n  - Uses all the new features, making it more concise\n  - Produces the exact same C output as compiler 1\n  - Adds buffered stdout stream for writing the C output faster\n  - Can compile itself\n- Compiler 3\n  - Replaces the C backend with an x86_64 assembly backend\n  - Adds opaque types and asm functions\n  - The integer types and their operations are no longer built-into the language, but implemented as opaque types\n  - Adds support for operators\n- Compiler 4\n  - Supports FASM as well as NASM\n- Compiler 5\n  - Compiles to [Soil byte code](https://github.com/MarcelGarus/soil) instead of FASM or NASM\n  - Parses ASM functions that contain byte code instructions\n  - Replaces `orelse` with `and` and `or`\n  - Supports imports.\n- Compiler 6\n  - Replaces specific int types (`U8`, `U64`, `I8`, `I64`) with simpler `Int` and `Byte` (which correspond to `I64` and `U8`, respectively)\n- Compiler 7\n  - Adds builtin functions for fuzzing (`write_debug`, `generate`, `mutate`)\n- Compiler 8\n  - Adds fuzz command\n\n# TODO\n\n- catch endless loops during fuzzing\n- mock syscalls during fuzzing\n- check all functions, not just main\n- fuzz all functions automatically (opt-in)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fmartinaise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelgarus%2Fmartinaise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fmartinaise/lists"}