{"id":16463319,"url":"https://github.com/dptole/toylang","last_synced_at":"2025-07-24T13:11:10.041Z","repository":{"id":57109565,"uuid":"116610154","full_name":"dptole/toylang","owner":"dptole","description":"My first toy language. Created exclusively for learning purposes.","archived":false,"fork":false,"pushed_at":"2018-01-08T14:23:19.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-21T00:02:25.388Z","etag":null,"topics":["analyzer","ast","bnf","interpreter","language","parser","programming","syntax","toy"],"latest_commit_sha":null,"homepage":null,"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/dptole.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":"2018-01-08T00:27:48.000Z","updated_at":"2019-04-27T22:14:41.000Z","dependencies_parsed_at":"2022-08-20T17:41:01.633Z","dependency_job_id":null,"html_url":"https://github.com/dptole/toylang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dptole/toylang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dptole%2Ftoylang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dptole%2Ftoylang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dptole%2Ftoylang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dptole%2Ftoylang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dptole","download_url":"https://codeload.github.com/dptole/toylang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dptole%2Ftoylang/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266509529,"owners_count":23940489,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analyzer","ast","bnf","interpreter","language","parser","programming","syntax","toy"],"created_at":"2024-10-11T11:14:06.148Z","updated_at":"2025-07-24T13:11:10.022Z","avatar_url":"https://github.com/dptole.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Toylang\n=======\n\n  [![Build status][circle-ci-badge]][circle-ci]\n  [![Issue status][gh-issues-badge]][gh-issues]\n  [![NPM Version][npm-module-version-badge]][npm-module]\n  [![Downloads][npm-downloads-total-badge]][npm-module]\n  [![Say thanks][saythanks-badge]][saythanks-to]\n\nMy first toy language. Created exclusively for learning purposes.\n\nExample\n=======\n\n```javascript\nconst toylang = require('@dptole/toylang')\nconst ast = toylang.syntax.parse(`\n\nuser-name = 'dptole'\nuser-name-length = length(user-name)\n\nif(0 \u003c user-name-length \u003c 10) {\n  print('valid username length. its length is between 1 and 9')\n  print(user-name)\n} else {\n  print('invalid username')\n}\n\n`)\n\nconst result = toylang.interpreter.parse(ast)\n// It will output\n// \"valid username length. its length is between 1 and 9\"\n// \"dptole\"\n```\n\nClick [here][example-url] to see more.\n\nABNF-like syntax\n================\n\n```\nchunk = [ exp | decl ] *\n\nexp = [ assign | math_operation | func_call | func_def | primitive | variable ] [ ext_exp ] *\n\nassign = variable \"=\" exp\n\nvariable = [ a-z ] + [ [ \"-\" ] ? [ _a-z0-9 ] + ] *\n\nmath_operation = exp [ math_operator exp ] +\n\nmath_operator = [ \"-\" | \"+\" | \"*\" | \"/\" ]\n\nfunc_call = variable func_call_args_chunk\n\nfunc_call_args_chunk = \"(\" [ func_call_args_list ] ? \")\"\n\nfunc_call_args_list = exp [ \",\" exp ] *\n\nfunc_def = \"f \" variable \"(\" [ func_def_args_list ] ? \")\" \"{\" func_def_chunk \"}\"\n\nfunc_def_args_list = variable [ \",\" variable ] *\n\nfunc_def_chunk = chunk func_def_return\n\nfunc_def_return = \"return \" exp\n\nprimitive = [ number | string | boolean | array | object ]\n\nnumber = [ \"+\" | \"-\" ] ? [ 0-9 ] + [ \".\" [ 0-9 ] + ] ?\n\nstring = [ \"'\" [ ALPHA ] + \"'\" ] | [ \"\"\" [ ALPHA ] + \"\"\" ]\n\nboolean = [ \"T\" | \"F\" ]\n\narray = \"[\" [ exp [ \",\" exp ] * ] ? \"]\"\n\nobject = \"{\" [ variable \"=\" exp [ \";\" variable \"=\" exp ] * ] ? \"}\"\n\next_exp = [ ext_object | ext_array | func_call_args_chunk ]\n\next_object = \".\" exp\n\next_array = \"[\" exp \"]\"\n\ndecl = if\n\nif = \"if\" if_cond_block if_chunk_block [ else ] ?\n\nif_cond_block = \"(\" cond \")\"\n\ncond = [ log_unary ] ? exp [ log_op exp ] *\n\nlog_unary = \"not\"\n\nlog_op = \"\u003e\" | \"\u003c\" | \"==\" | \"!=\" | \"\u003e=\" | \"\u003c=\" | \"and\" | \"xor\" | \"or\"\n\nif_chunk_block = \"{\" chunk \"}\"\n\nelse = [ else_middle ] * else_end\n\nelse_middle = \"else\" if_cond_block if_chunk_block\n\nelse_end = \"else\" if_chunk_block\n```\n\nLicense\n=======\n\n[MIT][LICENSE]\n\n[circle-ci]: https://circleci.com/gh/dptole/toylang\n[circle-ci-badge]: https://img.shields.io/circleci/project/dptole/toylang.svg\n[gh-issues-badge]: https://img.shields.io/github/issues-raw/dptole/toylang.svg\n[gh-issues]: https://github.com/dptole/toylang/issues\n[npm-module-version-badge]: https://img.shields.io/npm/v/@dptole/toylang.svg\n[npm-module]: https://www.npmjs.org/package/@dptole/toylang\n[npm-downloads-total-badge]: https://img.shields.io/npm/dt/@dptole/toylang.svg\n[saythanks-badge]: https://img.shields.io/badge/say%20thanks-%E3%83%84-44cc11.svg\n[saythanks-to]: https://saythanks.io/to/dptole\n[example-url]: https://github.com/dptole/toylang/blob/master/example\n[LICENSE]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdptole%2Ftoylang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdptole%2Ftoylang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdptole%2Ftoylang/lists"}