flowchart TD
  A[GRL Source .grl] --> B[Lexer]
  B --> C[Tokens]
  C --> D[Parser]
  D --> E[AST]
  E --> F[Symbol Table]
  F --> G[Semantic Analyzer]

  G --> G1[名称解析]
  G --> G2[类型检查]
  G --> G3[单位规范化]
  G --> G4[tool/frame/speed/zone 解析]
  G --> G5[Path/Operation 引用检查]
  G --> G6[IO 地址检查]
  G --> G7[运动目标可达性检查]
  G --> G8[后处理能力检查]

  G1 --> H[Executable IR]
  G2 --> H
  G3 --> H
  G4 --> H
  G5 --> H
  G6 --> H
  G7 --> H
  G8 --> H

  H --> I{IR}
  I -->|MotionInstruction| J[Motion Request Builder]
  I -->|WaitInstruction| K[Wait Registry]
  I -->|IoInstruction| L[IO Image]
  I -->|BranchInstruction| M[Program Counter]
  I -->|CallInstruction| N[Call Stack]
  I -->|AlarmInstruction| O[Alarm Queue]
  I -->|ReturnInstruction| P[Scope/Call Stack]

  J --> Q[KDL WASM]
  Q --> R[TrajectoryResult / Diagnostics]
  R --> S[Motion Queue]

  H --> T[Post Processor]
  T --> U[品牌程序]
  T --> V[转换报告]
