How red1oon/bimcompiler works
Purpose and primary entry points
This is a Java/Maven BIM intent compiler plus supporting extraction, verification, ERP, and browser-delivery work. Its core transformation is IFC/extracted spatial data → classified BOM/database → deterministic compiled building output → proof/validation gates. Main executable boundaries are the compiler CLI at DAGCompiler/src/main/java/com/bim/compiler/cli/BuildingCompilerCLI.java, IFC conversion at IFCtoBOM/src/main/java/com/bim/ifctobom/IFCtoBOMMain.java, and scripted orchestration in scripts/run_RosettaStones.sh.
Compiler core: intent/DSL to building model
DAGCompiler is the central domain engine. BuildingCompiler coordinates parsing and staged compilation, while CompilationPipeline and CompilerStage define the pipeline contract and context passed between stages. The DSL resolves building definitions, spaces, storeys, assemblies, openings, MEP, and placement into a BOM-backed spatial model.
• DAGCompiler/src/main/java/com/bim/compiler/dsl/BuildingCompiler.java
• DAGCompiler/src/main/java/com/bim/compiler/dsl/CompilationPipeline.java
• DAGCompiler/src/main/java/com/bim/compiler/dsl/CompilationContext.java
BOM, catalog, and persistence boundary
A building is represented as a hierarchy of BOM assemblies and catalog-qualified components rather than merely geometry. BOM builders/walkers construct and traverse this hierarchy; library resolvers select component definitions and discipline-specific placers. SQLite component and output databases are the durable interchange boundary, backed by append-only SQL migrations.
• DAGCompiler/src/main/java/com/bim/compiler/bom/BOMBuilder.java
• DAGCompiler/src/main/java/com/bim/compiler/bom/walker/BOMWalker.java
• DAGCompiler/src/main/java/com/bim/compiler/library/ComponentLibrary.java
• library/component_library.db
• migration/
Geometry, placement, and services routing
The compiler has an internal geometry model (coordinates, meshes, bounding boxes), with factories producing parametric or library-derived elements. Placement and clash/compliance concerns are explicit boundaries. MEP systems are modeled as connected nodes/edges and routed through COBOL verb geometry builders.
• DAGCompiler/src/main/java/com/bim/compiler/geometry/GeometryEngine.java
• DAGCompiler/src/main/java/com/bim/compiler/placement/PlacementValidator.java
• DAGCompiler/src/main/java/com/bim/compiler/system/MEPSystem.java
• BIM_COBOL/src/main/java/com/bim/cobol/geometry/DisciplineRouteRegistry.java
Verb execution and fabrication extensions
BIM_COBOL provides a registry/executor architecture for domain verbs that mutate or derive the compiled model: spatial construction, BOM operations, placement, routing, validation, and fabrication. Java service-provider registrations connect this module to the core compiler’s VerbExecutor/RouteExecutor contracts. The forge subsystem generates specialized geometry and fabrication output.
• BIM_COBOL/src/main/java/com/bim/cobol/BimCobolVerbExecutor.java
• BIM_COBOL/src/main/java/com/bim/cobol/VerbRegistry.java
• BIM_COBOL/src/main/resources/META-INF/services/com.bim.compiler.dsl.VerbExecutor
• BIM_COBOL/src/main/java/com/bim/cobol/forge/ForgeEngine.java
Ingestion, export, and 2D deliverables
IFCtoBOM reads extracted IFC data, applies YAML classification, builds discipline/structural/scope BOMs, validates them, and can emit ERP-facing data. Core output supports IFC and BOM export. A separate 2D pipeline derives scoped drawing sheets and DXF; the legacy/parallel 2D_Layout module also produces SVG/DXF from SQLite metadata.
• IFCtoBOM/src/main/java/com/bim/ifctobom/IFCtoBOMPipeline.java
• IFCtoBOM/src/main/resources/classify_sh.yaml
• DAGCompiler/src/main/java/com/bim/compiler/export/IFCExporter.java
• DAGCompiler/src/main/java/com/bim/compiler/drawing2d/pipeline/DrawingPipeline.java
• 2D_Layout/src/main/java/com/bim/layout/DrawingWriter.java
Assurance, comparison, and operational interfaces
Validation is layered: compiler validators check geometry, catalog, placement, clashes, and building-level constraints; BIMEyes independently runs tiered geometric/relational proofs and shape comparisons. Bonsai Designer exposes incremental compilation and placement validation over TCP/WebSocket; Back Office exposes HTTP reporting, portfolio, and federation functions. These are integration-facing applications, not the central compiler runtime.
• DAGCompiler/src/main/java/com/bim/compiler/validation/building/ValidatorChain.java
• BIMEyes/src/main/java/com/bim/eyes/proof/EyesProofRunner.java
• BonsaiBIMDesigner/src/main/java/com/bim/designer/api/DesignerServer.java
• BIMBackOffice/src/main/java/com/bim/backoffice/server/BackOfficeServer.java
Browser and ERP-related delivery
The repo retains deployable browser snapshots under deploy/: static HTML/JS, Three.js, sql.js WebAssembly, service workers, and per-building SQLite files enable local-first viewing, import, rendering, 2D, and analytics without a backend API. Production infrastructure is static hosting/nginx and Oracle Object Storage. Separately, JavaScript ERP experiments implement a signed append-only operation-log fold and adapters/oracles for iDempiere/Odoo/SAP semantics.
• deploy/dev/index.html
• deploy/dev/loader.js
• deploy/nginx.conf
• build/erp/erp_engine.js
• scripts/erp_kernel.js
Main entry points: BOMBuilder.java BOM Hierarchy · CompilationPipeline.java Compilation Pipeline · BimCobolVerbExecutor.java COBOL Verb Executor · BuildingCompiler.java Building Compiler
Components 21
Compiler Core
Intent DSL compilation and model construction.
- Compiler CLI
DAGCompiler/src/main/java/com/bim/compiler/cli/BuildingCompilerCLI.java - Building Compiler
DAGCompiler/src/main/java/com/bim/compiler/dsl/BuildingCompiler.java - Compilation Pipeline · Stages share a compilation context.
DAGCompiler/src/main/java/com/bim/compiler/dsl/CompilationPipeline.java - BOM Hierarchy · Assemblies and catalog-qualified components define the building.
DAGCompiler/src/main/java/com/bim/compiler/bom/BOMBuilder.java - Component Library
DAGCompiler/src/main/java/com/bim/compiler/library/ComponentLibrary.java - Component Database · Append-only migrations maintain durable interchange data.
library/component_library.db - Geometry & Placement · Builds geometry and validates placement.
DAGCompiler/src/main/java/com/bim/compiler/geometry/GeometryEngine.java - MEP System Graph
DAGCompiler/src/main/java/com/bim/compiler/system/MEPSystem.java - Compiler Validation · Checks geometry, catalog, placement, clashes, and constraints.
DAGCompiler/src/main/java/com/bim/compiler/validation/building/ValidatorChain.java
Verb & Fabrication
Pluggable domain verb execution.
- COBOL Verb Executor · Executes registered model-mutating domain verbs.
BIM_COBOL/src/main/java/com/bim/cobol/BimCobolVerbExecutor.java - Verb Registry
BIM_COBOL/src/main/java/com/bim/cobol/VerbRegistry.java - Route Registry
BIM_COBOL/src/main/java/com/bim/cobol/geometry/DisciplineRouteRegistry.java - Forge Engine
BIM_COBOL/src/main/java/com/bim/cobol/forge/ForgeEngine.java
Ingestion & Deliverables
IFC intake and downstream outputs.
- IFC-to-BOM Pipeline · Classifies extracted IFC data into validated discipline and scope BOMs.
IFCtoBOM/src/main/java/com/bim/ifctobom/IFCtoBOMPipeline.java - IFC & BOM Export
DAGCompiler/src/main/java/com/bim/compiler/export/IFCExporter.java - 2D Drawing Pipeline
DAGCompiler/src/main/java/com/bim/compiler/drawing2d/pipeline/DrawingPipeline.java
Assurance & Apps
Independent proof and integration-facing applications.
- BIMEyes Proofs · Runs tiered geometric, relational, and shape-comparison proofs.
BIMEyes/src/main/java/com/bim/eyes/proof/EyesProofRunner.java - Bonsai Designer · Provides incremental compilation and placement validation.
BonsaiBIMDesigner/src/main/java/com/bim/designer/api/DesignerServer.java - Back Office · Provides reporting, portfolio, and federation functions.
BIMBackOffice/src/main/java/com/bim/backoffice/server/BackOfficeServer.java
Browser & ERP
Static local-first delivery and ERP experiments.
- Local-first Browser Viewer · Uses bundled SQLite, Three.js, WASM, and service workers.
deploy/dev/index.html - ERP Operation Log · Signed append-only operation-log fold with ERP adapters.
build/erp/erp_engine.js
Connections 23
- Compiler CLI → Building Compiler: invokes
- Building Compiler → Compilation Pipeline: runs
- Compilation Pipeline → BOM Hierarchy: builds
- Compilation Pipeline → Geometry & Placement: constructs
- Compilation Pipeline → MEP System Graph: models
- Compilation Pipeline → COBOL Verb Executor: dispatches verbs
- BOM Hierarchy → Component Library: resolves components
- Component Library → Component Database: reads catalog
- Geometry & Placement → Compiler Validation: validated by
- BOM Hierarchy → Compiler Validation: validated by
- COBOL Verb Executor → Verb Registry: loads verbs
- COBOL Verb Executor → Route Registry: routes MEP
- Route Registry → MEP System Graph: constructs routes
- COBOL Verb Executor → Forge Engine: invokes fabrication
- IFC-to-BOM Pipeline → BOM Hierarchy: produces BOM
- BOM Hierarchy → IFC & BOM Export: exports
- BOM Hierarchy → 2D Drawing Pipeline: derives sheets
- Compiler Validation → BIMEyes Proofs: independent proof gate
- Bonsai Designer → Building Compiler: incremental compile
- Bonsai Designer → Geometry & Placement: placement checks
- Back Office → BOM Hierarchy: reports on
- Local-first Browser Viewer → Component Database: loads building SQLite
- ERP Operation Log → IFC-to-BOM Pipeline: ERP-facing output