Metadata-Version: 2.4
Name: flowo
Version: 0.1.0
Summary: A Pythonic DSL and XML builder for Flowgorithm (.fprg) programs.
Author: yuvlian
License: MIT
Keywords: flowgorithm,fgrs,xml,dsl,visual-programming
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# flowo

A Pythonic DSL and XML builder for [Flowgorithm](http://www.flowgorithm.org/) (`.fprg`) programs. 

Ported and redesigned from the Rust crate `fgrs`, **flowo** allows you to generate complex Flowgorithm programs using modern Python syntax, including context managers for control flow and strict variable validation.

## Features

- **Context Manager API**: Natural Pythonic syntax for nested structures (`with flow.if_():`, `with flow.for_():`).
- **Strict Validation**: Prevents invalid Flowgorithm variable names (no snake_case, no leading numbers) and reserved keyword usage.
- **Variable Tracking**: Ensures variables are declared before use.
- **Intrinsic Functions**: Helper functions for all Flowgorithm built-ins (`Abs`, `Sin`, `Len`, `ToInteger`, etc.).
- **Zero Dependencies**: Built entirely on the Python Standard Library.

## Installation

```bash
pip install flowo
```

## Quick Start

```python
from flowo import Flow, Type

flow = Flow("HelloWorld.fprg")

with flow.function("Main"):
    flow.declare("name", Type.STRING)
    flow.output('"What is your name?"')
    flow.input("name")
    flow.output('"Hello, " & name')

flow.to_fprg()
```

## Advanced Usage

**flowo** supports all Flowgorithm features including arrays, multi-argument declarations, and nested loops:

```python
from flowo import Flow, Type, Sin, PI

flow = Flow()
with flow.function("Main"):
    flow.declare("i, n", Type.INTEGER)
    flow.declare("val", Type.REAL)
    
    flow.assign("n", "10")
    with flow.for_("i", "0", "n - 1"):
        flow.assign("val", Sin(f"(i / n) * 2 * {PI}"))
        flow.output("val")

flow.to_fprg("SineWave.fprg")
```

## Reserved Keywords

Flowgorithm has strict rules for identifiers. **flowo** automatically validates your variable names against these rules:
- No symbols or underscores (no `snake_case`).
- Cannot start with a number.
- Cannot be a reserved word (e.g., `and`, `or`, `pi`, `integer`, `real`).
- Cannot be an intrinsic function name (e.g., `abs`, `cos`, `len`).

## License

MIT
