{"id":13645568,"url":"https://github.com/Fugoes/Final","last_synced_at":"2025-04-21T14:31:43.826Z","repository":{"id":119118350,"uuid":"75478668","full_name":"Fugoes/Final","owner":"Fugoes","description":"An Interpreter","archived":false,"fork":false,"pushed_at":"2017-06-30T08:41:17.000Z","size":6554,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T01:23:57.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/Fugoes.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":"2016-12-03T14:31:21.000Z","updated_at":"2019-01-05T04:04:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c2e3f0b-c5e5-4d64-8f0a-6b01024684fe","html_url":"https://github.com/Fugoes/Final","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fugoes%2FFinal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fugoes%2FFinal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fugoes%2FFinal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fugoes%2FFinal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fugoes","download_url":"https://codeload.github.com/Fugoes/Final/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070174,"owners_count":21369839,"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-02T01:02:37.456Z","updated_at":"2025-04-21T14:31:43.213Z","avatar_url":"https://github.com/Fugoes.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Introduction\n\n`Final` is a recursive acronym for `Final is not another lisp`. `Final` is a language, and this project is its interpreter. It is developed to hand in as homework...\n\n# Build\n\n```\n$ git clone https://github.com/Fugoes/Final.git\n$ cd Final\n$ mkdir build\n$ cd build\n$ cmake ..\n$ cmake --build .\n```\n\nYou could set the complier by passing the `-G` option.\n\nTo get release version, use `cmake -DCMAKE_BUILD_TYPE=Release ..` instead of `cmake ..`, and `cmake --build . --config Release` instead of `cmake --build .`.\n\nThe binary file will be `Final` under linux and `Final.exe` under Windows.\n\n# Grammar\n\n## Basic\n\n* `(+ \u003cexpressions\u003e)`\n\n  For example:\n\n  ```\n  \u003e\u003e\u003e (+ 1 2 3)\n  6\n  \u003e\u003e\u003e (+ (+ 1 2) 1)\n  4\n  ```\n\n  Note that the number of parameters can be arbitrary.\n\n* `(- \u003cexpression1\u003e \u003cexpression2\u003e)`\n\n  Only accept two parameters and return `\u003cexpression1\u003e - \u003cexpression2\u003e`.\n\n* `(* \u003cexpressions\u003e)`\n\n  Similar to `+`.\n\n* `(/ \u003cexpression1\u003e \u003cexpression2\u003e)`\n\n* `(% \u003cexpression1\u003e \u003cexpression2\u003e)`\n\n\n* `(\u003e \u003cexpression1\u003e \u003cexpression2\u003e)`, `(\u003c \u003cexpression1\u003e \u003cexpression2\u003e)`, `(= \u003cexpression1\u003e \u003cexpression2\u003e)`\n\n  Compare two expressions value.\n\n* `(if \u003cexpression1\u003e \u003cexpression2\u003e \u003cexpression3\u003e)`\n\n  if `\u003cexpression1\u003e` is true, execute `\u003cexpression2\u003e` and return its value, else execute `\u003cexpression3\u003e` and return its value.\n\n* `(begin \u003cexpression1\u003e ... \u003cexpressionn\u003e)`\n\n  Execute `\u003cexpression1\u003e` to `\u003cexpressionn\u003e` one by one, and return the last expression's value.\n\n* `(print \u003cexpression1\u003e ... \u003cexpressionn\u003e)`\n\n* `(display \u003cexpression1\u003e ... \u003cexpressionn\u003e)`\n\n* `(runtime)`\n\n  This command will display all variables in your run time.\n\n\n## Use variable\n\n* `(assign a 5)`\n\n  Assign a to 5. Similar to `=` in python.\n\n* `(set a 5)`\n\nIn `Final`, each bracket has its own variable scope, for example:\n\n```\n\u003e\u003e\u003e (assign a 2)\ntrue\n\u003e\u003e\u003e (print a)\n2\ntrue\n\u003e\u003e\u003e (begin (print a))\n2\ntrue\n\u003e\u003e\u003e (begin (assign a 3) (print a))\n3\ntrue\n\u003e\u003e\u003e (print a)\n2\ntrue\n```\n\nThe difference between `assign` and `set` could be demonstrated with this example:\n\n```\n\u003e\u003e\u003e (assign a 2)\ntrue\n\u003e\u003e\u003e (assign b a)\ntrue\n\u003e\u003e\u003e (runtime)\n\nname : a\ncited: 2\ntype : Integer\nvalue: 2\n\n\nname : b\ncited: 2\ntype : Integer\nvalue: 2\n\ntrue\n\u003e\u003e\u003e (set a 4)\ntrue\n\u003e\u003e\u003e (runtime)\n\nname : a\ncited: 2\ntype : Integer\nvalue: 4\n\nname : b\ncited: 2\ntype : Integer\nvalue: 4\n\ntrue\n\u003e\u003e\u003e (assign a 2)\ntrue\n\u003e\u003e\u003e (runtime)\n\nname : a\ncited: 1\ntype : Integer\nvalue: 2\n\n\nname : b\ncited: 1\ntype : Integer\nvalue: 4\n\ntrue\n```\n\nWhat's more, you could only using `set` on an integer.\n\n* `(echo \u003cexpression\u003e)`\n\n  Return the value of the expression.\n\n## Define function\n\nHere is an example:\n\n```\n\u003e\u003e\u003e (function (fbi n)\n...           (if (\u003c n 2)\n...               1\n...               (+ (fbi (- n 1)) (fbi (- n 2)))))\ntrue\n\u003e\u003e\u003e (fbi 10)\n89\n```\n\nIn a function, you cannot use variables defined outside that function.\n\n# License\n\n`Final` is licensed under the [WTFPL](http://www.wtfpl.net/). Note that you shall not hand it in as your homework...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFugoes%2FFinal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFugoes%2FFinal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFugoes%2FFinal/lists"}