{"id":28958727,"url":"https://github.com/shaina-gh/dfa-construction","last_synced_at":"2025-06-23T23:06:40.030Z","repository":{"id":294376730,"uuid":"986765432","full_name":"shaina-gh/dfa-construction","owner":"shaina-gh","description":"A C++ implementation to simulate a DFA for the regular expression (a|b)*abb+","archived":false,"fork":false,"pushed_at":"2025-05-20T05:20:20.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T06:26:25.168Z","etag":null,"topics":["compiler-design","cpp","dfa-construction"],"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/shaina-gh.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,"zenodo":null}},"created_at":"2025-05-20T05:12:49.000Z","updated_at":"2025-05-20T05:25:00.000Z","dependencies_parsed_at":"2025-05-20T06:26:35.423Z","dependency_job_id":"d705552b-5590-46ad-bcc7-b9e58693eae3","html_url":"https://github.com/shaina-gh/dfa-construction","commit_stats":null,"previous_names":["shaina-gh/dfa-construction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shaina-gh/dfa-construction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaina-gh%2Fdfa-construction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaina-gh%2Fdfa-construction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaina-gh%2Fdfa-construction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaina-gh%2Fdfa-construction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaina-gh","download_url":"https://codeload.github.com/shaina-gh/dfa-construction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaina-gh%2Fdfa-construction/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261571512,"owners_count":23178768,"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":["compiler-design","cpp","dfa-construction"],"created_at":"2025-06-23T23:06:36.302Z","updated_at":"2025-06-23T23:06:40.018Z","avatar_url":"https://github.com/shaina-gh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚦 DFA Construction \n\nThis project demonstrates the construction and simulation of a **Deterministic Finite Automaton (DFA)** to recognise strings that match a specific regular expression. The implementation is done in **C++**.\n\n---\n\n## 📘 Definition\n\nA **Deterministic Finite Automaton (DFA)** is a theoretical model of computation used to determine whether a given string belongs to a particular regular language. A DFA consists of:\n\n- A finite set of **states**\n- An **input alphabet**\n- A **transition function**\n- A **start state**\n- A set of **accepting (final) states**\n\nIn this experiment, the DFA is constructed to accept the language defined by the **regular expression**:\n```yaml\n(a|b)*abb+\n```\n\nThis expression denotes all strings over `{a, b}` that end in one or more `b`s and are preceded by the substring `\"ab\"`.\n\n---\n\n## 🔁 Logic \u0026 DFA Core\n\nThe DFA transitions are modelled using a 2D vector `re` where each row represents a state, and the columns represent the transition on `'a'` and `'b'` respectively.\n\n### DFA Transition Table\n\n| State | On 'a' | On 'b' |\n|-------|--------|--------|\n|  0    |   1    |   0    |\n|  1    |   1    |   2    |\n|  2    |   1    |   3    |\n|  3    |   1    |   3    |\n\n- **Start State**: 0  \n- **Final State**: 3  \n- **Accepted Language**: All strings containing a substring ending in `\"abb\"` followed by one or more `b`s.\n\n---\n\n## 🧪 Sample Input/Output\n\nExample 1\n```yaml\nInput: aabb\n\nOutput: Accepted\n```\n\nExample 2\n```yaml\nInput: abababbb\n\nOutput: Accepted\n```\n\nExample 3\n```yaml\nInput: aba\n\nOutput: Rejected\n```\n\n---\n\n## 🌍 Real-World Applications\n\n- Lexical Analysis: Tokenising source code in compilers.\n- Network Security: Pattern matching in intrusion detection systems.\n- Text Editors: Implementing search and syntax highlighting.\n- Natural Language Processing: Recognising grammars in structured text.\n- Embedded Systems: Modelling finite state behaviour in devices.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaina-gh%2Fdfa-construction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaina-gh%2Fdfa-construction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaina-gh%2Fdfa-construction/lists"}