{"id":20520004,"url":"https://github.com/tejasag/hera","last_synced_at":"2025-04-14T02:12:24.325Z","repository":{"id":46573480,"uuid":"393755578","full_name":"tejasag/hera","owner":"tejasag","description":"🌬️ A programming language with minimal and simple syntax ","archived":false,"fork":false,"pushed_at":"2022-03-05T15:06:02.000Z","size":183,"stargazers_count":32,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T02:12:15.991Z","etag":null,"topics":["hacktoberfest","language","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/tejasag.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}},"created_at":"2021-08-07T17:59:10.000Z","updated_at":"2025-01-10T06:04:35.000Z","dependencies_parsed_at":"2022-08-26T05:02:23.028Z","dependency_job_id":null,"html_url":"https://github.com/tejasag/hera","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/tejasag%2Fhera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasag%2Fhera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasag%2Fhera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasag%2Fhera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tejasag","download_url":"https://codeload.github.com/tejasag/hera/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809051,"owners_count":21164896,"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":["hacktoberfest","language","rust"],"created_at":"2024-11-15T22:17:28.105Z","updated_at":"2025-04-14T02:12:24.306Z","avatar_url":"https://github.com/tejasag.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `hera`\n\nHera is a simple programming language made to learn more about interpreters and compilers.\n\n![build status](https://github.com/tejasag/hera/actions/workflows/build.yml/badge.svg)\n![test status](https://github.com/tejasag/hera/actions/workflows/test.yml/badge.svg)\n\n## Usage\n\n```sh\n# To run a .hera file\nhera run \u003cfilename\u003e.hera\n\n# To open the REPL\nhera\n```\n\n## Syntax\n\n### Variable declaration\n\n\u003e **All declaration statements should end with a `;`!**\n\n```\nlet name = value;\n```\n\n```\n# strings\nlet a = \"hi\";\n\n# boolean\nlet b = true;\n\n# integer\nlet c = 10;\n```\n\n### Updating variables\n\n```\nupdate name = value;\n```\n\n```\nlet a = 10;\nupdate a = 15;\n```\n\n### Arrays\n\n```\n# declaration\nlet arr = [1,2,3,4];\n\n# Accessing elements\narr[0] # --\u003e 1\narr[1] # --\u003e 2\narr[-1] # --\u003e 4\n```\n\n### Hashes\n\n```\nlet hash = {\n    \"one\": \"Hello\",\n    \"two\": \"World!\",\n    3: \"number as key\",\n    3+4: \"my key is 7\",\n    true: \"my key is a boolean\"\n};\n\nhash[\"one\"] # \"Hello\"\nhash[3] # \"number as key\"\nhash[7] # \"my key is 7\"\nhash[true] # \"my key is boolean\"\n\n```\n\n### Functions\n\n```\nlet name = fn(\u003cparams\u003e) {\n    \u003cbody\u003e\n};\n```\n\n```\nlet double = fn(x) {\n    x * 2\n};\n\ndouble(10) # 20\n```\n\nYou can directly put the expression or value to return **without any keyword or semicolon** or use `return x * 2;`\n\n### Conditions\n\n```\nif (\u003ccondition\u003e) {\n    \u003cbody\u003e\n}\n\nelse {\n    \u003cbody\u003e\n}\n\nelse if (\u003ccondition\u003e) {\n    \u003cbody\u003e\n}\n```\n\n```\nif (3 \u003e 4) {\n    print(\"wtf\");\n} else if (4 \u003e 3) {\n    print(\"correct lol\");\n} else {\n    print(\"idk man\");\n}\n```\n\n### Imports\n\nThe only library currently available is `std`\n\n```\nimport \u003clib\u003e;\n```\n\n```\nimport std;\n```\n\n## BuiltIn Functions\n\n`print(argument)` - Prints the argument on the screen \u003cbr\u003e\n`push(array, value)` - Inserts a value in an array \u003cbr\u003e\n`tail(array)` - Returns a new array without the first element of the given array \u003cbr\u003e\n`len(argument)` - Returns the length of a string or an array\n\n## `std` library\n\n`map(array, function)` - Runs the function on all elements of the given array and returns a new array with the returned values from the function\n\nExample:\n\n```\nlet array = [2,3,4,5];\nlet double = fn(x) {\n    x \\* 2\n};\n\nlet new = map(array, double);\n\n# new = [4,6,8,10]\n```\n\n`while(condition, body)` - A while loop that runs the body till the condition is true\n\nExample:\n\n```\nlet i = 1;\n\nlet condition = fn() { i \u003c 15 };\nwhile(condition, fn() {\n    print(i);\n    update i = i+1;\n});\n```\n\n`range(limit)` - Returns an array with numbers from 1 to limit \u003cbr\u003e\n`abs(num)` - Returns a positive variant of the given negative or postive number \u003cbr\u003e\n`first(array)` - Returns the first element of an array \u003cbr\u003e\n`last(array)` - Returns the last element of an array\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasag%2Fhera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftejasag%2Fhera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasag%2Fhera/lists"}