{"id":17310428,"url":"https://github.com/mohitk05/arepa","last_synced_at":"2025-04-14T13:56:45.490Z","repository":{"id":97371531,"uuid":"563106077","full_name":"mohitk05/arepa","owner":"mohitk05","description":"A tiny programming language based on LISP","archived":false,"fork":false,"pushed_at":"2022-11-16T22:15:50.000Z","size":17,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T03:01:43.792Z","etag":null,"topics":["interpreter","lisp","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohitk05.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":"2022-11-07T23:11:16.000Z","updated_at":"2024-05-02T13:12:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"1caa88df-c245-4c98-ba5c-cae084718d17","html_url":"https://github.com/mohitk05/arepa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohitk05%2Farepa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohitk05%2Farepa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohitk05%2Farepa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohitk05%2Farepa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohitk05","download_url":"https://codeload.github.com/mohitk05/arepa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248893332,"owners_count":21178997,"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":["interpreter","lisp","programming-language"],"created_at":"2024-10-15T12:37:02.881Z","updated_at":"2025-04-14T13:56:45.476Z","avatar_url":"https://github.com/mohitk05.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# arepa-lang\n\n`arepa` is a tiny interepreted programming language based on LISP.\n\nTo run a program:\n\n```bash\n# Install ts-node globally and run\nts-node src/index.ts src/test.arp\n```\n\n### Arithmetic\n\n```bash\n(+ 10 3) # Output = 13\n(* 2 (+ 4 1)) # Output = 10\n(/ 100 (/ 25 (+ 2 3))) # Output = 20\n```\n\n### Conditionals\n\nComparisons can be done using the `if` operator\n\n```bash\n# Syntax: (if \u003ccondition\u003e \u003ctrue expression\u003e \u003cfalse express\u003e)\n# If \"condition\" is evaluated to true, then execute \"true expression\"\n# and return its value. If it is evaluated to false,\n# then execute \"false expression\" and return its value.\n\n(if 1 2 3) # Output = 2\n(if (- 1 1) 2 3) # Output = 3\n(if 0 1 (if 1 4 5)) # Output = 4\n(if 1 \"hello\" \"goodbye\") # Output = \"hello\"\n```\n\n### Lists\n\nEverything in arepa inside a pair of `()` is a list. A list can be a set of any other type.\n\n```bash\n(1 2 3 4)\n(\"a\" \"b\" \"c\")\n(1 (1 2) 4)\n```\n\n### Functions\n\nFunctions are a powerful construct in any language. They can be defined in arepa using the `defunc` operator.\n\n```bash\n(\n    (defunc add (a b) (+ a b)) (add 1 2)\n)\n# Output = 3\n```\n\nAs arepa is an interpreted language, the function definition should be before the function call. You can declare multiple functions and construct nested patterns.\n\n```bash\n(\n    (defunc add (a b) (+ a b))\n    (defunc square (a) (* a a))\n    (square 2) # Output = 4\n    (add 2 (square 4)) # Output = 18\n    (defunc concat_w_space (a b) (+ a \" \" b))\n    (concat_w_space \"Have\" \"an\" \"arepa!\") # Output = Have an arepa!\n)\n```\n\nRecursion is not supported yet (I'll be working on it next!).\n\nRemainder calculation can be done by using an inbuilt operator `re`. This can be used to build functions with conditional bodies.\n\n```bash\n(\n    (defunc even_or_odd (num) (if (re num 2) \"odd\" \"even\"))\n    (even_or_odd 4) # Output = \"even\"\n    (even_or_odd 7) # Output = \"odd\"\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohitk05%2Farepa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohitk05%2Farepa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohitk05%2Farepa/lists"}