https://github.com/benevolencemessiah/moon

https://github.com/benevolencemessiah/moon

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: BenevolenceMessiah
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 6.56 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Moon Programming Language 🌙

Table of Contents

Introduction

Welcome to Moon, the programming language designed to illuminate the path between simplicity and performance. Inspired by Python's readability and Mojo's high-performance capabilities, Moon seamlessly integrates these strengths while introducing a unique cultural aesthetic rooted in Islamic symbolism. Whether you're developing AI models, engaging in scientific computing, or creating general-purpose applications, Moon offers a harmonious blend of ease-of-use and computational power.

Why Moon?

  • Python-like Simplicity: Enjoy Python’s developer-friendly syntax without compromising on performance.
  • High Performance: Engineered for computation-heavy tasks with features inspired by low-level languages.
  • Cultural Integration: Embrace a programming experience enriched with Islamic symbols and phrases, fostering a sense of community and cultural pride.
  • Interoperability: Effortlessly integrate with other programming languages, repositories, and dependencies, making Moon the ultimate connecting language.
  • AI Optimization: Tailored for AI and emerging fields, Moon is your go-to language for cutting-edge technological advancements.

Features

  • Multi-Paradigm Support: Procedural, Object-Oriented, and Functional programming paradigms.
  • Unicode and Cultural Symbols: Incorporate Islamic symbols and phrases directly into your code.
  • Seamless Interoperability: Mix and match resources from different programming languages and ecosystems.
  • High-Performance Computing: Optimized for leveraging multi-core processors and hardware accelerators like GPUs and TPUs.
  • Compiled Execution: Translates code into machine-level instructions for faster execution.
  • Strong Typing and Memory Control: Enhanced type system and memory management for performance gains.
  • Standard Library: Comprehensive built-in modules for I/O, math, AI, and more.
  • AI Integration: Immediate compatibility with AI models, including GGUF models through llama.cpp.
  • Developer Tools: Includes an IDE, debugger, linter, and package manager for a streamlined development experience.

Special Syntaxes

Moon incorporates a variety of Islamic symbols and phrases to enhance the cultural experience of programming. Each special syntax has an English alternative to ensure accessibility and flexibility.

mermaid graph TD; A[Symbol/Phrase] --> B[Unicode] --> C[Meaning] --> D[Usage in Moon] --> E[English Alternative] A1[﷽] --> B1[U+FDFD] --> C1["In the name of Allah, the Most Gracious, the Most Merciful"] --> D1[Entry point (def main():)] --> E1[def main()] A2[☪] --> B2[U+262A] --> C2[Star and Crescent] --> D2[Decorator symbol (@decorator)] --> E2[@decorator] A3[☭] --> B3[U+262D] --> C3[Hammer and Sickle] --> D3[Synchronization primitive (synchronize)] --> E3[synchronize] A4[۩] --> B4[U+06E9] --> C4[Place of Sajdah] --> D4[Block closure (end)] --> E4[end] A5[لَا إِلَٰهَ إِلَّا ٱللَّٰهُ] --> B5[-] --> C5["There is no god but Allah"] --> D5[Boolean true] --> E5[true] A6[♡] --> B6[U+2661] --> C6[White Heart] --> D6[Equality operator (==) or like] --> E6[== or like] A7[۝] --> B7[U+06DD] --> C7[End of Ayah] --> D7[Statement terminator (;)] --> E7[; or newline] A8[ٱلسَّلَامُ عَلَيْكُمْ] --> B8[-] --> C8["Peace be upon you"] --> D8[Greeting (hello_world)] --> E8[hello_world] A9[🕌] --> B9[U+1F54C] --> C9[Mosque] --> D9[Module declaration (module)] --> E9[module] A10[🕋] --> B10[U+1F54B] --> C10[Kaaba] --> D10[Core library import (import core)] --> E10[import core] A11[📿] --> B11[U+1F4FF] --> C11[Prayer Beads] --> D11[Loop iterator (for)] --> E11[for loop] A12[🌙] --> B12[U+1F319] --> C12[Crescent Moon] --> D12[Import Moon libraries (import_moon or moon)] --> E12[import moon]

