{"id":17484706,"url":"https://github.com/ryanmcdermott/esish","last_synced_at":"2026-02-27T20:38:48.016Z","repository":{"id":65977366,"uuid":"375451081","full_name":"ryanmcdermott/esish","owner":"ryanmcdermott","description":"Recursive descent parser written in Rust for an ECMAScript inspired language.","archived":false,"fork":false,"pushed_at":"2021-06-17T21:10:13.000Z","size":43,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-21T21:07:00.453Z","etag":null,"topics":["ast","ecmascript","parser","recursive-descent-parser","rust","tokenizer"],"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/ryanmcdermott.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-06-09T18:17:18.000Z","updated_at":"2024-08-31T16:42:25.000Z","dependencies_parsed_at":"2023-02-19T19:10:14.780Z","dependency_job_id":null,"html_url":"https://github.com/ryanmcdermott/esish","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/ryanmcdermott%2Fesish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Fesish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Fesish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Fesish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanmcdermott","download_url":"https://codeload.github.com/ryanmcdermott/esish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226272,"owners_count":21068171,"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":["ast","ecmascript","parser","recursive-descent-parser","rust","tokenizer"],"created_at":"2024-10-19T01:05:21.626Z","updated_at":"2026-02-27T20:38:42.978Z","avatar_url":"https://github.com/ryanmcdermott.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESish\n\nRecursive descent parser written in Rust for an ECMAScript inspired language.\n\n## Example\n\n\n### Crate usage\n```rust\nuse esish::{Parser, Tokenizer};\n\nlet program = r#\"\n    class Fib {\n        function calc(num) {\n            if (num \u003c= 1) {\n                return 1;\n            }\n\n            return this.calc(num - 1) + this.calc(num - 2);\n        }\n    }\n\n    let fib = new Fib();\n    fib.calc(42);\n\"#\n.to_string();\n\nlet tokenizer = Tokenizer::new(program);\nlet mut parser = Parser::new(tokenizer);\nlet parse_tree = parser.parse();\nlet mut actual_ast = serde_json::to_string_pretty(\u0026parse_tree).unwrap();\n\nprintln!(\"AST:\\n {}\", actual_ast);\n```\n\n### Output\n```json\n{\n  \"Program\": {\n    \"body\": [\n      {\n        \"ClassDeclaration\": {\n          \"id\": {\n            \"name\": \"Fib\"\n          },\n          \"body\": {\n            \"body\": [\n              {\n                \"FunctionDeclaration\": {\n                  \"name\": {\n                    \"name\": \"calc\"\n                  },\n                  \"params\": [\n                    {\n                      \"name\": \"num\"\n                    }\n                  ],\n                  \"body\": {\n                    \"body\": [\n                      {\n                        \"IfStatement\": {\n                          \"test\": {\n                            \"BinaryExpression\": {\n                              \"left\": {\n                                \"Identifier\": {\n                                  \"name\": \"num\"\n                                }\n                              },\n                              \"right\": {\n                                \"Literal\": {\n                                  \"NumericLiteral\": {\n                                    \"value\": 1\n                                  }\n                                }\n                              },\n                              \"operator\": \"OperatorRelational\"\n                            }\n                          },\n                          \"consequent\": {\n                            \"BlockStatement\": {\n                              \"body\": [\n                                {\n                                  \"ReturnStatement\": {\n                                    \"argument\": {\n                                      \"Literal\": {\n                                        \"NumericLiteral\": {\n                                          \"value\": 1\n                                        }\n                                      }\n                                    }\n                                  }\n                                }\n                              ]\n                            }\n                          },\n                          \"alternate\": null\n                        }\n                      },\n                      {\n                        \"ReturnStatement\": {\n                          \"argument\": {\n                            \"BinaryExpression\": {\n                              \"left\": {\n                                \"CallExpression\": {\n                                  \"callee\": {\n                                    \"MemberExpression\": {\n                                      \"object\": {\n                                        \"ThisExpression\": {}\n                                      },\n                                      \"computed\": false,\n                                      \"property\": {\n                                        \"Identifier\": {\n                                          \"name\": \"calc\"\n                                        }\n                                      }\n                                    }\n                                  },\n                                  \"arguments\": [\n                                    {\n                                      \"BinaryExpression\": {\n                                        \"left\": {\n                                          \"Identifier\": {\n                                            \"name\": \"num\"\n                                          }\n                                        },\n                                        \"right\": {\n                                          \"Literal\": {\n                                            \"NumericLiteral\": {\n                                              \"value\": 1\n                                            }\n                                          }\n                                        },\n                                        \"operator\": \"OperatorAdd\"\n                                      }\n                                    }\n                                  ]\n                                }\n                              },\n                              \"right\": {\n                                \"CallExpression\": {\n                                  \"callee\": {\n                                    \"MemberExpression\": {\n                                      \"object\": {\n                                        \"ThisExpression\": {}\n                                      },\n                                      \"computed\": false,\n                                      \"property\": {\n                                        \"Identifier\": {\n                                          \"name\": \"calc\"\n                                        }\n                                      }\n                                    }\n                                  },\n                                  \"arguments\": [\n                                    {\n                                      \"BinaryExpression\": {\n                                        \"left\": {\n                                          \"Identifier\": {\n                                            \"name\": \"num\"\n                                          }\n                                        },\n                                        \"right\": {\n                                          \"Literal\": {\n                                            \"NumericLiteral\": {\n                                              \"value\": 2\n                                            }\n                                          }\n                                        },\n                                        \"operator\": \"OperatorAdd\"\n                                      }\n                                    }\n                                  ]\n                                }\n                              },\n                              \"operator\": \"OperatorAdd\"\n                            }\n                          }\n                        }\n                      }\n                    ]\n                  }\n                }\n              }\n            ]\n          },\n          \"super_class\": null\n        }\n      },\n      {\n        \"VariableStatement\": {\n          \"declarations\": [\n            {\n              \"id\": {\n                \"name\": \"fib\"\n              },\n              \"init\": {\n                \"NewExpression\": {\n                  \"callee\": {\n                    \"Identifier\": {\n                      \"name\": \"Fib\"\n                    }\n                  },\n                  \"arguments\": []\n                }\n              }\n            }\n          ]\n        }\n      },\n      {\n        \"ExpressionStatement\": {\n          \"expression\": {\n            \"CallExpression\": {\n              \"callee\": {\n                \"MemberExpression\": {\n                  \"object\": {\n                    \"Identifier\": {\n                      \"name\": \"fib\"\n                    }\n                  },\n                  \"computed\": false,\n                  \"property\": {\n                    \"Identifier\": {\n                      \"name\": \"calc\"\n                    }\n                  }\n                }\n              },\n              \"arguments\": [\n                {\n                  \"Literal\": {\n                    \"NumericLiteral\": {\n                      \"value\": 42\n                    }\n                  }\n                }\n              ]\n            }\n          }\n        }\n      }\n    ]\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmcdermott%2Fesish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanmcdermott%2Fesish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmcdermott%2Fesish/lists"}