Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.
/ aristid Public archive

Motor de compressão gramatical baseado em L-Systems

Notifications You must be signed in to change notification settings

johanlabs/aristid

Repository files navigation

Aristid - Grammatical Compression Engine

Aristid is an experimental grammatical compression engine based on L-Systems and recursion, using an innovative approach to text compression inspired by grammar and linguistic patterns.

🚀 Features

  • Grammatical Compression: Instead of traditional algorithms, Aristid analyzes linguistic patterns
  • L-Systems (Lindenmayer Systems): Based on formal grammars for recursive expansion/compression
  • Native Rust Engine: Core implemented in Rust for maximum performance
  • Self-learning: Rule matrix that evolves with usage
  • Cross-platform: Supports Windows, macOS, and Linux
  • Easy integration: Windows context menu and CLI interface

🛠️ Installation

Via npm

npm install -g aristid

Local Build

# Clone the repository
git clone https://github.com/johanlabs/aristid
cd aristid

# Install dependencies and build
yarn install
yarn build

📖 Usage

Command Line Interface

# Compress a file
aristid file.txt

# Reconstruct from .ari
aristid file.ari

Context Menu (Windows)

After installation:

  1. Right-click on any file
  2. Select "Aristid" from the menu
  3. The file will be processed automatically

Install/Remove Context Menu

# Install menu
npm run install-menu

# Remove menu
npm run uninstall-menu

🏗️ Architecture

aristid/
├── core/              # Native Rust engine (napi-rs)
├── src/               # JavaScript interface
│   ├── cli.js         # Command line interface
│   ├── handler.js     # Flow manager
│   └── matrix_manager.js # Rule matrix manager
├── matrix/            # Grammatical rules
├── scripts/           # Utility scripts
└── index.js           # Node.js binding

🧪 Technical Operation

Compression Process

  1. Grammatical Analysis: Identifies patterns and rules in text
  2. Rule Extraction: Creates L-System rules based on repetitions
  3. Substitution: Replaces patterns with optimized tokens
  4. Serialization: Saves seed + rules in .ari format

Reconstruction Process

  1. Loading: Reads seed and rules from .ari file
  2. Rule Application: Executes L-System for expansion
  3. Reconstruction: Generates original text from grammar
  4. Saving: Produces _florescido.txt file

.ari Format

{
  "seed": "base64_encoded_seed",
  "rules": "base64_encoded_binary_rules"
}

🚦 Benchmark

Run the included benchmark:

npm run benchmark

The benchmark tests:

  • Compression/decompression speed
  • Reduction rate
  • Data integrity
  • Rust engine performance

🔧 Development

Prerequisites

  • Node.js 20+
  • Rust 1.70+
  • Yarn 4.x
  • Native build tools (gcc, make, etc.)

Development Commands

# Build in release mode
yarn build

# Build in debug mode
yarn build:debug

# Run tests
cd core && yarn test

# Format code
cd core && yarn format

# Lint
cd core && yarn lint

Rust Core Structure

// src/lib.rs
#[napi]
fn encode_grammar(input: Buffer, matrix: Buffer) -> EncodeResult {
    // Compression logic
}

#[napi]
fn decode_grammar(seed: Buffer, matrix: Buffer) -> Buffer {
    // Reconstruction logic
}

📊 Rule Matrix

Aristid uses a rule matrix that evolves with usage:

  • Located at matrix/user_solo.ari-matrix
  • Stores learned grammatical rules
  • Optimized binary format
  • Incremental learning

🌐 Compatibility

Operating Systems

  • ✅ Windows (x64, ia32, arm64)
  • ✅ macOS (x64, arm64, universal)
  • ✅ Linux (x64-gnu, x64-musl, arm64, arm, riscv64, s390x)
  • ✅ FreeBSD (x64)
  • ✅ Android (arm64, arm)

Node.js Versions

  • Node.js 20.x
  • Node.js 22.x
  • Node.js 24.x

🤝 Contributing

  1. Fork the project
  2. Create your branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

Distributed under MIT License. See LICENSE for more information.

🙏 Acknowledgments

  • napi-rs: For the amazing Rust/Node.js integration
  • The Hitchhiker's Guide to the Galaxy: For philosophical inspiration
  • Rust Brasil Community: For technical support

🐛 Reporting Issues

Found a bug or have a suggestion? Open an issue.


Aristid - Because space is vast, and compression can be grammatical. 🚀

About

Motor de compressão gramatical baseado em L-Systems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published