{"id":18012996,"url":"https://github.com/hackwaly/maitreya","last_synced_at":"2025-03-26T16:31:46.323Z","repository":{"id":143888654,"uuid":"46035006","full_name":"hackwaly/maitreya","owner":"hackwaly","description":"Maitreya - A generalized LR parser generator written in javascript","archived":false,"fork":false,"pushed_at":"2015-11-20T18:04:31.000Z","size":44,"stargazers_count":11,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T03:02:53.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/hackwaly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-12T06:51:08.000Z","updated_at":"2021-06-19T17:38:07.000Z","dependencies_parsed_at":"2023-03-21T09:39:05.689Z","dependency_job_id":null,"html_url":"https://github.com/hackwaly/maitreya","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackwaly%2Fmaitreya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackwaly%2Fmaitreya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackwaly%2Fmaitreya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackwaly%2Fmaitreya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackwaly","download_url":"https://codeload.github.com/hackwaly/maitreya/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245692714,"owners_count":20656994,"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-10-30T03:19:37.264Z","updated_at":"2025-03-26T16:31:46.017Z","avatar_url":"https://github.com/hackwaly.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Maitreya\n\n[![Build Status](https://travis-ci.org/hackwaly/maitreya.svg)](https://travis-ci.org/hackwaly/maitreya)\n\nMaitreya is a [generalized LR parser](https://en.wikipedia.org/wiki/GLR_parser) generator written in javascript.\n\n## Features\n\n- Accept GLR grammars, not limited to LR(k) grammars.\n- Support incremental (not yet) / streaming parsing.\n- Can do both scanner less parsing and token based parsing.\n- Can build grammar on the fly by using parser combinators.\n- Support both interpretation and code genearation.\n\n## Example\n\n```javascript\nimport {defineGrammar, def, ref, many1, regex, choice} from 'maitreya/grammar';\nimport {GLRParser} from 'maitreya/interpret';\n\nlet grammar = defineGrammar(() =\u003e {\n  def('exp', [ref('num')], ([num]) =\u003e num);\n  def('exp', [ref('exp'), ref('op'), ref('exp')], ([lhs, op, rhs]) =\u003e op(lhs, rhs));\n  def('num', [many1(regex(/^[0-9]/))], ([digits]) =\u003e Number(digits.join('')));\n  def('op', [choice('+', '-')], ([op]) =\u003e {\n    return {\n      ['+'](lhs, rhs) { return lhs + rhs; },\n      ['-'](lhs, rhs) { return lhs - rhs; }\n    }[op];\n  });\n});\n\nlet parser = new GLRParser(grammar);\nparser.feed('3+2-5');\nconsole.log(parser.results);\n```\nStill interested? Look at the [API Reference](https://github.com/hackwaly/maitreya/wiki/API-Reference)\n\n## Todos\n\n- [x] Interpret mode.\n- [ ] Code generation frontend.\n- [ ] Code generation backends.\n- [ ] Complete the test cases.\n- [ ] API documentation and website.\n- [ ] Performance benchmark and optimisation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackwaly%2Fmaitreya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackwaly%2Fmaitreya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackwaly%2Fmaitreya/lists"}