{"id":13819656,"url":"https://github.com/NicholasLYang/for-the-graal","last_synced_at":"2025-05-16T07:31:45.444Z","repository":{"id":81134294,"uuid":"358738713","full_name":"NicholasLYang/for-the-graal","owner":"NicholasLYang","description":"A simple but absurd language implemented in Ruby-Java-JavaScript","archived":false,"fork":false,"pushed_at":"2021-04-17T05:54:18.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-09T23:35:16.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/NicholasLYang.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}},"created_at":"2021-04-16T23:03:31.000Z","updated_at":"2022-05-02T04:34:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"91cf6bea-7422-47fe-a92b-aaeadf630a6d","html_url":"https://github.com/NicholasLYang/for-the-graal","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/NicholasLYang%2Ffor-the-graal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasLYang%2Ffor-the-graal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasLYang%2Ffor-the-graal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasLYang%2Ffor-the-graal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NicholasLYang","download_url":"https://codeload.github.com/NicholasLYang/for-the-graal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254488264,"owners_count":22079392,"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-08-04T08:00:51.303Z","updated_at":"2025-05-16T07:31:45.134Z","avatar_url":"https://github.com/NicholasLYang.png","language":"Java","funding_links":[],"categories":["Happy Exploring 🤘"],"sub_categories":[],"readme":"# For The Graal\n\nThis is a fun absurd interpreter for a mini language.\n\nThe parser is implemented in Ruby using a s-expression parser SXP,\nthe type checker/compiler is written in Java and the interpreter in\nJavaScript\n\n## Language\n\nA program consists of a list of statements. Currently, there are functions,\n if statements, let statements and print statements.\n\nThe language supports numbers (double precision floating point), strings and bools.\n\nFunctions are defined using `fun`. They take in a name, a list of params,\nand a body. Params are a name/type pair. The function body is a list of\nstatements.\n```\n(\n  (fun foo ((n number) (b number)) \n    (\n      (print (* n b))\n    )\n  )\n)\n```\n\nLet statements are defined using `let`. They take in a name and an expression.\n\n```\n(\n  (let a (* 25 (/ 30 10)))\n)\n```\n\nPrint statements are defined using `print`. They take in a single expression.\n```\n(\n  (print \"foobar\")\n)\n```\n\nIf statements are defined using `if`. They take in a condition, and \na then block with an optional else block.\n```\n(\n  (if (\u003c 10 20) (print \"10 \u003c 20\"))\n  (if (\u003c 21 20) (print \"21 \u003c 20\") (print \"21 \u003e 20\"))\n)\n```\n## Running\nBefore running, you should have Graal with Ruby, JavaScript and Java\nall installed. Also, please make sure to run `bundle install` \nto install `sxp`.\n\nCompiling is simply:\n```\njavac -Xlint:unchecked -classpath src/ src/Main.java\n```\nand running:\n```\njava -classpath src/ Main \u003csource_file\u003e\n```\n\nWhere `\u003csource_file\u003e` is a file containing the source code. \nCheck out `examples/` for, well, examples.\n\n`javac` and `java` must be the Graal versions, of course.\n\nNOTE: You must run the code from the root directory as it loads files\nvia relative paths.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNicholasLYang%2Ffor-the-graal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNicholasLYang%2Ffor-the-graal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNicholasLYang%2Ffor-the-graal/lists"}