A simple PDA simulator for a^n b^n
Project description
أكيد! إليك نموذج README.md احترافي وجاهز للرفع على GitHub، مناسب تمامًا لهكيل مشروعك كما هو ظاهر في الصورة:
# PDA aⁿbⁿ Simulator
This Python package simulates a Pushdown Automaton (PDA) for the context-free language aⁿbⁿ, where n ≥ 0.
## 📦 Project Structure
PDA/ ├── src/ │ └── pda_anbn/ │ ├── init.py │ └── core.py ├── tests/ │ └── test_core.py ├── test package.py ├── pyproject.toml └── README.md
- **src/pda_anbn/__init__.py**: Contains the PDA simulation logic for aⁿbⁿ.
- **tests/test_core.py**: Unit tests for the PDA function.
- **test package.py**: Quick script to test the PDA with sample strings.
---
## 🚀 Usage
### Import and Use in Your Code
from src.pda_anbn import is_anbn
test_cases = ["ab", "aabb", "aaabbb", "aabbb", "abb", "aaaabbbb", "aab", "bbaa", ""]
for s in test_cases: print(f"String: '{s}' -> {'ACCEPTED' if is_anbn(s) else 'REJECTED'}")
### Example Output
String: 'ab' -> ACCEPTED String: 'aabb' -> ACCEPTED String: 'aaabbb' -> ACCEPTED String: 'aabbb' -> REJECTED String: 'abb' -> REJECTED String: 'aaaabbbb' -> ACCEPTED String: 'aab' -> REJECTED String: 'bbaa' -> REJECTED String: '' -> ACCEPTED
---
## 🧪 Running Tests
You can run the unit tests using [pytest](https://pytest.org):
pip install pytest pytest tests/
---
## 📄 License
This project is licensed under the MIT License.
---
## 🌟 Notes
- The PDA accepts strings of the form aⁿbⁿ, where n ≥ 0 (including the empty string).
- To change acceptance criteria (e.g., n ≥ 1), adjust the logic in `__init__.py`.
---
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ahmedelsany12_pda-1.1.3.tar.gz.
File metadata
- Download URL: ahmedelsany12_pda-1.1.3.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dcf8723e3d84bcbc8153c271082d858fbfdbf5b6d61777d197a66e96d46c4f1
|
|
| MD5 |
a64de5b51cee144bd8aaca59808580b5
|
|
| BLAKE2b-256 |
c8f5503049edf4413d23c078522dbb9f1baaa0fba65d96329cfe9d2e952d6362
|
File details
Details for the file ahmedelsany12_pda-1.1.3-py3-none-any.whl.
File metadata
- Download URL: ahmedelsany12_pda-1.1.3-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566665ffd50da82d6dd684d5afd1c71575ac3729017fdd36f47fbbd9b5e8e7bd
|
|
| MD5 |
195ef6927ee8dcfe5439a0812f9065f1
|
|
| BLAKE2b-256 |
4e55c5b2ff097504feb485d90323e357320508bf135b205bf9e5bd32f0caee3a
|