{"id":48217717,"url":"https://github.com/cdilga/ladder-logic-editor","last_synced_at":"2026-04-04T19:01:47.169Z","repository":{"id":332031302,"uuid":"1132508380","full_name":"cdilga/ladder-logic-editor","owner":"cdilga","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-12T04:02:48.000Z","size":278,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T13:27:05.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdilga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-12T03:58:14.000Z","updated_at":"2026-01-12T04:08:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cdilga/ladder-logic-editor","commit_stats":null,"previous_names":["cdilga/ladder-logic-editor"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cdilga/ladder-logic-editor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdilga%2Fladder-logic-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdilga%2Fladder-logic-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdilga%2Fladder-logic-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdilga%2Fladder-logic-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdilga","download_url":"https://codeload.github.com/cdilga/ladder-logic-editor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdilga%2Fladder-logic-editor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31409471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T19:01:46.532Z","updated_at":"2026-04-04T19:01:47.155Z","avatar_url":"https://github.com/cdilga.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/IEC_61131--3-Compliant-00875A?style=for-the-badge\u0026labelColor=1a1a1a\" alt=\"IEC 61131-3 Compliant\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React-19-61DAFB?style=for-the-badge\u0026logo=react\u0026logoColor=61DAFB\u0026labelColor=1a1a1a\" alt=\"React 19\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/TypeScript-5.9-3178C6?style=for-the-badge\u0026logo=typescript\u0026logoColor=3178C6\u0026labelColor=1a1a1a\" alt=\"TypeScript\"/\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/cdilga/ladder-logic-editor?style=for-the-badge\u0026labelColor=1a1a1a\u0026color=yellow\" alt=\"License\"/\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n\u003ch1 align=\"center\"\u003e\n  \u003ccode\u003e━━┫ LADDER LOGIC EDITOR ┣━━\u003c/code\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eTransform Structured Text into visual ladder diagrams.\u003c/strong\u003e\u003cbr/\u003e\n  \u003cstrong\u003eSimulate PLC logic in real-time. All in your browser.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://lle.dilger.dev/\"\u003e\u003cb\u003e⚡ Live Demo\u003c/b\u003e\u003c/a\u003e\n  \u0026nbsp;•\u0026nbsp;\n  \u003ca href=\"https://lle.dilger.dev/#/docs\"\u003e\u003cb\u003e📚 Documentation\u003c/b\u003e\u003c/a\u003e\n  \u0026nbsp;•\u0026nbsp;\n  \u003ca href=\"#-quick-start\"\u003eQuick Start\u003c/a\u003e\n  \u0026nbsp;•\u0026nbsp;\n  \u003ca href=\"#-features\"\u003eFeatures\u003c/a\u003e\n  \u0026nbsp;•\u0026nbsp;\n  \u003ca href=\"#-architecture\"\u003eArchitecture\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003cstrong\u003eDesktop\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003cstrong\u003eMobile\u003c/strong\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"ladder-logic-demo.gif\" alt=\"Desktop Demo\" width=\"600\"/\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"ladder-logic-mobile-demo.gif\" alt=\"Mobile Demo\" width=\"200\"/\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://lle.dilger.dev/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/▶_TRY_THE_LIVE_DEMO-00875A?style=for-the-badge\u0026logoColor=white\" alt=\"Try the Live Demo\" height=\"50\"/\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://lle.dilger.dev/#/docs\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/📚_READ_THE_DOCS-FF9500?style=for-the-badge\u0026logoColor=white\" alt=\"Read the Documentation\" height=\"50\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n---\n\n\u003cbr/\u003e\n\n## ⚡ What is this?\n\nWrite **IEC 61131-3 Structured Text** code. Watch it transform into **ladder diagrams** instantly. Run **live simulations** with scan cycle execution. Toggle inputs. Watch outputs change. Debug visually.\n\n```\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                                                                             │\n│    ST Code                  Ladder Diagram              Variable Watch      │\n│    ┌──────────┐            ┌──────────────┐            ┌──────────────┐    │\n│    │ IF A AND │    ──►     │ ─┤A├─┤B├─(Y) │    ──►     │ A: [TRUE ]   │    │\n│    │ B THEN   │            │              │            │ B: [FALSE]   │    │\n│    │ Y := 1;  │            │ Power flows  │            │ Y: [FALSE]   │    │\n│    └──────────┘            └──────────────┘            └──────────────┘    │\n│                                                                             │\n│    Write code               See it visualized          Simulate \u0026 debug     │\n│                                                                             │\n└─────────────────────────────────────────────────────────────────────────────┘\n```\n\n\u003cbr/\u003e\n\n## 🎯 Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🔄 Real-Time Transformation\nWrite ST code and watch the ladder diagram update instantly. Full bidirectional sync keeps everything in harmony.\n\n### ⏱️ Timer Function Blocks\n**TON** (On-Delay), **TOF** (Off-Delay), **TP** (Pulse) — all IEC 61131-3 compliant with proper timing behavior.\n\n### 🔢 Counter Function Blocks\n**CTU** (Count Up), **CTD** (Count Down), **CTUD** (Up/Down) — complete with preset values and output flags.\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 📈 Edge Detection\n**R_TRIG** (Rising Edge), **F_TRIG** (Falling Edge) — single-scan pulse generation for event-driven logic.\n\n### ▶️ Live Simulation\nRun your ladder logic with real scan cycle execution. Toggle inputs, watch outputs respond, observe timer elapsed times.\n\n### 👁️ Variable Watch Panel\nMonitor all variables in real-time. Click to toggle BOOLs. View timers and counters. Filter by type.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cbr/\u003e\n\n### Full IEC 61131-3 ST Support\n\n```\n┌────────────────────┬──────────────────────────────────────────────────────┐\n│ Category           │ Supported Elements                                   │\n├────────────────────┼──────────────────────────────────────────────────────┤\n│ Boolean Logic      │ AND, OR, XOR, NOT                                    │\n│ Comparisons        │ =, \u003c\u003e, \u003e, \u003e=, \u003c, \u003c=                                  │\n│ Arithmetic         │ +, -, *, /, MOD                                      │\n│ Control Flow       │ IF/THEN/ELSIF/ELSE, CASE, FOR, WHILE, REPEAT        │\n│ Timers             │ TON, TOF, TP                                         │\n│ Counters           │ CTU, CTD, CTUD                                       │\n│ Edge Detectors     │ R_TRIG, F_TRIG                                       │\n│ Data Types         │ BOOL, INT, REAL, TIME                                │\n│ Variable Sections  │ VAR, VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT              │\n└────────────────────┴──────────────────────────────────────────────────────┘\n```\n\n\u003cbr/\u003e\n\n## 🚀 Quick Start\n\n```bash\n# Clone the repository\ngit clone https://github.com/cdilga/ladder-logic-editor.git\ncd ladder-logic-editor\n\n# Install dependencies\nnpm install\n\n# Start development server\nnpm run dev\n```\n\nOpen **http://localhost:5173** and start writing ST code!\n\n\u003cbr/\u003e\n\n## 📦 Example: Traffic Light Controller\n\n```iecst\nPROGRAM TrafficController\nVAR_INPUT\n    START_BTN : BOOL;    (* Start button *)\n    STOP_BTN : BOOL;     (* Stop button *)\n    ESTOP : BOOL;        (* Emergency stop *)\nEND_VAR\n\nVAR_OUTPUT\n    N_RED : BOOL;        (* North Red *)\n    N_YEL : BOOL;        (* North Yellow *)\n    N_GRN : BOOL;        (* North Green *)\nEND_VAR\n\nVAR\n    Running : BOOL;\n    PhaseTimer : TON;\n    CurrentPhase : INT;\nEND_VAR\n\n(* Start/Stop Logic *)\nIF START_BTN AND NOT ESTOP THEN\n    Running := TRUE;\nEND_IF;\n\nIF STOP_BTN OR ESTOP THEN\n    Running := FALSE;\nEND_IF;\n\n(* Phase Timer - 3 second phases *)\nPhaseTimer(IN := Running, PT := T#3s);\n\nIF PhaseTimer.Q THEN\n    CurrentPhase := CurrentPhase + 1;\n    IF CurrentPhase \u003e 2 THEN\n        CurrentPhase := 0;\n    END_IF;\nEND_IF;\n\n(* Output Logic *)\nN_GRN := Running AND CurrentPhase = 0;\nN_YEL := Running AND CurrentPhase = 1;\nN_RED := Running AND CurrentPhase = 2;\n\nEND_PROGRAM\n```\n\n\u003cbr/\u003e\n\n## 🏗️ Architecture\n\n```\n                              ┌─────────────────────────────────────┐\n                              │         Transformation Pipeline     │\n                              └─────────────────────────────────────┘\n                                              │\n     ┌──────────────────────────────────────────────────────────────────────┐\n     │                                                                       │\n     │   ┌─────────┐    ┌─────────┐    ┌─────────┐    ┌─────────┐          │\n     │   │   ST    │    │  Lezer  │    │ Ladder  │    │  React  │          │\n     │   │  Code   │───►│   AST   │───►│   IR    │───►│  Flow   │          │\n     │   └─────────┘    └─────────┘    └─────────┘    └─────────┘          │\n     │                                                      │               │\n     │   \"IF A THEN\"    Typed syntax   Rungs, contacts     Visual          │\n     │   \"  Y := 1\"     tree nodes     coils, branches     diagram         │\n     │                                                                      │\n     └──────────────────────────────────────────────────────────────────────┘\n                                              │\n                              ┌───────────────┴───────────────┐\n                              │                               │\n                      ┌───────▼───────┐               ┌───────▼───────┐\n                      │   Interpreter │               │    Layout     │\n                      │   \u0026 Simulator │               │    Engine     │\n                      └───────────────┘               └───────────────┘\n                              │                               │\n                      Scan cycle execution            Node positioning\n                      Timer/Counter state             Edge routing\n                      Variable updates                Branch layout\n```\n\n### Key Transformations\n\n| ST Expression | Ladder Representation |\n|--------------|----------------------|\n| `A AND B` | Series contacts: `─┤A├─┤B├─` |\n| `A OR B` | Parallel branches |\n| `NOT A` | Normally Closed: `─┤/A├─` |\n| `X := expr;` | Input contacts → Output coil |\n| `TON(IN:=x, PT:=T#5s)` | Timer function block |\n| `CTU(CU:=x, PV:=10)` | Counter function block |\n| `Count \u003e 10` | Comparator block |\n\n\u003cbr/\u003e\n\n## 🛠️ Tech Stack\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React-19-61DAFB?style=flat-square\u0026logo=react\u0026logoColor=white\" alt=\"React\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/TypeScript-5.9-3178C6?style=flat-square\u0026logo=typescript\u0026logoColor=white\" alt=\"TypeScript\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Vite-5-646CFF?style=flat-square\u0026logo=vite\u0026logoColor=white\" alt=\"Vite\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/React_Flow-11-FF0072?style=flat-square\" alt=\"React Flow\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/CodeMirror-6-D30707?style=flat-square\" alt=\"CodeMirror\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Lezer-Parser-4B32C3?style=flat-square\" alt=\"Lezer\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Zustand-5-433E38?style=flat-square\" alt=\"Zustand\"/\u003e\n\u003c/p\u003e\n\n| Technology | Purpose |\n|-----------|---------|\n| **React 19** | UI framework with concurrent features |\n| **TypeScript** | Type safety across the codebase |\n| **Vite** | Fast builds and HMR |\n| **React Flow** | Ladder diagram rendering |\n| **CodeMirror 6** | ST code editor with syntax highlighting |\n| **Lezer** | High-performance parser generator |\n| **Zustand** | Lightweight state management |\n\n\u003cbr/\u003e\n\n## 📁 Project Structure\n\n```\nsrc/\n├── components/\n│   ├── ladder-editor/       # Ladder diagram canvas \u0026 nodes\n│   │   └── nodes/           # Contact, Coil, Timer, Counter nodes\n│   ├── st-editor/           # CodeMirror ST editor\n│   ├── variable-watch/      # Real-time variable monitoring\n│   └── layout/              # App layout components\n├── transformer/\n│   ├── ast/                 # ST AST types \u0026 CST conversion\n│   ├── ladder-ir/           # Intermediate representation\n│   ├── layout/              # Diagram positioning algorithm\n│   └── react-flow/          # IR to React Flow conversion\n├── interpreter/\n│   ├── program-runner.ts    # Scan cycle execution\n│   ├── expression-evaluator.ts\n│   ├── statement-executor.ts\n│   └── function-block-handler.ts\n├── lang/\n│   └── st.grammar           # Lezer grammar for ST\n└── store/\n    ├── project-store.ts     # Project state\n    └── simulation-store.ts  # Simulation state \u0026 variables\n```\n\n\u003cbr/\u003e\n\n## 🧪 Testing\n\n```bash\n# Run unit tests\nnpm test\n\n# Run with watch mode\nnpm run test:watch\n\n# Run E2E tests\nnpm run test:e2e\n```\n\nThe project includes:\n- **Unit tests** for parser, transformer, and interpreter\n- **Property-based tests** for arithmetic and control flow\n- **Compliance tests** for IEC 61131-3 conformance\n- **Integration tests** for real-world PLC patterns\n- **E2E tests** with Playwright\n\n\u003cbr/\u003e\n\n## 🌐 Deployment\n\nAutomatically deployed to **GitHub Pages** on every push to `main`.\n\n**Live site:** https://lle.dilger.dev/\n\n\u003cbr/\u003e\n\n## 📚 Documentation\n\n- [User Guide](https://lle.dilger.dev/#/docs) — Tutorials and getting started\n- [IEC 61131-3 Reference](./specs/IEC_61131_3_REFERENCE.md) — Full standard specification\n\n\u003cbr/\u003e\n\n## 📄 License\n\nMIT License — use freely for personal and commercial projects.\n\n\u003cbr/\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003csub\u003eBuilt with ☕ and a passion for industrial automation\u003c/sub\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdilga%2Fladder-logic-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdilga%2Fladder-logic-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdilga%2Fladder-logic-editor/lists"}