System Overview
simple_rosetta follows a layered architecture with clear separation of concerns:
┌─────────────────────────────────────────┐
│ CLI (rosetta.exe) │
├─────────────────────────────────────────┤
│ SIMPLE_ROSETTA (Facade) │
├─────────────────────────────────────────┤
│ SOLUTION_STORE │ SOLUTIONS_VALIDATOR │
├─────────────────────────────────────────┤
│ simple_sql (SQLite) │
└─────────────────────────────────────────┘
Core Components
SIMPLE_ROSETTA (Facade)
The main entry point providing a simplified API for all operations. Delegates to specialized components.
- Coordinates between storage and validation
- Provides high-level search and query methods
- Manages database lifecycle
SOLUTION_STORE
SQLite-backed storage for solution metadata and code.
- Uses simple_sql for database operations
- Parameterized queries prevent SQL injection
- Schema auto-created on first use
SOLUTIONS_VALIDATOR
Parses .e files and extracts metadata for import.
- Reads note clauses for task name, tier, description
- Extracts class name from source
- Reports parsing errors
Database Schema
CREATE TABLE solutions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
task_name TEXT NOT NULL UNIQUE,
tier INTEGER NOT NULL,
class_name TEXT NOT NULL,
file_name TEXT NOT NULL,
source_code TEXT NOT NULL,
description TEXT,
rosetta_url TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
);
Tier Values
| Value | Meaning |
|---|---|
| 1 | Trivial - Hello World level |
| 2 | Easy - FizzBuzz level |
| 3 | Moderate - Sorting algorithms |
| 4 | Complex - Graph algorithms, advanced DbC |
Solution File Format
Each solution is an Eiffel class with standardized note clauses:
note
description: "[
Rosetta Code: Task Name
https://rosettacode.org/wiki/Task_Name
Brief description of the solution.
]"
author: "Simple Eiffel"
see_also: "https://github.com/simple-eiffel"
rosetta_task: "Task_Name"
tier: "2"
class
TASK_NAME
create
make
feature {NONE} -- Initialization
make
do
-- Implementation
end
end
Required Note Clauses
rosetta_task- Exact Rosetta Code task nametier- Difficulty tier (1-4)description- Task description and URL
Directory Structure
simple_rosetta/
├── src/
│ ├── facade/
│ │ └── simple_rosetta.e
│ └── storage/
│ ├── solution_store.e
│ └── task_store.e
├── solutions/
│ ├── tier1_trivial/
│ ├── tier2_easy/
│ ├── tier3_moderate/
│ └── tier4_complex/
├── testing/
│ └── lib_tests.e
├── docs/
│ ├── index.html
│ ├── user-guide.html
│ ├── api-reference.html
│ ├── architecture.html
│ └── cookbook.html
└── simple_rosetta.ecf
Dependencies
- simple_sql - SQLite database access
- simple_json - JSON parsing (for API responses)
- simple_regex - Pattern matching for parsing
- simple_logger - Logging
- simple_cache - Response caching
- simple_process - Process execution for CLI