{"id":18356685,"url":"https://github.com/aaravmalani/lexmath","last_synced_at":"2025-10-16T07:17:13.684Z","repository":{"id":164482071,"uuid":"639861832","full_name":"AaravMalani/lexmath","owner":"AaravMalani","description":"A lexer for mathematical expressions in C","archived":false,"fork":false,"pushed_at":"2023-05-12T16:43:11.000Z","size":5,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T23:03:22.523Z","etag":null,"topics":["arithmetic","c","cmake","collaborate","expressions","lexer","math","mathematics","tokenizer"],"latest_commit_sha":null,"homepage":"","language":"C","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/AaravMalani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-05-12T11:51:37.000Z","updated_at":"2024-02-08T11:38:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"616846ce-0b75-4bfe-9e52-aad6c1139f6e","html_url":"https://github.com/AaravMalani/lexmath","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AaravMalani/lexmath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Flexmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Flexmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Flexmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Flexmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AaravMalani","download_url":"https://codeload.github.com/AaravMalani/lexmath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaravMalani%2Flexmath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279164853,"owners_count":26117803,"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-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["arithmetic","c","cmake","collaborate","expressions","lexer","math","mathematics","tokenizer"],"created_at":"2024-11-05T22:11:13.154Z","updated_at":"2025-10-16T07:17:13.655Z","avatar_url":"https://github.com/AaravMalani.png","language":"C","readme":"# LexMath: A lexer/tokenizer for mathematical expressions\n\n## Installation\n- Go to the [latest release](https://github.com/AaravMalani/lexmath/releases/latest)\n- Download the RPM file for Red-Hat based Linux Systems, DEB file for Debian based systems, the DLL or LIB file for Windows, or the PKG file for MacOS\n```sh\n# Ubuntu/Debian\nsudo dpkg -i \u003cfile\u003e.deb\n\n# RedHat Based Linux\nsudo rpm -i \u003cfile\u003e.rpm\n\n# MacOS\ninstaller -pkg \u003cfile\u003e.pkg -target /\n```\nFor Windows, you have to link it into the Visual Studio Project using the Linker menu in the Properties of the Project.\nThen download the [`lexmath.h`](https://raw.githubusercontent.com/AaravMalani/lexmath/main/include/lexmath.h) file and include that as a header file.\n\n## Usage\n```c\n#include \u003clexmath.h\u003e\n\nconst char* lexList[9] = {\n    \"LEX_ADD\", // + token\n    \"LEX_DIV\", // / token\n    \"LEX_MUL\", // * token\n    \"LEX_BRAC_START\", // ( token\n    \"LEX_BRAC_END\", // ) token\n    \"LEX_EXP\", // ^ token\n    \"LEX_SUB\", // - token\n    \"LEX_NAME\", // list of characters from a-z\n    \"LEX_NUM\" // A number (floating point included)\n};\n\nint main() {\n    struct LexList* list = lex(\"1+sin(2x) * 1+3+3^3\"); // List of tokens\n    struct LexToken* lst = list-\u003edata; // The pointer to the tokens\n    for (size_t i = 0; i \u003c list-\u003elength; i++){ // Iterate over the tokens\n        printf(\"Type: %s (%d)\\n\", lexList[lst[i].type], lst[i].type); // Print the Type\n        if (lst[i].data){ // If there is data to print\n            printf(\"Value: %s\\n\", lst[i].data); // Print the data\n        }\n        printf(\"\\n\"); // Print a new line\n    }\n    free_lex(list); // Free the tokens\n    \n}\n\n\n\n```\n### OUTPUT\n```\nType: LEX_NUM (8)\nValue: 1\n\nType: LEX_ADD (0)\n\nType: LEX_NAME (7)\nValue: sin\n\nType: LEX_BRAC_START (3)\n\nType: LEX_NUM (8)\nValue: 2\n\nType: LEX_NAME (7)\nValue: x\n\nType: LEX_BRAC_END (4)\n\nType: LEX_MUL (2)\n\nType: LEX_NUM (8)\nValue: 1\n\nType: LEX_ADD (0)\n\nType: LEX_NUM (8)\nValue: 3\n\nType: LEX_ADD (0)\n\nType: LEX_NUM (8)\nValue: 3\n\nType: LEX_EXP (5)\n\nType: LEX_NUM (8)\nValue: 3\n\n```\n\n## Credits\n- [avighnac](https://github.com/avighnac) who introduced the idea of making a mathematical expression parser.\n  \n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaravmalani%2Flexmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaravmalani%2Flexmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaravmalani%2Flexmath/lists"}