{"id":24963136,"url":"https://github.com/missipsag/lexic-analyser","last_synced_at":"2026-01-30T14:39:13.716Z","repository":{"id":265444362,"uuid":"896004816","full_name":"missipsag/LexiC-analyser","owner":"missipsag","description":"This project is a Lexical Analyzer (Scanner) implemented in C, designed to tokenize a simple programming language. It processes an input string (source code) and identifies valid tokens such as keywords, identifiers, numbers, operators, and punctuation marks. The analyzer is based on a Deterministic Finite Automaton (DFA).","archived":false,"fork":false,"pushed_at":"2024-11-29T15:02:57.000Z","size":94,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T18:33:36.659Z","etag":null,"topics":["automaton","c","c-programming","compilation","dfa","lexical-analysis","lexical-analyzer","programming-languages","theory-of-programming-languages"],"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/missipsag.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-11-29T10:59:36.000Z","updated_at":"2024-12-21T10:08:50.000Z","dependencies_parsed_at":"2024-11-29T12:22:13.832Z","dependency_job_id":"4aa8790b-d16d-433d-89c1-874f4b513734","html_url":"https://github.com/missipsag/LexiC-analyser","commit_stats":null,"previous_names":["missipsag/lexic-analyser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/missipsag/LexiC-analyser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missipsag%2FLexiC-analyser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missipsag%2FLexiC-analyser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missipsag%2FLexiC-analyser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missipsag%2FLexiC-analyser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/missipsag","download_url":"https://codeload.github.com/missipsag/LexiC-analyser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missipsag%2FLexiC-analyser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["automaton","c","c-programming","compilation","dfa","lexical-analysis","lexical-analyzer","programming-languages","theory-of-programming-languages"],"created_at":"2025-02-03T09:54:53.395Z","updated_at":"2026-01-30T14:39:13.700Z","avatar_url":"https://github.com/missipsag.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lexical Analyzer in C\n\n## Overview  \nThis project is a **Lexical Analyzer 'Scanner'** implemented in C, designed to tokenize a simple programming language. The lexical analyzer takes a source code string as input and breaks it down into meaningful tokens such as keywords, identifiers, numbers, operators, and punctuation marks. It uses a **Deterministic Finite Automaton 'DFA'** to classify and process tokens effectively.\n\n ![**Deterministic Finite Automaton 'DFA'**](automaton.png).\n\n## Features  \n- **Token Classification**: Identifies various tokens like `IF`, `ID`, `NUM`, `OP`, and more.  \n- **Attribute Extraction**: Extracts attributes such as numeric values and operator types.  \n- **Error Handling**: Provides detailed error messages with character positions for invalid input.  \n- **Dynamic Memory Allocation**: Efficiently manages memory for identifiers and other dynamic content.  \n- **Modular Design**: Includes reusable components like:\n  - `car_suivant` for character reading.\n  - `get_lexeme` for lexeme extraction.\n  - `reculer` for backtracking positions.\n\n## Getting Started  \n\n### Prerequisites  \n- A C compiler 'e.g., `gcc`'.  \n- Basic understanding of the C programming language and lexical analysis.\n\n### Compilation  \n1. Clone this repository:  \n   ```bash\n   git clone https://github.com/your-username/lexical-analyzer-c.git\n   cd lexical-analyzer-c\n\n2. Compile the program: \n    ```bash \n    gcc car_suivant.c erreur_lexicale.c get_lexeme.c reculer.c token_suivant.c main.c -o lexical_analyzer\n\n### Usage \n1. Run the compiled program\n    ```bash\n    ./lexical_analyzer\n\n2. Enter a source code string when prompted. For example: \n    ```scss \n    if (x = 42) x = y+5+max;\n\n3. The output will display a sequence of tokens and their attributes, like: \n    ```bash \n    \u003cIF, \u003e\n    \u003cPARG, \u003e\n    \u003cID, x\u003e\n    \u003cASSIGN, \u003e\n    \u003cNUM, 42\u003e\n    \u003cPARD, \u003e\n    \u003cID, x\u003e\n    \u003cASSIGN, \u003e\n    \u003cID, y\u003e\n    \u003cOP, PLUS\u003e\n    \u003cNUM, 5\u003e\n    \u003cOP, PLUS\u003e\n    \u003cID, max\u003e\n    \u003cPV, \u003e\n    \u003cFIN, \u003e\n\n### Project Structure \n   \n    lexical-analyzer-c/\n    \n    ├── main.c                # Main driver program\n    ├── include.c             # Header and utility functions\n    ├── README.md             # Project documentation\n    ├── Other utility fonctions # tocken_suivant, car_suivant, reculer,get_lexeme...\n    \n\n### Fonctionality \n#### Token Types \n    * FIN: End of program.\n    * PV: Semicolon ';'.\n    * IF: Keyword if.\n    * ASSIGN: Assignment operator '='.\n    * OP: Operators '+, -'.\n    * PARG: Opening parenthesis '('.\n    * PARD: Closing parenthesis ')'.\n    * ID: Identifier 'e.g., variable names'.\n    * NUM: Numbers (e.g., 42)\n\n### Error handling \nWhen an invalid character is encountered, the program outputs an error message indicating the position and the problematic character. For example:\n    ``` \n        \n    position 4: le caractère ’*’ est illégal! \n   \n    \n\n### Contributing\nContributions are welcome! If you’d like to improve this project, feel free to fork the repository and submit a pull request.\n\n### License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n### Acknowledgments\nThis project serves as a learning tool for understanding lexical analysis and compiler construction.\nInspired by classic DFA-based tokenization techniques.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissipsag%2Flexic-analyser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmissipsag%2Flexic-analyser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissipsag%2Flexic-analyser/lists"}