https://github.com/basemax/mealymachines
This repository contains a collection of Mealy machine implementations in PHP for performing various arithmetic operations.
https://github.com/basemax/mealymachines
mealy mealy-machine mealy-machine-code mealy-machine-php mealy-machines mealy-php php php-mealy php-mealy-machine
Last synced: 2 months ago
JSON representation
This repository contains a collection of Mealy machine implementations in PHP for performing various arithmetic operations.
- Host: GitHub
- URL: https://github.com/basemax/mealymachines
- Owner: BaseMax
- License: gpl-3.0
- Created: 2023-01-31T16:55:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-14T05:53:37.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T17:08:07.421Z (3 months ago)
- Topics: mealy, mealy-machine, mealy-machine-code, mealy-machine-php, mealy-machines, mealy-php, php, php-mealy, php-mealy-machine
- Language: PHP
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mealy Machines
This repository contains a collection of Mealy machine implementations in PHP for performing various arithmetic operations.
## Contents
- `mealy_sum.php`: A Mealy machine implementation for adding multiple base-10 numbers separated by a plus operator.
- `mealy_minus.php`: A Mealy machine implementation for subtracting multiple base-10 numbers separated by a minus operator.
- `mealy_binary_sum.php`: A Mealy machine implementation for adding two binary numbers.
- `mealy_binary_minus.php`: A Mealy machine implementation for subtracting two binary numbers.## Usage
Each Mealy machine implementation can be used by calling the corresponding function and passing in the inputs as a string. The function will return the result of the arithmetic operation as a string or integer, depending on the specific implementation.
For example, to use the mealy_sum implementation:
```php
$inputs = "11+22+33";
echo mealy_sum($inputs) . PHP_EOL; // 66
```To use the mealy_minus implementation:
```php
$inputs = "100-50-25";
echo mealy_minus($inputs) . PHP_EOL; // 25
```To use the mealy_binary_sum implementation:
```php
$inputs = "1110 + 1011";
echo mealy_binary_sum($inputs) . PHP_EOL; // 1001
```To use the mealy_binary_minus implementation:
```php
$inputs = "1110 - 1011";
echo mealy_binary_minus($inputs) . PHP_EOL; // 0011
```## Contributing
If you'd like to contribute to this repository, feel free to submit a pull request with your changes. Please make sure to follow the existing code style and document any new functionality clearly in the code and in the README.
## License
This project is licensed under the GPL-v3.0 License.
Copyright 2023, Max Base