{"id":28324901,"url":"https://github.com/syildizz/egglang-compiler-extended","last_synced_at":"2025-06-24T03:31:18.920Z","repository":{"id":251887727,"uuid":"838746430","full_name":"syildizz/EggLang-Compiler-Extended","owner":"syildizz","description":"This is a compiler for the Egg language that is mentioned in Chapter 12 of Eloquent Javascript","archived":false,"fork":false,"pushed_at":"2024-08-13T08:05:15.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T04:40:02.959Z","etag":null,"topics":["compiler","eloquent-javascript","javascript","recursive-descent-parser"],"latest_commit_sha":null,"homepage":"https://eloquentjavascript.net/12_language.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/syildizz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T09:03:30.000Z","updated_at":"2025-04-28T20:35:57.000Z","dependencies_parsed_at":"2024-08-06T11:03:18.181Z","dependency_job_id":"0543797e-f884-4a36-bf80-637c6bfd7673","html_url":"https://github.com/syildizz/EggLang-Compiler-Extended","commit_stats":null,"previous_names":["syildizz/egglang-compiler-extended"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/syildizz/EggLang-Compiler-Extended","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syildizz%2FEggLang-Compiler-Extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syildizz%2FEggLang-Compiler-Extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syildizz%2FEggLang-Compiler-Extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syildizz%2FEggLang-Compiler-Extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syildizz","download_url":"https://codeload.github.com/syildizz/EggLang-Compiler-Extended/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syildizz%2FEggLang-Compiler-Extended/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261598753,"owners_count":23182824,"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":["compiler","eloquent-javascript","javascript","recursive-descent-parser"],"created_at":"2025-05-25T19:13:26.985Z","updated_at":"2025-06-24T03:31:18.910Z","avatar_url":"https://github.com/syildizz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EggLang Compiler Extended\n\nThis is a compiler for the Egg language that is mentioned in Chapter 12 of [Eloquent Javascript](https://eloquentjavascript.net/12_language.html).\nThe compiler compiles the Egg language into javascript as defined in the original specification. \nIt also adds some new features to the Egg language that did not exist in the original specification. \n\nThe code features here is built upon the original code by Marijn Haverbeke.\n\nThe javascript code which is generated by the EggLang Compiler is correctly indented and has semicolons inserted in the correct places for readability sake.\n\n## Extensions\n\nThe compiler includes the extensions that are given in the exercises.\nSuch as:\n\n* Array support\n* Comment support\n* Set statement support\n\n### For statement\n\nThe compiler supports for statements in the form of \n\n```\nfor(arg1, arg2, arg3, body)\n```\n\nwhich corresponds to the typical for loop in other languages where\n\n```js\nfor (arg1; arg2; arg3) {\n    body;\n}\n```\n\n### Native statement\n\nThe compiler supports a native statement. The native statement is used for writing inline javascript. It passed the expressions inside of it directly into the compiled code.\n\n```\nnative(body)\n```\n\nbecomes\n\n```js\nbody\n```\n\n### Extern statement\n\nThe compiler supports an extern statement. The extern statement is used to define a label to the compiler that is outside of it's scope. \n\nNormally, the compiler would throw an error when accessing a label that it does not recognize. \nThe extern statement adds the label to the compiler so that it can properly recognize it.\nThis statement is usually used to access global variables from javascript or from native statements.\n\n```\nextern(label)\n```\n\nbecomes\n\n```js\n// External label: label\n```\n\nNo code is generated since this statement is for the compiler only.\n\n\n### Push statement\n\nThe compiler supports a push statement. The push statement is the [_Array.prototype.push_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) method implemented for Egg language.\n\n```\npush(array, val)\n```\n\nbecomes\n\n```js\narray.push(val);\n```\n\n# Incompatibility\n\nFor the most part, the compiler is compatible with the original Egg language interpreter mentioned in [Eloquent Javascript](https://eloquentjavascript.net/12_language.html).\nHowever, due to implementation details, there are some incompatibilities between the compiler here and the interpreter.\n\nIn the interpreter, the expressions _if_ and _while_ return the value _0_. However, in the compiler, the compiler compiles them into if and while statements. \nBecause of this, they do not return any value when compiled.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyildizz%2Fegglang-compiler-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyildizz%2Fegglang-compiler-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyildizz%2Fegglang-compiler-extended/lists"}