Skip to main content

A package for the PHG modeling language and 3D visualization tool.

Project description

__init__.py

from phg import VisPHG

Installation

You can install the package using pip:

pip install phg

Overview

PHG - A Minimalist Programming Language for Describing Structures

PHG (Programming HyperGraph) is a minimalist programming language inspired by the structure of bacteriophages. It combines concepts from group theory to provide custom overloading of variables and operations, making it uniquely suited for describing complex node structures such as 3D scenes and 2D sprites.

Features

  • Node Definition: Easily define nodes and their properties.
  • Array and Sequence Support: Utilize both arrays and sequences for managing data.
  • Control Statements: Implement conditional and looping logic.
  • Function Definitions: Create custom functions for reusable code.
  • Tree Structure: Describe hierarchical data structures effectively.
  • API Integration: Access built-in functions for mathematical operations, drawing, and data manipulation.

Basic Syntax

Node Definition

{	
    a { 
        p: 1, 0, 0; 
        b { p: 2, 0, 0 }
        <a, a, a>
        [a, a, a]           
    }
}

Control Statements

?(condition) { statement } : { else statement };
@n { statement1 ? (_i = x) ~; statement2; }

Function Definition

$functionName(args...) { statement $return }

Sequences and Arrays

  • Sequence: <a, b, c, d> corresponds to {a {b {c {d}}}}
  • Array: [a, b, c, d] corresponds to {{a}{b}{c}{d}}

Example

node1 { 
    pos: 1, 2, 3; 
    node2 { x: 1; node3 { y: 1 } } 
}

Built-in Functions

  • Math Functions: rnd(), sin(), cos()
  • Node Operations: im(), on(), wak(), dump()
  • Data Conversion: tojson()

Installation

You can install PHG via PyPI:

pip install phg

Usage

To use PHG, simply import the module in your Python project:

import phg

# Define your PHG code as a string
phg_code = """
{
    a {
        p: 1, 0, 0;
        b { p: 2, 0, 0 }
    }
}
"""

# Execute the PHG code
phg.run(phg_code)

Documentation

For more detailed information on syntax, functions, and examples, please refer to the official documentation.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is licensed under the MIT License.

Acknowledgements

PHG is inspired by concepts from group theory and aims to provide a flexible way to describe complex data structures in programming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phg_vis-1.1.4.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phg_vis-1.1.4-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file phg_vis-1.1.4.tar.gz.

File metadata

  • Download URL: phg_vis-1.1.4.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for phg_vis-1.1.4.tar.gz
Algorithm Hash digest
SHA256 0006f9ea5ff0e02038da4f4cec70512b9cdd61a41b0ea439292d56a6f8dcfde2
MD5 6c5e8bf707be7173dcd3b205e463c19f
BLAKE2b-256 9cae53256c78e7740469c941cad8bcbe3db8c2d2db97e5cd3f26d39b119beca8

See more details on using hashes here.

File details

Details for the file phg_vis-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: phg_vis-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for phg_vis-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dce3bd805ebffa9744f0176054496ddc83cb1b079abc4af23bcdc18a57704c0e
MD5 e9eae564308a1b39e1405a72a3fd4084
BLAKE2b-256 542079d8993baf845948abc56ff7c1fbd1c64163c1d5c08c4c4fb41fa1816222

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page