How do pl2js and Tau Prolog compare?
ChatGPT: Here’s a clear, engineering-level comparison between your pl2js concept/repo and Tau Prolog:
⸻
🧠 Core Difference (1 sentence)
• pl2js = compiler/translator (Prolog → JS code)
• Tau Prolog = interpreter/runtime (executes Prolog directly in JS)
⸻
⚙️ Architecture Comparison
- Execution Model
Tau Prolog
• Interprets Prolog at runtime
• Uses a Prolog engine implemented in JavaScript
• Backtracking, unification, etc. are simulated dynamically
• Non-blocking, callback-based execution model 
pl2js (your design direction)
• Ahead-of-time conversion
• Prolog → explicit JS control flow
• loops instead of backtracking
• if/else instead of clause selection
• Similar philosophy to your pl2c:
• remove interpreter overhead
• flatten logic into imperative structures
👉 Key insight:
• Tau = simulate Prolog
• pl2js = eliminate Prolog
⸻
🚀 2. Performance Philosophy
Tau Prolog
• Slower (interpretive overhead)
• Flexible and dynamic
• Handles general Prolog features (ISO-oriented) 
pl2js
• Potentially much faster
• Precompiled logic → direct execution
• Can optimise:
• repeated calls → functions
• choice points → loops
• data reuse → cached variables
👉 Your system aligns with:
“manual neuronet optimisation” + “Spec → Algorithm flattening”
⸻
🧩 3. Feature Completeness
Tau Prolog
• Designed toward ISO Prolog compliance 
• Supports:
• modules
• DCGs
• meta-predicates
• async predicates
• DOM interaction
pl2js
• Likely:
• partial Prolog subset
• depends on what you convert
• Harder features:
• cut (!)
• dynamic predicates (assertz)
• meta-programming
• full unification edge cases
👉 Trade-off:
• Tau = completeness
• pl2js = controllable subset + optimisation
⸻
🌐 4. Web Integration
Tau Prolog
• Native browser integration:
• manipulate DOM from Prolog
• event handling 
• Drop-in script usage
pl2js
• Output is plain JavaScript
• Integrates like any JS:
• React / HTML / mobile
• Better for:
• embedding in apps
• mobile (your goal: iPhone/Android)
⸻
🧪 5. Debugging & Transparency
Tau Prolog
• Debugging = Prolog-level
• Harder to inspect internal execution (black-box engine)
pl2js
• Debugging = JavaScript-level
• You can:
• log intermediate states
• inspect variables
• trace execution paths
👉 This aligns strongly with your:
• transparent MNN philosophy
• “no invisible bugs” goal
⸻
🧱 6. Control Over Execution
Tau Prolog
• Engine decides:
• backtracking order
• search strategy
pl2js
• YOU decide:
• loop structure
• branching
• memory usage
• determinism
👉 This is huge for:
• CI/CD
• deterministic systems
• optimisation pipelines
⸻
⸻
🧠 Strategic Insight (Important for Your Project)
Your system (pl2js) is not competing directly with Tau Prolog.
Instead:
Tau Prolog = “Prolog runtime for the web”
pl2js = “Prolog → optimised algorithm generator”
👉 In your ecosystem:
• Tau Prolog = execution layer
• pl2js = optimisation + deployment layer
⸻
🔥 Recommendation (based on your goals)
Given your:
• Spec → Algorithm vision
• MNN transparency goals
• CI/CD system (Lucian CI/CD)
👉 pl2js is the more aligned direction
Use Tau Prolog only if you need:
• quick prototyping
• full Prolog compatibility
• teaching/demo environments
⸻
💡 Advanced Hybrid Idea (Very Relevant to You)
You could combine both:
1. Prototype logic in Tau Prolog
2. Convert stable predicates via pl2js
3. Optimise with:
• Gaussian elimination
• recursion flattening
4. Deploy as pure JS
👉 This becomes:
Interpreter → Compiler → Optimiser pipeline

Top comments (0)