{"id":20714073,"url":"https://github.com/youssef-remah/regex-to-dfa-converter","last_synced_at":"2026-05-25T23:36:54.702Z","repository":{"id":173761446,"uuid":"650565668","full_name":"Youssef-Remah/REGEX-To-DFA-Converter","owner":"Youssef-Remah","description":"Regular Expression to Deterministic Finite Automaton Converter.","archived":false,"fork":false,"pushed_at":"2025-01-02T09:37:19.000Z","size":37818,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T14:46:19.583Z","etag":null,"topics":["abstract-syntax-tree","cplusplus","depth-first-search","deterministic-finite-automata","regular-expressions","subset-construction","theory-of-computation"],"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/Youssef-Remah.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":"2023-06-07T10:39:56.000Z","updated_at":"2025-01-02T09:37:25.000Z","dependencies_parsed_at":"2025-01-17T21:51:04.845Z","dependency_job_id":null,"html_url":"https://github.com/Youssef-Remah/REGEX-To-DFA-Converter","commit_stats":null,"previous_names":["youssef-remah/regex-to-dfa-converter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Youssef-Remah/REGEX-To-DFA-Converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Youssef-Remah%2FREGEX-To-DFA-Converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Youssef-Remah%2FREGEX-To-DFA-Converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Youssef-Remah%2FREGEX-To-DFA-Converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Youssef-Remah%2FREGEX-To-DFA-Converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Youssef-Remah","download_url":"https://codeload.github.com/Youssef-Remah/REGEX-To-DFA-Converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Youssef-Remah%2FREGEX-To-DFA-Converter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33497929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T14:31:05.219Z","status":"ssl_error","status_checked_at":"2026-05-25T14:31:02.878Z","response_time":57,"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":["abstract-syntax-tree","cplusplus","depth-first-search","deterministic-finite-automata","regular-expressions","subset-construction","theory-of-computation"],"created_at":"2024-11-17T02:29:05.257Z","updated_at":"2026-05-25T23:36:54.638Z","avatar_url":"https://github.com/Youssef-Remah.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Regular Expression to DFA Converter\n\n## Objective\nThe objective of this project is to implement a **REGEX** to **DFA** converter using an **Abstract Syntax Tree** (AST) instead of the traditional approach of converting the REGEX to a Non-deterministic Finite Automaton (NFA) and then converting the NFA to a DFA.\n\n## Description\n### 1. What does this program do?\nThis program converts a Regular Expression (REGEX) into a Deterministic Finite Automaton (DFA).\n\n### 2. Technologies Used\nThis console application is developed using the C++ programming language. C++ is chosen as the primary language for this program due to its ability to effectively handle tree data structures, making it the ideal choice for utilizing the power of C++ pointers.\n\n### 3. Approach\n### 3.1. Conversion without creating an NFA\n\nInstead of creating an NFA as an intermediate step, we directly convert the REGEX to a DFA using the following steps:\n\n1. **Augmented REGEX:** Firstly, the regular expression is converted into an augmented regular expression by concatenating it with a '#' symbol. (r -\u003e (r)#)\n\n2. **Postfix Expression:** Next, the augmented REGEX is converted into a postfix expression.\n\n3. **Syntax Tree Construction:** We construct a syntax tree for the postfix expression.\n\n4. **Tree Traversal:** The tree is traversed to construct four essential functions: _**nullable**_, _**firstpos**_, _**lastpos**_, and _**followpos**_.\n\n5. **Follow Position Table:** We construct the follow position table.\n\n6. **DFA Construction:** Finally, we convert the REGEX directly to a DFA by constructing a new table using the follow position table and employing an approach similar to the **subset construction** algorithm.\n\n### 4. Program Input\n\nThe program expects the following inputs:\n\n- **Number of test cases:** The user enters the number of test cases.\n- **Regular Expression:** For each test case, the user enters a regular expression (e.g., (a|b)*).\n- **Input Strings:** For each test case, the user enters a string to check whether it is accepted or rejected by the DFA.\n\n### 5. Program Output\n\nThe program produces the following output:\n\n- **DFA Table:** The program displays a simple representation of the DFA table, including its states and transitions, to the console.\n- **Test Case Status:** For each test case, the program displays its status, indicating whether it is accepted or rejected by the DFA.\n\n\n## Team Collaboration and Contributions\n\n\nI am glad to have partnered with **[Mazen Abdalla](https://github.com/MazenMohamedAbdalla)** on this project. I appreciate his hard work and dedication to the project's goals.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoussef-remah%2Fregex-to-dfa-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoussef-remah%2Fregex-to-dfa-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoussef-remah%2Fregex-to-dfa-converter/lists"}