{"id":29570162,"url":"https://github.com/aidanm3341/cmel","last_synced_at":"2025-07-26T12:41:28.295Z","repository":{"id":189966548,"uuid":"578804149","full_name":"aidanm3341/cmel","owner":"aidanm3341","description":"My implementation of Lox from the Crafting Interpreters book.","archived":false,"fork":false,"pushed_at":"2024-11-28T09:32:08.000Z","size":290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-28T10:30:35.542Z","etag":null,"topics":["crafting-interpreters","lox","programming-language"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aidanm3341.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-12-15T23:20:28.000Z","updated_at":"2024-11-28T09:32:12.000Z","dependencies_parsed_at":"2024-09-18T00:56:41.854Z","dependency_job_id":"03347f29-1aed-46ca-932d-4b9443dea5e5","html_url":"https://github.com/aidanm3341/cmel","commit_stats":null,"previous_names":["aidanm3341/aph"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aidanm3341/cmel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidanm3341%2Fcmel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidanm3341%2Fcmel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidanm3341%2Fcmel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidanm3341%2Fcmel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidanm3341","download_url":"https://codeload.github.com/aidanm3341/cmel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidanm3341%2Fcmel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265872900,"owners_count":23842264,"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":["crafting-interpreters","lox","programming-language"],"created_at":"2025-07-19T02:08:27.579Z","updated_at":"2025-07-26T12:41:28.278Z","avatar_url":"https://github.com/aidanm3341.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cmel\n\nCmel (see-mel) is short for Caramel, the name of my cat.\n![Caramel](./caramel.jpeg)\nIt's my implementation of Lox from [Crafting Interpreters](https://www.craftinginterpreters.com) by Robert Nystrom.\n\n## Features\n\nHere are the features which separate `Cmel` from `Lox`.\n\n- Support for 2^24 constant values in a script\n- Local `const` values\n- Has a `break` statement to exit from loops early\n- Built-ins\n- Primitive methods (e.g. `\"string\".length()`)\n- Lists\n- Modulo operator\n\n### Primitive Types\n\n- Nil\n- Boolean\n- String\n    - `length()` returns the number of characters in the string\n    - `split(delimiter)` returns a list of elements in the given string as separated by the delimiter\n- Number\n    - `add(Number)` returns the number plus the passed number\n- List\n    - `add(value)` mutates the list by adding the given value and returns the same list\n    - `remove(index)` mutates the list by removing the value at the given index and returns the same list\n    - `length()` returns the length of the list\n\n### Built-in Functions\n\n- `input()` gets and returns a value from stdin\n- `clock()` returns the current time since the program started in seconds\n- `readFile(path)` returns the content of the given path as a String\n- `number(val)` returns a number representation of the given value. Only numbers, booleans and strings may be passed\n\n## Usage\n\nCompile the project using\n\n```\n./build.sh\n```\n\nThen, you can either run `cmel` as a REPL\n\n```\n./cmel\n```\n\nor execute a file by passing it the path\n\n```\n./cmel \u003cfilepath\u003e\n```\n\n## Testing\n\nTo test the code, first build the executable using the build script, then navigate to the test folder and run\n\n```\nnode --test\n```\n\n## Todo\n\n### Language Features\n\n- [ ] Widen `const` to work for global variables\n- [x] Arrays/Lists\n- [x] File Reading\n- [ ] Postfix Operators (e.g. ++ and --)\n- [ ] Ternary Operator\n- [x] Modulo Operator\n- [ ] String Escape Characters\n- [ ] String interpolation\n- [ ] Implicit convert to string on all types for concatenation\n- [ ] Try/Catch\n- [ ] Anonymous Functions\n- [ ] Modules\n- [ ] User facing Hash Tables (Including non-string keys)\n- [ ] Continue Statement\n- [x] Break Statement\n- [ ] Switch Statement\n- [ ] Typeof operator\n- [ ] toString method on instances\n\n### Tooling\n\n- [x] Syntax Highlighter\n- [ ] Language Server\n- [x] Test Runner\n\n### Misc\n\n- In chapter 18 it's mentioned that `a \u003c= b` should not be the same as `!(a \u003e b)` but in cmel it is. Fix by introducing dedicated instructions for `\u003c=`, `\u003e=` and maybe `!=` while you're at it\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidanm3341%2Fcmel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faidanm3341%2Fcmel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidanm3341%2Fcmel/lists"}