{"id":27142711,"url":"https://github.com/yjhmelody/lambda-language","last_synced_at":"2025-04-08T07:59:22.959Z","repository":{"id":57272955,"uuid":"99291748","full_name":"yjhmelody/lambda-language","owner":"yjhmelody","description":"A lisp-style language written by Recursive Descent. This is my first compiler by imitating a blog. ","archived":false,"fork":false,"pushed_at":"2018-12-28T08:14:06.000Z","size":1249,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T18:03:53.391Z","etag":null,"topics":["comments","javascipt","lambda","practice-project","toy-programming-language"],"latest_commit_sha":null,"homepage":"https://yjhmelody.github.io/lambda-language/out/Environment.html","language":"JavaScript","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/yjhmelody.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":"2017-08-04T01:54:02.000Z","updated_at":"2018-12-28T08:14:07.000Z","dependencies_parsed_at":"2022-08-25T01:14:18.916Z","dependency_job_id":null,"html_url":"https://github.com/yjhmelody/lambda-language","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjhmelody%2Flambda-language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjhmelody%2Flambda-language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjhmelody%2Flambda-language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjhmelody%2Flambda-language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjhmelody","download_url":"https://codeload.github.com/yjhmelody/lambda-language/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801166,"owners_count":20998333,"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":["comments","javascipt","lambda","practice-project","toy-programming-language"],"created_at":"2025-04-08T07:59:22.383Z","updated_at":"2025-04-08T07:59:22.920Z","avatar_url":"https://github.com/yjhmelody.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The lambda-language\n[![complier](https://img.shields.io/badge/lambda--langugage-complier-blue.svg)](https://github.com/yjhmelody/lambda-language)\n[![version](https://img.shields.io/badge/version-0.3.6-blue.svg)](https://github.com/yjhmelody/lambda-language)\n[![npm](https://img.shields.io/npm/dm/lambda-language.svg)](https://www.npmjs.com/package/lambda-language)\n\n---\n## Install\n\n```\n$ npm install lambda-language\n```\n\n## Syntax\n\nref the [example](./demo/demo1)\n\n## API\n\nThe following are located in the corresponding file in `src`\n\n* InputStream: output lex\n* TokenStream: output token\n* parser: output ast\n* codeGen: complier the ast to JS\n* Environment: store variables\n* Environment.Execute: execute ast with guarding stack \n* Environment.evalute: eval ast expression with an env\n\n\n## Run the language\n\n```\n$ bin/lambda demo\n```\n\n## Compile the language to JS\n\n```\n$ bin/code-to-js demo2 [demo2.js]\n```\n\n### Some examples about syntax\n\n```\nprint_range = λ(a, b) if a \u003c= b {\n                        println(a);\n                        if a + 1 \u003c= b {\n                          print_range(a + 1, b);\n                        } \n                        else \n                          println(\"\");\n                      };\nprint_range(1, 10);\n```\n\noutput:\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9 \n10\n```\n\n```\ncons = λ(a, b) λ(f) f(a, b);\ncar = λ(cell) cell(λ(a, b) a);\ncdr = λ(cell) cell(λ(a, b) b);\nNIL = λ(f) f(NIL, NIL);\n\nx = cons(1, cons(2, cons(3, cons(4, cons(5, NIL)))));\nprintln(car(x));                      # 1\nprintln(car(cdr(x)));                 # 2\nprintln(car(cdr(cdr(x))));            # 3\nprintln(car(cdr(cdr(cdr(x)))));       # 4\nprintln(car(cdr(cdr(cdr(cdr(x))))));  # 5\n```\n\noutput:\n```\n1\n2\n3\n4\n5\n```\n\nbinded with some nodejs functions\n```\ncode = fs-readFileSync(\"./demo\");\nprintln(code);\nprintln(os-arch());\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjhmelody%2Flambda-language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjhmelody%2Flambda-language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjhmelody%2Flambda-language/lists"}