Example Syntax with English Alternatives

```moon ﷽: # Entry point (Alternative: def main():) print("ٱلسَّلَامُ عَلَيْكُمْ") # Outputs "Peace be upon you" print("Hello, World! ☪") # Decorator symbol

Alternative entry point using English

def main(): print("Assalamu Alaikum") print("Hello, World! @decorator") ```

Project Structure

A well-organized project structure is crucial for managing the complexity of developing a new programming language. Below is the proposed directory layout for the Moon programming language project.

bash Moon/ ├── docs/ │ ├── language_specification.md │ └── user_manual.md ├── examples/ │ ├── hello_world.🌙 │ ├── islamic_calendar.🌙 │ ├── ai_example.🌙 │ └── other_examples.🌙 ├── src/ │ ├── python_prototype/ │ │ ├── lexer.py │ │ ├── parser.py │ │ ├── compiler.py │ │ ├── vm.py │ │ ├── interop.py │ │ └── main.py │ ├── rust_implementation/ │ │ ├── lexer.rs │ │ ├── parser.rs │ │ ├── compiler.rs │ │ ├── vm.rs │ │ ├── optimizer.rs │ │ ├── runtime_environment.rs │ │ ├── error_handling.rs │ │ ├── concurrency_model.rs │ │ └── main.rs │ ├── standard_library/ │ │ ├── ai.moon │ │ ├── datetime.moon │ │ ├── io.moon │ │ ├── math.moon │ │ └── string.moon │ └── runtime.moon ├── tests/ │ ├── python_prototype_tests/ │ │ ├── lexer_tests.py │ │ ├── parser_tests.py │ │ ├── compiler_tests.py │ │ └── vm_tests.py │ ├── rust_implementation_tests/ │ │ ├── lexer_tests.rs │ │ ├── parser_tests.rs │ │ ├── compiler_tests.rs │ │ └── vm_tests.rs │ └── standard_library_tests/ │ ├── ai_tests.moon │ ├── datetime_tests.moon │ ├── io_tests.moon │ ├── math_tests.moon │ └── string_tests.moon ├── tools/ │ ├── ide/ │ │ └── lunar_eclipse.exe │ ├── debugger/ │ │ └── moon_debugger.exe │ ├── linter/ │ │ └── moon_linter.exe │ └── package_manager/ │ └── crescent.exe ├── .gitignore └── README.md

Directory Breakdown

  • docs/: Contains comprehensive documentation, including the language specification and user manuals.
  • examples/: Houses example Moon scripts demonstrating various features and use cases.
  • src/:
    • python_prototype/: Initial prototypes of the lexer, parser, compiler, and virtual machine implemented in Python for rapid development and testing.
    • rust_implementation/: Placeholder for the eventual Rust-based implementation, ensuring high performance and safety.
    • standard_library/: Built-in Moon modules providing essential functionalities like AI, math, I/O, and more.
    • runtime.moon: Core runtime functionalities and configurations.
  • tests/:
    • pythonprototypetests/: Unit and integration tests for the Python prototype components.
    • rustimplementationtests/: Tests for the Rust-based components as they are developed.
  • standardlibrarytests/: Ensures the standard library modules function correctly.
  • tools/: Contains executables for essential development tools like the IDE, debugger, linter, and package manager.
  • .gitignore: Specifies files and directories to be ignored by Git.
  • README.md: This comprehensive guide to the Moon programming language.

Installation

Prerequisites

  • Python 3.8+: Required for the Python prototype.
  • Rust 1.50+: Necessary for the Rust-based implementation.
  • llama.cpp: For AI model integration.
  • C++ Compiler: To compile llama.cpp and other C++ dependencies.

Steps

  • Clone the Repository

bash git clone https://github.com/yourusername/moon.git cd moon

Set Up Python Prototype

  • Navigate to the Python prototype directory and install necessary dependencies.

bash cd src/python_prototype pip install -r requirements.txt

Set Up Rust Environment

Ensure Rust is installed. If not, install it via rustup.

bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Compile Tools

Navigate to the tools/ directory and compile the necessary tools.

bash cd ../../tools/ide

