{"id":18048780,"url":"https://github.com/marcelgarus/plum","last_synced_at":"2025-04-10T09:52:40.253Z","repository":{"id":257280993,"uuid":"854192065","full_name":"MarcelGarus/plum","owner":"MarcelGarus","description":"Plum is a programming language for writing functional, fast, reusable code.","archived":false,"fork":false,"pushed_at":"2024-10-25T19:55:46.000Z","size":203,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T20:15:22.699Z","etag":null,"topics":["programming-language"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"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":"2024-09-08T16:09:43.000Z","updated_at":"2024-10-25T19:56:25.000Z","dependencies_parsed_at":"2024-09-15T18:27:13.028Z","dependency_job_id":"149ca2ba-1b6d-4e37-a531-f8f44f6d2312","html_url":"https://github.com/MarcelGarus/plum","commit_stats":null,"previous_names":["marcelgarus/kamin","marcelgarus/breakfast","marcelgarus/plum"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fplum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fplum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fplum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fplum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarcelGarus","download_url":"https://codeload.github.com/MarcelGarus/plum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198185,"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":["programming-language"],"created_at":"2024-10-30T20:15:21.249Z","updated_at":"2025-04-10T09:52:40.233Z","avatar_url":"https://github.com/MarcelGarus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plum\n\nPlum is a small, functional, cozy programming language.\n\n**Small**:\nYou can understand the entire language in an hour.\nPlum has a structural type system.\nThere are few concepts to learn – everything boils down to data and functions.\n\n**Functional**:\nFunctions are pure, they can't have side effects.\nData structures are immutable and acyclic, allowing garbage collection via reference counting.\nCode is eagerly evaluated.\n\n**Cozy**:\nThe syntax is concise.\nPlum compiles to Ground, a byte code that is designed to be easy to embed in other languages.\nType reflection at compile time makes some code really concise.\n\n\u003e [!IMPORTANT]\n\u003e Plum is still in _very_ early development.\n\u003e Some parts are not implemented yet.\n\u003e Some inputs may crash the compiler.\n\u003e The onboarding is horrible (see Getting Started).\n\n## Intro\n\nPlum is indentation-based.\n\nTypes are uppercase, type variables lowercase.\nUse `\u0026` to create structs and `|` to create enums.\n\n```plum\nPosition =\n  \u0026 x: Int\n    y: Int\n\nMaybe t =\n  | some: t\n    none\n\norigin = \u0026 x: 0 y: 0\nfoo = | some: 5\n```\n\nFunction names are always lowercase or symbols.\nThe signatures of functions have type annotations and support overloading based on the argument types.\n\n```plum\nget list: (List t) index: Int -\u003e t = ...\nget map: (Map k v) key: k -\u003e v = ...\n```\n\nBy default, calls use Lisp-like syntax.\nAlternatively, you can use indentation to group arguments, or a dot syntax to chain function calls.\n\n```plum\n+ (* 1 2) 4\n\n# equivalent:\n+\n  * 1 2\n  4\n\n# equivalent:\n1 .* 2 .+ 4\n```\n\n```plum\na_map .get \"Hi\" .format.uppercase.chars .get 0\n```\n\nYou can switch on enums using the `%` syntax.\n\n```plum\ninput\n. parse_int 10\n% some: value -\u003e value\n  none -\u003e crash \"you would normally use unwrap for this\"\n. sqrt\n. * 1000\n```\n\nArguments of the type `Type` have to be compile-time known and can be used in other parts of the signature.\nYou can reflect on types (at compile time) using the built-in `type_info` function.\n\n```plum\nparse json: Json target: Type -\u003e target =\n  type_info target\n  % int -\u003e\n      json\n      % int: int -\u003e int\n        _ -\u003e crash \"int please\"\n    struct fields -\u003e\n      json\n      % map map -\u003e ...\n        _ -\u003e crash ...\n\na_string.parse_json .parse Position\n```\n\n## Getting Started\n\n1. Install [Zig](https://ziglang.org).\n2. Compile [Soil](https://github.com/MarcelGarus/soil-zig), a byte code VM, using Zig.\n   Put `soil` in your path.\n3. Compile [Martinaise](https://github.com/MarcelGarus/martinaise), my previous programming language, using Soil.\n   I recommend starting the Martinaise bootstrapping process with compiler/6/martinaise.soil rather than compiling from scratch.\n   Some earlier compiler stages generate assembly directly, requiring an x86_64 system and several assemblers (NASM and FASM).\n   Good luck!\n4. Compile the Plum compiler using the Martinaise compiler.\n5. You can now compile Plum code to Ground byte code.\n6. Write a VM for Ground byte code.\n   That should take around 100 to 200 lines of code.\n   The spec is in this repo.\n7. You can now run Plum programs!\n\n\u003e I have plans for radically simplifying the installation by bootstrapping from the Ground up:\n\u003e\n\u003e - by writing a simple assembler in byte code by hand\n\u003e - by writing a Forth in that textual assembly\n\u003e - by writing a Lisp in that Forth\n\u003e - by writing a Plum compiler in that Lisp\n\u003e\n\u003e Once that is done, the installation will only require a Ground VM (either write one yourself or use an existing one).\n\u003e Everything above that doesn't have any external dependencies.\n\n## Some todos\n\n- self-hosting compiler\n- incremental compiler\n- bootstrapped compiler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fplum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelgarus%2Fplum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fplum/lists"}