How cristox1/pele works
1. What this repository is
- PELE is a programming language runtime, not an application framework.
- Its architecture centers on a custom language front end plus a native standard library written in PELE itself for data science, machine learning, and deep learning workflows.
2. Primary execution path
- A PELE source file is parsed by ANTLR-generated lexer/parser code.
- The parse tree is evaluated by a Python-based visitor/interpreter.
- Before user code runs, the interpreter injects the PELE native library prelude so language-level functions are available.
3. Language front end
- PELE.g4 is the source grammar and defines syntax and operator precedence.
- PELELexer.py, PELEParser.py, PELEListener.py, PELEVisitor.py, plus the .tokens and .interp files are generated ANTLR artifacts.
- This means the repository keeps both the grammar source and its generated parser runtime in version control.
4. Interpreter boundary
- pele.py is the executable entry point that coordinates compilation/execution.
- visitorPELE.py contains the AST/semantic evaluator logic.
- The README emphasizes a strict boundary: Python is only the low-level VM/interpreter; domain logic is intentionally implemented in PELE, not Python libraries.
5. Native standard library layer
- The .pele files form the language’s “stdlib” and are the core of the architecture.
- These modules implement reusable capabilities in a functional style and are loaded by the interpreter in dependency order.
6. Core utility modules
- pele_math.pele provides base math and activations such as power, exp, log, min/max, sigmoid, and ReLU.
- pele_random.pele provides deterministic pseudo-random generation for reproducible experiments.
- pele_data.pele handles preprocessing helpers such as normalization and z-score standardization.
7. Data structure subsystem
- pele_structs.pele provides in-language immutable/pure data structures: stacks, queues, sets, trees, and graphs.
- These structures support recursion-heavy operations such as traversals, BFS, and DFS.
- This subsystem is foundational for the rest of the runtime because it avoids relying on Python containers for core language features.
8. Numerical computation subsystem
- pele_numpy.pele and pele_tensor.pele define tensor/array abstractions and linear algebra operations.
- The README highlights matrix transpose, addition, subtraction, dot/matrix multiplication, and shape handling.
- This layer is the numerical backbone for ML and neural-network code.
9. Data ingestion and feature engineering
- pele_pandas.pele is the ETL-like layer.
- It includes CSV parsing, column selection/projection, null handling, and one-hot encoding.
- In diagram terms, this is the bridge from raw text input to model-ready feature matrices.
10. Machine learning and model layer
- pele_ml.pele contains classic algorithms such as perceptron, linear regression, KNN, and k-means.
- pele_nn.pele handles neural-network primitives like layer initialization and forward propagation.
- These modules consume data/tensors from the numerical and preprocessing layers and produce predictions or embeddings.
11. Training objectives and evaluation
- pele_losses.pele provides loss functions such as BCE and MSE.
- pele_metrics.pele provides accuracy, precision, recall, F1, confusion matrix, and R².
- This creates a clear training/evaluation pipeline: model output -> loss/metrics -> reported results.
12. Visualization output
- pele_plot.pele generates SVG output for learning curves and scatter plots.
- The plotting layer is an output boundary: it converts computed results into a portable visual artifact rather than displaying through a GUI framework.
13. Demonstration and validation assets
- programa.txt appears to be the integration/demo script or dashboard used to exercise the language end to end.
- The sample .pele files (pele_math.pele, pele_ml.pele, pele_pandas.pele, etc.) act as modular tests/examples for each library area.
14. Development/runtime tooling
- The repo is built around Python 3 and ANTLR4; Java is only relevant if the grammar is regenerated.
- The checked-in env/ directory is a local virtual environment, not part of the language architecture itself.
- Architecturally, the important external dependency is the ANTLR Python runtime; the language features themselves are intended to live inside the PELE ecosystem.
Main entry points: pele_ml.pele ML models · pele.py pele.py · pele_pandas.pele Pandas layer · pele_nn.pele Neural net
Components 23
Front end
Grammar and generated ANTLR parser artifacts
- PELE.g4 · Source grammar defining PELE syntax and precedence
PELE.g4 - Lexer · Tokenizes PELE source
PELELexer.py - Parser · Builds parse trees for PELE programs
PELEParser.py - Visitor API · Parse-tree listener and visitor interfaces
PELEVisitor.py
Runtime
Python entrypoint and interpreter boundary
- pele.py · Starts compilation and execution of PELE programs
pele.py - visitorPELE.py · Evaluates parse trees and drives semantic execution
visitorPELE.py - Prelude load · Injects the PELE native library before user code runs
PELE stdlib
Native language modules loaded by the runtime
- Math core · Base math, activations, and scalar utilities
pele_math.pele - Random core · Pseudo-random generation for reproducible experiments
pele_random.pele - Data core · Normalization and z-score style helpers
pele_data.pele - Structs · Immutable stacks, queues, sets, trees, and graphs
pele_structs.pele - Tensor math · Array abstractions and linear algebra operations
pele_tensor.pele - NumPy layer · Matrix and tensor operations built for computation workflows
pele_numpy.pele - Pandas layer · CSV parsing, selection, null handling, and one-hot encoding
pele_pandas.pele - ML models · Perceptron, linear regression, KNN, and k-means
pele_ml.pele - Neural net · Layer setup and forward propagation
pele_nn.pele - Losses · BCE and MSE loss functions
pele_losses.pele - Metrics · Accuracy, precision, recall, F1, confusion matrix, and R²
pele_metrics.pele - Plotting · Generates SVG charts for curves and scatter plots
pele_plot.pele
Examples
Demo and integration scripts
- Demo script · End-to-end exercise of the language and libraries
programa.txt - README · Architecture and usage overview
README.md
Tooling
External runtime and environment support
- ANTLR4 · Python runtime support for generated grammar artifacts
- Python VM · Executes the interpreter and generated parser code
Connections 40
- PELE.g4 → Lexer: generates · ANTLR grammar source generates lexer code
- PELE.g4 → Parser: generates · ANTLR grammar source generates parser code
- PELE.g4 → Visitor API: generates · ANTLR grammar source generates visitor/listener interfaces
- ANTLR4 → Lexer: supports · ANTLR Python runtime executes generated lexer
- ANTLR4 → Parser: supports · ANTLR Python runtime executes generated parser
- pele.py → Lexer: uses · Entry point starts tokenization
- pele.py → Parser: uses · Entry point builds parse trees
- pele.py → visitorPELE.py: dispatches to · Entrypoint hands parsed programs to the evaluator
- visitorPELE.py → Prelude load: initializes · Interpreter loads native prelude before user code
- Prelude load → Structs: loads · Native library dependencies are loaded in order
- Prelude load → Math core: loads · Native library dependencies are loaded in order
- Prelude load → Random core: loads · Native library dependencies are loaded in order
- Prelude load → Data core: loads · Native library dependencies are loaded in order
- Prelude load → NumPy layer: loads · Native library dependencies are loaded in order
- Prelude load → Tensor math: loads · Native library dependencies are loaded in order
- Prelude load → Pandas layer: loads · Native library dependencies are loaded in order
- Prelude load → ML models: loads · Native library dependencies are loaded in order
- Prelude load → Neural net: loads · Native library dependencies are loaded in order
- Prelude load → Losses: loads · Native library dependencies are loaded in order
- Prelude load → Metrics: loads · Native library dependencies are loaded in order
- Prelude load → Plotting: loads · Native library dependencies are loaded in order
- Math core → Neural net: feeds · Math primitives support neural-network operations
- Math core → Losses: feeds · Math primitives support objective calculations
- Random core → ML models: feeds · Deterministic randomness supports ML algorithms
- Data core → Pandas layer: feeds · Preprocessing helpers underpin data ingestion
- Structs → ML models: supports · Language data structures support algorithmic routines
- Structs → Pandas layer: supports · Core structures support parsing and transformation workflows
- NumPy layer → Tensor math: builds on · Tensor layer extends array math
- Pandas layer → NumPy layer: produces · Feature engineering outputs numeric matrices
- Pandas layer → ML models: feeds · Prepared data flows into model training
- Tensor math → Neural net: feeds · Tensor abstractions feed neural-network primitives
- Tensor math → ML models: feeds · Tensor operations support classic ML workflows
- ML models → Losses: optimizes with · Model outputs are evaluated by loss functions
- Neural net → Losses: optimizes with · Neural outputs are evaluated by loss functions
- ML models → Metrics: reports to · Predictions are summarized by evaluation metrics
- Neural net → Metrics: reports to · Predictions are summarized by evaluation metrics
- Metrics → Plotting: visualized by · Evaluation results can be turned into SVG plots
- Demo script → pele.py: drives · Demo script exercises the runtime end to end
- README → pele.py: documents · Project guide describes execution path
- README → Prelude load: documents · Project guide describes stdlib injection boundary