Follow specific instructions for building the IDE

Note: Detailed build instructions will be provided as development progresses.

Usage

Hello World Example

Create a file named hello_world.🌙 in the examples/ directory.

```moon ﷽: # Entry point (Alternative: def main():) print("ٱلسَّلَامُ عَلَيْكُمْ") # Outputs "Peace be upon you" print("Hello, World! ☪") # Decorator symbol

Alternative entry point using English

def main(): print("Assalamu Alaikum") print("Hello, World! @decorator") ```

Running the Example

Navigate to the Python prototype directory and execute the main.py script.

bash cd src/python_prototype python main.py

Expected Output:

bash 8

moon Peace be upon you Hello, World! ☪ Assalamu Alaikum Hello, World! @decorator

Standard Library

Moon's standard library provides a range of built-in modules to facilitate various programming tasks. Below are some examples:

math.moon

```moon

math.moon

def add(x: float, y: float) -> float ۝ return x + y ۝

def subtract(x: float, y: float) -> float ۝ return x - y ۝

def multiply(x: float, y: float) -> float ۝ return x * y ۝

def divide(x: float, y: float) -> float ۝ if y != 0 ۩ return x / y ۝ else ۩ print("Error: Division by zero") ۝ return 0 ۝ ```

io.moon

```moon

io.moon

def readfile(filepath: str) -> str ۝ with open(file_path, 'r') as file ۩ content = file.read() ۝ return content ۝

def writefile(filepath: str, content: str) ۝ with open(file_path, 'w') as file ۩ file.write(content) ۝ print("File written successfully") ۝

def print(message: str) ۝ # Interop call to Python's print function moon.interop.print(message) ۝ ```

ai.moon

```moon

ai.moon

import moon.interop

from moon.interop import llamacppwrapper

def loadmodel(modelpath: str): return llamacppwrapper.loadmodel(modelpath) ۝

def generatetext(model, prompt: str) -> str: return llamacpp_wrapper.generate(model, prompt) ۝

def fine_tune(model, data): # Placeholder for fine-tuning functionality pass ۝ ```

AI Integration

Moon is optimized for AI and high-performance computing tasks. By leveraging Python's existing bindings and integrating with powerful libraries like llama.cpp, Moon provides seamless AI model handling.

Integrating GGUF Models with llama.cpp

Steps:

  • Develop Python Bindings for llama.cpp

  • Create a Python module that wraps llama.cpp functionalities.

```python

llamacppwrapper.py

import llama_cpp # Hypothetical Python package for llama.cpp

def loadmodel(modelpath): return llamacpp.loadmodel(model_path)

def generate(model, prompt): return model.generate(prompt) ```

  • Create Moon's Interop Module

  • Enable Moon to interact with Python modules.

```moon

interop.py

import sys import importlib

def importpythonmodule(modulename: str): return importlib.importmodule(module_name)

Import the Python wrapper for llama.cpp

llamacppwrapper = importpythonmodule('llamacppwrapper') ```

Develop AI Module in Moon

Provide high-level AI functionalities.

```moon

ai.moon

import moon.interop

from moon.interop import llamacppwrapper

def loadmodel(modelpath: str): return llamacppwrapper.loadmodel(modelpath) ۝

def generatetext(model, prompt: str) -> str: return llamacpp_wrapper.generate(model, prompt) ۝

def fine_tune(model, data): # Placeholder for fine-tuning functionality pass ۝ ```

Sample AI Integration Script

```moon

ai_example.🌙

﷽: from ai import loadmodel, generatetext

# Load the GGUF model
model = load_model("models/gguf_model.gguf") ۝

# Generate text using the AI model
prompt = "In the name of Allah, the Most Gracious, the Most Merciful." ۝
response = generate_text(model, prompt) ۝

# Print the generated text
print(response) ۝

```

Benefits

  • Immediate AI Capability: Utilize Python's mature AI libraries to enable AI functionalities in Moon from the outset.
  • Seamless Interoperability: Mix Moon's Python-like syntax with powerful AI tools, enhancing developer productivity.
  • Future Scalability: Transition to Rust-based AI bindings for improved performance as Moon's core matures.

