{"id":17680880,"url":"https://github.com/devnote-dev/clip","last_synced_at":"2025-06-14T09:32:36.542Z","repository":{"id":177012402,"uuid":"659386972","full_name":"devnote-dev/clip","owner":"devnote-dev","description":"Toy/experimental interpreted scripting language","archived":false,"fork":false,"pushed_at":"2023-07-21T18:35:28.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T19:13:25.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devnote-dev.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":"2023-06-27T18:12:13.000Z","updated_at":"2023-06-30T21:38:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e73823f7-9157-4c78-a278-3d1b08ffc467","html_url":"https://github.com/devnote-dev/clip","commit_stats":null,"previous_names":["devnote-dev/clip"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devnote-dev/clip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Fclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Fclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Fclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Fclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devnote-dev","download_url":"https://codeload.github.com/devnote-dev/clip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Fclip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259793858,"owners_count":22912201,"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-10-24T09:09:34.159Z","updated_at":"2025-06-14T09:32:36.521Z","avatar_url":"https://github.com/devnote-dev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clip\n\nA toy programming language for me to learn and explore compilers/the compilation process/compiler internals/etc.\n\n## Installing\n\n1. Clone the repo\n2. `cargo install`\n3. `cargo build -r` (optional: this will build to `./target/release`)\n\n## Using\n\nYou can run the interpreter via `cargo run -- run \u003cfile\u003e` or start the REPL with just `cargo run -- repl`.\n\n## Syntax\n\nThe language can be best described as lisp without the parentheses, everything is declared and read left to right. Comments are declared using `#` unlike lisp — semicolons actually have meaning (they are delimiters, as they should be).\n\n### Variables\n\nVariables can be assigned and reassigned using `=`:\n\n```\n= foo 24\n= foo \"bar\"\n```\n\n### Data types\n\nThere are primitive data types such as integers, floats, strings and booleans as per usual. However, there is no _explicit_ `null`. Instead, `null` is represented via an empty expression `()` (also known as \"unit\" in some actual languages).\n\n### Operators\n\n\u003e **Note**\n\u003e Operators will only compare arguments of the same type, except for `==` with `()`.\n\n| Definition     | Description                                                                          |\n| -------------- | ------------------------------------------------------------------------------------ |\n| `== a b ...`   | Equality: checks if `a` is equal to any of the other arguments.                      |\n| `\u003e a b ...`    | Comparison: checks if `a` is greater than any of the other arguments.                |\n| `\u003e= a b ...`   | Comparison: checks if `a` is greater than or equal to any of the other arguments.    |\n| `\u003c a b ...`    | Comparison: checks if `a` is less than any of the other arguments.                   |\n| `\u003c= a b ...`   | Comparison: checks if `a` is less than or equal to any of the other arguments.       |\n| `+ a b ...`    | Addition: adds all the arguments sequentially.                                       |\n| `- a ...`      | Subtraction: subtracts all the arguments sequentially. Negates if there is only one. |\n| `* a b ...`    | Multiplication: multiplies all the arguments sequentially.                           |\n| `/ a b ...`    | Division: divides all the arguments sequentially.                                    |\n| `\u0026\u0026 a b ...`   | Logic And: checks if all arguments are _truthy_.                                     |\n| `\\|\\| a b ...` | Logic Or: checks if at least one argument is _truthy_.                               |\n| `! a`          | Inverse: gets the inverse value of `a`. Only works for boolean values.               |\n\nThere is no explicit `!=` (not equal) operator because this can be achieved by combining the inverse and equals operators:\n\n```\n# works the same\n! == 2 4 # boolean : true\n```\n\n### Functions\n\nFunctions can be declared using braces. A function's return type is inferred from last expression in the function block. To call a function, simply specify provide the arguments after the function name. If the function doesn't take any arguments, it can be called with `()`.\n\n```\n= random { 42 }\nrandom () # integer : 42\n```\n\nFunction parameters can be defined in brackets following the opening brace:\n\n```\n= add { [a b] + a b }\nadd 2 3 # integer : 5\n```\n\nNote that calling a function that has a singular argument with `()` still works:\n\n```\n= is_null { [a] == a () }\nis_null () # boolean : true\n```\n\nBecause of this rule, this allows functions to be passed around as arguments:\n\n```\n= sum_numbers { [fn] fn 2 4 6 }\n= add { [a b c] + a b c }\n= subtract { [a b c] - a b c }\n\nsum_numbers add # integer : 12\nsum_numbers subtract # integer : -8\n```\n\nAlternatively, you can pass in a function literal directly (i.e. closures) but this may not be a permanent feature:\n\n```\nsum_numbers { [a b c] + a b c } # integer : 12\n```\n\n## Control Flow\n\nControl flow in the form of `if` and `else` statements is possible (chained `else-if` statements coming soon). Here's fibonacci (it actually works):\n\n```\n= fib { [n]\n    if \u003c n 2 {\n        1\n    } else {\n        + (fib - n 2) (fib - n 1)\n    }\n}\n\nfib 12 # integer : 233\n```\n\n## Development\n\n- Control statements (`for`)\n- Module management (`import`, `export`)\n- Method calls\n- Data types (`object`, `init`)\n- Function type signatures\n- Error management (`error`, `catch`)\n- Null safety\n- Separation of interpretation and compilation\n\nThis repository is managed under the Mozilla Public License v2.\n\n© 2023 devnote-dev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnote-dev%2Fclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevnote-dev%2Fclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnote-dev%2Fclip/lists"}