Metadata-Version: 2.4
Name: moldo
Version: 0.1.1
Summary: A visual programming language that compiles to Python
Home-page: https://github.com/GracePeterMutiibwa/moldo
Author: Mutiibwa Grace Peter
Author-email: gracepetermutiibwa@gmail.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Compilers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: antlr4-python3-runtime>=4.13.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Moldo

A visual programming language that compiles to Python, designed to make programming more accessible and intuitive.

## Features

- XML-like syntax for easy visual representation
- Compiles to Python code
- Support for Python function imports
- Basic programming constructs (variables, functions, control flow)
- Type safety and error handling

## Installation

```bash
pip install moldo
```

## Quick Start

1. Create a `.moldo` file with your code:

```xml
<mblock type="print">Hello, World!</mblock>

<mblock type="input">What's your name? </mblock>
<mblock type="variable">name = input()</mblock>
<mblock type="print">f"Nice to meet you, {name}!"</mblock>
```

2. Compile and run:

```bash
moldo compile your_file.moldo -o output.py
python output.py
```

## Examples

### Calculator Example

```xml
<!-- Import the math functions module -->
<mblock type="import">examples/math_functions.py</mblock>

<!-- Get input from user -->
<mblock type="input">Enter first number: </mblock>
<mblock type="variable">num1 = float(input())</mblock>

<mblock type="input">Enter second number: </mblock>
<mblock type="variable">num2 = float(input())</mblock>

<!-- Perform calculations -->
<mblock type="print">Addition: </mblock>
<mblock type="call">add(num1, num2)</mblock>

<mblock type="print">Subtraction: </mblock>
<mblock type="call">subtract(num1, num2)</mblock>

<mblock type="print">Multiplication: </mblock>
<mblock type="call">multiply(num1, num2)</mblock>

<mblock type="print">Division: </mblock>
<mblock type="call">divide(num1, num2)</mblock>
```

### Temperature Converter Example

```xml
<mblock type="import">examples/temperature_utils.py</mblock>

<mblock type="print">Welcome to Temperature Converter!</mblock>
<mblock type="print">1. Convert Celsius to Fahrenheit</mblock>
<mblock type="print">2. Convert Fahrenheit to Celsius</mblock>

<mblock type="input">Enter your choice (1 or 2): </mblock>
<mblock type="variable">choice = input()</mblock>

<mblock type="variable">
if choice == "1":
    print("Enter temperature in Celsius: ", end="")
    celsius = float(input())
    print(f"{celsius}°C is equal to ", end="")
    result = temperature_utils.celsius_to_fahrenheit(celsius)
    print(f"{result:.1f}°F")
elif choice == "2":
    print("Enter temperature in Fahrenheit: ", end="")
    fahrenheit = float(input())
    print(f"{fahrenheit}°F is equal to ", end="")
    result = temperature_utils.fahrenheit_to_celsius(fahrenheit)
    print(f"{result:.1f}°C")
else:
    print("Invalid choice! Please enter 1 or 2.")
</mblock>
```

## Creating Custom Functions

To create functions that can be used in Moldo, use the `@moldo_function` decorator:

```python
from moldo.decorators import moldo_function

@moldo_function(reference_name="add")
def add_numbers(a: float, b: float) -> float:
    """Add two numbers together."""
    return a + b
```

## Command Line Interface

The `moldo` command provides several options:

```bash
moldo compile <input_file> -o <output_file>  # Compile Moldo code to Python
moldo run <input_file>                       # Compile and run Moldo code
moldo --help                                 # Show help message
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Author

- **Mutiibwa Grace Peter** - [GitHub](https://github.com/GracePeterMutiibwa)

## Acknowledgments

- ANTLR4 for the parsing infrastructure
- Python community for inspiration and tools 
