{"id":31758513,"url":"https://github.com/nickscha/aritlex","last_synced_at":"2025-10-09T20:32:49.148Z","repository":{"id":317990863,"uuid":"1069622703","full_name":"nickscha/aritlex","owner":"nickscha","description":"C89, single header, nostdlib arithmetic lexer","archived":false,"fork":false,"pushed_at":"2025-10-04T09:54:50.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T11:36:18.326Z","etag":null,"topics":["arithmetic-operations","c89","lexer","nostdlib","single-header","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/nickscha.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-04T09:48:34.000Z","updated_at":"2025-10-04T09:54:54.000Z","dependencies_parsed_at":"2025-10-04T11:36:20.529Z","dependency_job_id":"31dc4c59-1bc7-4d4e-9887-74be3713c36a","html_url":"https://github.com/nickscha/aritlex","commit_stats":null,"previous_names":["nickscha/aritlex"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nickscha/aritlex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Faritlex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Faritlex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Faritlex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Faritlex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickscha","download_url":"https://codeload.github.com/nickscha/aritlex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Faritlex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002000,"owners_count":26083258,"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-09T02:00:07.460Z","response_time":59,"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-operations","c89","lexer","nostdlib","single-header","tokenizer"],"created_at":"2025-10-09T20:30:48.855Z","updated_at":"2025-10-09T20:32:49.139Z","avatar_url":"https://github.com/nickscha.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aritlex\nA C89 standard compliant, single header, nostdlib (no C Standard Library) Arithmetic Lexer (ARITLEX).\n\nFor more information please look at the \"aritlex.h\" file or take a look at the \"examples\" or \"tests\" folder.\n\n\u003e [!WARNING]\n\u003e THIS PROJECT IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! USE THIS PROJECT AT YOUR OWN RISK!\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/nickscha/aritlex/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/nickscha/aritlex?style=flat-square\u0026color=blue\" alt=\"Latest Release\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/nickscha/aritlex/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/downloads/nickscha/aritlex/total?style=flat-square\u0026color=brightgreen\" alt=\"Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Standard-C89-orange?style=flat-square\" alt=\"C Standard\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/nolib-nostdlib-lightgrey?style=flat-square\" alt=\"nostdlib\"\u003e\n\u003c/p\u003e\n\n## **Features**\n- **C89 compliant** — portable and legacy-friendly  \n- **Single-header API** — just include `aritlex.h`  \n- **nostdlib** — no dependency on the C Standard Library  \n- **Minimal binary size** — optimized for small executables  \n- **Cross-platform** — Windows, Linux, MacOs \n- **Strict compilation** — built with aggressive warnings \u0026 safety checks  \n\n## Quick Start\n\nDownload or clone aritlex.h and include it in your project.\n\n```C\n#include \"aritlex.h\" /* Arithmetic Lexer */\n\nint main() {\n    /* Define a buffer to hold the tokens generated */\n    #define TOKENS_CAPACITY 1024\n    aritlex_token tokens[TOKENS_CAPACITY];\n    u32 tokens_size = 0;\n\n    s8 *code = \"1 + 3\";\n\n    /* Run the lexer */\n    aritlex_tokenize(\n      code, aritlex_strlen(code), \n      tokens, TOKENS_CAPACITY, \u0026tokens_size\n    );\n\n    return 0;\n}\n```\n\n## Token Overview\n\n| **Category**               | **Token Name**    | **Lexeme / Symbol(s)** | **Description / Example**               |                       |            |\n| :------------------------- | :---------------- | :--------------------- | :-------------------------------------- | --------------------- | ---------- |\n| **Literals**               | `TOK_NUM_INTEGER` | `42`, `0xFF`, `0b1010` | Integer literals (decimal, hex, binary) |                       |            |\n|                            | `TOK_NUM_FLOAT`   | `3.14`, `1e-3`         | Floating-point numbers                  |                       |            |\n|                            | `TOK_STRING`      | `\"hello\\nworld\"`       | String literals with escape sequences   |                       |            |\n|                            | `TOK_VAR`         | `x`, `y_1`, `_foo`     | Variable or identifier name             |                       |            |\n| **Assignment Operators**   | `TOK_ASSIGN`      | `=`                    | Simple assignment                       |                       |            |\n|                            | `TOK_PLUS_EQ`     | `+=`                   | Add and assign                          |                       |            |\n|                            | `TOK_MINUS_EQ`    | `-=`                   | Subtract and assign                     |                       |            |\n|                            | `TOK_MUL_EQ`      | `*=`                   | Multiply and assign                     |                       |            |\n|                            | `TOK_DIV_EQ`      | `/=`                   | Divide and assign                       |                       |            |\n|                            | `TOK_MOD_EQ`      | `%=`                   | Modulus and assign                      |                       |            |\n|                            | `TOK_AND_EQ`      | `\u0026=`                   | Bitwise AND and assign                  |                       |            |\n|                            | `TOK_OR_EQ`       | `                      | =`                                      | Bitwise OR and assign |            |\n|                            | `TOK_XOR_EQ`      | `^=`                   | Bitwise XOR and assign                  |                       |            |\n|                            | `TOK_SHL_EQ`      | `\u003c\u003c=`                  | Left shift and assign                   |                       |            |\n|                            | `TOK_SHR_EQ`      | `\u003e\u003e=`                  | Right shift and assign                  |                       |            |\n| **Arithmetic Operators**   | `TOK_PLUS`        | `+`                    | Addition                                |                       |            |\n|                            | `TOK_MINUS`       | `-`                    | Subtraction                             |                       |            |\n|                            | `TOK_MUL`         | `*`                    | Multiplication                          |                       |            |\n|                            | `TOK_DIV`         | `/`                    | Division                                |                       |            |\n|                            | `TOK_MOD`         | `%`                    | Modulo                                  |                       |            |\n| **Increment / Decrement**  | `TOK_INC`         | `++`                   | Increment                               |                       |            |\n|                            | `TOK_DEC`         | `--`                   | Decrement                               |                       |            |\n| **Comparison Operators**   | `TOK_EQ`          | `==`                   | Equal to                                |                       |            |\n|                            | `TOK_NEQ`         | `!=`                   | Not equal to                            |                       |            |\n|                            | `TOK_LT`          | `\u003c`                    | Less than                               |                       |            |\n|                            | `TOK_LE`          | `\u003c=`                   | Less than or equal to                   |                       |            |\n|                            | `TOK_GT`          | `\u003e`                    | Greater than                            |                       |            |\n|                            | `TOK_GE`          | `\u003e=`                   | Greater than or equal to                |                       |            |\n| **Logical Operators**      | `TOK_AND_AND`     | `\u0026\u0026`                   | Logical AND                             |                       |            |\n|                            | `TOK_OR_OR`       | `                      |                                         | `                     | Logical OR |\n|                            | `TOK_NOT`         | `!`                    | Logical NOT                             |                       |            |\n| **Bitwise Operators**      | `TOK_AND`         | `\u0026`                    | Bitwise AND                             |                       |            |\n|                            | `TOK_OR`          | `                      | `                                       | Bitwise OR            |            |\n|                            | `TOK_XOR`         | `^`                    | Bitwise XOR                             |                       |            |\n|                            | `TOK_NOT_BIT`     | `~`                    | Bitwise NOT                             |                       |            |\n|                            | `TOK_SHL`         | `\u003c\u003c`                   | Left shift                              |                       |            |\n|                            | `TOK_SHR`         | `\u003e\u003e`                   | Right shift                             |                       |            |\n| **Punctuation / Grouping** | `TOK_LPAREN`      | `(`                    | Left parenthesis                        |                       |            |\n|                            | `TOK_RPAREN`      | `)`                    | Right parenthesis                       |                       |            |\n|                            | `TOK_QMARK`       | `?`                    | Ternary condition start                 |                       |            |\n|                            | `TOK_COLON`       | `:`                    | Ternary else separator                  |                       |            |\n|                            | `TOK_SEMICOLON`   | `;`                    | Statement terminator                    |                       |            |\n| **Special**                | `TOK_ERROR`       | *(invalid input)*      | Lexical error token                     |                       |            |\n|                            | `TOK_EOF`         | *(end of input)*       | End of source marker                    |                       |            |\n\n\n## Run Example: nostdlib, freestsanding\n\nIn this repo you will find the \"examples/aritlex_win32_nostdlib.c\" with the corresponding \"build.bat\" file which\ncreates an executable only linked to \"kernel32\" and is not using the C standard library and executes the program afterwards.\n\n## \"nostdlib\" Motivation \u0026 Purpose\n\nnostdlib is a lightweight, minimalistic approach to C development that removes dependencies on the standard library. The motivation behind this project is to provide developers with greater control over their code by eliminating unnecessary overhead, reducing binary size, and enabling deployment in resource-constrained environments.\n\nMany modern development environments rely heavily on the standard library, which, while convenient, introduces unnecessary bloat, security risks, and unpredictable dependencies. nostdlib aims to give developers fine-grained control over memory management, execution flow, and system calls by working directly with the underlying platform.\n\n### Benefits\n\n#### Minimal overhead\nBy removing the standard library, nostdlib significantly reduces runtime overhead, allowing for faster execution and smaller binary sizes.\n\n#### Increased security\nStandard libraries often include unnecessary functions that increase the attack surface of an application. nostdlib mitigates security risks by removing unused and potentially vulnerable components.\n\n#### Reduced binary size\nWithout linking to the standard library, binaries are smaller, making them ideal for embedded systems, bootloaders, and operating systems where storage is limited.\n\n#### Enhanced performance\nDirect control over system calls and memory management leads to performance gains by eliminating abstraction layers imposed by standard libraries.\n\n#### Better portability\nBy relying only on fundamental system interfaces, nostdlib allows for easier porting across different platforms without worrying about standard library availability.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Faritlex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickscha%2Faritlex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Faritlex/lists"}