How bananaapache/itv works
Project type and purpose
• ITV is a converter/visualization tool that reads derivation files (TPTP‐style .s input), classifies and augments each formula (tcf, fof, thf; adds name, role, inference info, level, parents), emits an output derivation file, and produces a GraphViz‐based layout via a small web UI.
• Key indicators:
• converter.py (Python CLI that drives the conversion)
• GraphViz mention in README
• A static web bundle (BuildBundleWithNode/…) + ITV.html
File structure
Top‐level:
• converter.py, run_IDV, *.s input/output files
• ITV.html — the web front end
• BuildBundleWithNode/ — a Node + Webpack project producing static assets:
– static/js/*.js (ANTLR4‐generated TPTP parser + helpers)
– static/css (styling for the UI)
– webpack.config.js + package.json
README for additional insights
• Conversion requirements: classify formulas, augment them with metadata.
• Use GraphViz to “show correct orientation” with nextTo(...).
Main components & interactions
a. Components:
1. File I/O (Python layer)
2. Parser & Classifier (inside converter.py; may use ANTLR grammar in Python or delegate parsing to JS)
3. Data Model (intermediate representation: name, role, formula, inference_rule, level, parents)
4. Serializer (writes new_output.s or output.s)
5. GraphViz Dot Generator (emits .dot file or invokes dot command)
6. Static Web UI (ITV.html + bundled JS/CSS from BuildBundleWithNode)
7. Bundler (Node + Webpack compiles ANTLR4 JS, helpers into bundle.js)
8. Graph Rendering (GraphViz in browser or server‐side)
b. Relationships & Data Flow:
• User invokes converter.py with input.s → Python reads and parses.
• Converter builds in‐memory data model → classifies each formula.
• Converter outputs an annotated .s file and either:
• Generates a GraphViz dot file → runs dot → produces PNG/SVG
• OR passes dot string to the web UI.
• The web UI (ITV.html) loads bundle.js (built by Webpack) → parses dot / JSON → renders interactive graph.
c. Architectural patterns / design principles:
• Separation of Concerns: CLI conversion vs. UI rendering.
• Modularity: Python modules vs. JS modules (ANTLR4, helpers).
• External Tool Integration: GraphViz.
d. Key technologies:
• Python (converter.py)
• ANTLR4 (grammar → generates TPTPParser.js / Listener, used in browser)
• Node + Webpack (bundles JS/CSS)
• GraphViz (dot)
• HTML/CSS/JS front end
Detail vs. simplicity
• Every essential architectural element (parser, classifier, serializer, visualizer) is represented.