Contributing

  • Moon is an open-source project that thrives on community collaboration. Whether you're a seasoned developer or a newcomer passionate about programming languages and AI, your contributions are welcome!

How to Contribute

Fork the Repository

  1. Click the "Fork" button at the top-right corner of the repository page to create your own fork.

  2. Clone Your Fork

bash git clone https://github.com/yourusername/moon.git cd moon

  1. Create a New Branch

bash git checkout -b feature/your-feature-name

  1. Make Your Changes

Implement your feature or fix in the appropriate directory.

  1. Stage and Commit Your Changes

bash git add . git commit -m "Add feature: your feature description"

  1. Push to Your Fork

bash git push origin feature/your-feature-name

Create a Pull Request

  • Navigate to the original repository and click "New Pull Request." Provide a clear description of your changes and submit.

Guidelines

  • Code Quality: Ensure your code adheres to the project's coding standards and is well-documented.
  • Testing: Write unit tests for your contributions to maintain the project's reliability.
  • Documentation: Update the documentation if your changes affect usage or add new features.
  • Respect and Inclusivity: Maintain a respectful and inclusive environment. - Discriminatory language or behavior will not be tolerated.

Reporting Issues

If you encounter bugs or have feature requests, please open an issue in the Issues section of the repository. Provide as much detail as possible to help us address the problem effectively.

Donations

Developing and maintaining Moon requires significant time and resources. If you find Moon valuable and wish to support its ongoing development, consider making a donation. Your generosity helps us improve the language, expand its capabilities, and foster a vibrant community.

How to Donate

  • GitHub Sponsors: Sponsor Moon
  • Patreon: Support us on Patreon
  • PayPal: Donate via PayPal
  • Bitcoin: Send to 1BoatSLRHtKNngkdXEeobR76b53LETtpyT
  • Ethereum: Send to 0x1BoatSLRHtKNngkdXEeobR76b53LETtpyT

All donations are greatly appreciated and will be used to fund development, tooling, and community initiatives.

License

Moon is released under the MIT License. You are free to use, modify, and distribute Moon as per the terms of the license.

Getting Involved

Join the Moon community and be a part of shaping the future of this unique programming language!

  • GitHub: https://github.com/yourusername/moon
  • Forums: https://forums.moonlang.org (Placeholder)
  • Discord: Join our Discord (Placeholder)
  • Twitter (X): @MoonLang (Placeholder)
  • Stay updated with the latest developments, share your projects, and collaborate with fellow Moon enthusiasts!

Example Code

Islamic Calendar Example

```moon

islamic_calendar.🌙

﷽: from datetime import date from ai import loadmodel, generatetext from math import add, subtract

# Load the AI model
model = load_model("models/gguf_model.gguf") ۝

# Generate text using the AI model
prompt = "La ilaha illallah" ۝
response = generate_text(model, prompt) ۝

# Print the generated text
print("AI Response:", response) ۝

# Perform some math operations
result = add(10, 5) ۝
print("Addition Result:", result) ۝

# Display current date
today = date.today() ۝
print("Today's Date:", today.strftime("%Y-%m-%d")) ۝

```

Using Special Symbols in Control Structures

```moon

control_structures.🌙

def check_positive(number): if number > 0 ۩ # Block closure with ۩ print("Number is positive") ۝ # Statement terminator with ۝ else ۩ print("Number is not positive") ۝

☪@synchronized # Decorator using ☪ def critical_section(): # Code that needs synchronization pass

Loop using 📿 (Prayer Beads)

def iterate_list(items): 📿 item in items ۩ print(item) ۝ ```

Contact

For any questions, suggestions, or support, feel free to reach out:

  • Email: contact@moonlang.org
  • GitHub Issues: https://github.com/yourusername/moon/issues
  • Discord: Join our Discord (Placeholder)

Thank you for choosing Moon! Together, let's build a language that bridges technology and culture, fostering innovation and community. 🌙

Owner

  • Login: BenevolenceMessiah
  • Kind: user

GitHub Events

Total
  • Push event: 5
  • Create event: 2
Last Year
  • Push event: 5
  • Create event: 2