Skip to content

TitaniteScale/coralsnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoralSnake 🐍

A DSL for Minecraft Redstone

CoralSnake is a simple Domain Specific Language (DSL) designed to describe Redstone logic in Minecraft. The goal is to write .dust files using CoralSnake syntax, and eventually have an interpreter generate step-by-step build instructions or schematics for the described contraption.

📦 Current Status (v0.4 - Parsing & Execution)
  • Parsing: The interpreter (coral.py) now supports inputs, outputs, variables, parameterized functions (with parameters) and argument-passing in calls, along with control flow and action statements.
  • Standard Library: You can define and call reusable functions across .dust files (e.g., logic gate libraries and imports).
  • Structure Output: Prints a structured view of the parsed program with clear indentation and command sequencing.
  • Material Estimation: Provides a basic estimate of required Redstone components based on the parsed commands.
  • Execution Notes: Outputs execution notes showing function signatures, steps, and call arguments. Full simulation logic (state changes, loops, timing) is still under development.

Syntax

The language syntax is defined in docs/SYNTAX.md. It uses indentation for structure and aims for readability.

Usage

To parse a CoralSnake file and see the parsed structure and estimated materials:

python coral.py <your_file.dust>

Example:

python coral.py examples/clock.dust
🚀 Getting Started

To run the CoralSnake parser, make sure you have Python 3 installed. Then from your terminal:

  1. Install Python:

    • Windows: Download and install from Python.org
    • Mac: Use Homebrew: brew install python3
    • Linux: Python is usually pre-installed, or use: sudo apt install python3
  2. Download CoralSnake:

    # Clone the repository (HTTPS)
    git clone https://github.com/TitaniteScale/coralsnake.git
    
    # Or clone via SSH:
    git clone [email protected]:TitaniteScale/coralsnake.git
    
    # Go into the project folder
    cd coralsnake
  3. You're ready to run CoralSnake!

python3 coral.py your_file.dust

This will display the parsed structure and an estimate of Redstone components needed.

VS Code Extension

CoralSnake has an official Visual Studio Code extension for syntax highlighting and language support.

Icon

CoralSnake Language Icon

To install:

  • Search for "CoralSnake" in the VS Code Extensions Marketplace, or
  • Install directly using the .vsix if downloaded locally.

Snippets

Example Code (clock.dust): The example illustrates clearly structured definitions for basic logical gates (AND, OR, XOR, NOT), demonstrating syntax highlighting and readability provided by the extension.


**Interpreter Output:**

Running coral.py to interpret examples/clock.dust shows the parsed structure and estimated materials needed

Examples / Demos

Basic examples can be found in the examples/ directory.

(More detailed examples and demos demonstrating generated build instructions are planned for future versions!)

🧪 Future Work
  • Implement the execution engine to simulate the Redstone logic.
  • Develop the build instruction generation based on parsed and executed logic.
  • Potentially add support for schematic generation (.litematic, .schem).
  • Refine syntax and add more advanced Redstone concepts.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A human-readable logic language for Minecraft Redstone. Write in .dust, build with confidence.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages