<< lib/xlt/examples/compile-xlt-models.sleela A runnable SLeeLa document driving the XLT compiler: it builds the source model an .xlt sheet declares (as the native .xlt parser would populate it), compiles it with SLXltCompiler, and prints the two possible outcomes — (1) SUCCESS + an ordered list of what was built, and (2) a CONGRUENCE report of why a model could not be built. Mirrors examples/epyc-ddr2.xlt (the declarative sheet) and the SST compile flow, without any new keyword or setter surface — the orthogonal document is the whole contract. >> #sleela 2.5 material; class CompileXltModelsExample { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 11100; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-16"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 7; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } void main() { SLXltCompiler xlt = new SLXltCompiler(); xlt.configure(); < ---- Model 1: the congruent EPYC + DDR2 model (epyc-ddr2.xlt) ---- > SLXltSource m1 = new SLXltSource(); m1.configure("examples/epyc-ddr2.xlt", "/lib"); m1.setModelName("EpycWithDdr2"); m1.declareCpu("SLAMDEPYC9575F"); m1.declareMemory("ddr2_800", 4096); m1.declareCadence("DDR2"); m1.declareStorage("nvmeGen4"); m1.declareBus("pci33"); < native GPU compute > m1.declareGpu(); < DMA bulk engine > m1.declareDma(); < NATIVE_RAM feature bit > m1.declareNativeRam(); < run on the built CPU > m1.declareProgram("examples/hello.sleela", "sleela"); < under this resource grant > m1.declareGrant(65536, 1000000); SLXltBuildResult r1 = xlt.compile(m1); printResult(r1); if (r1.programRan()) { print(" program output on the built CPU -> " + r1.output()); } < ---- Model 2: NON-congruent — 8-channel memory on a 4-channel board ---- > < Shows the "part not agreeable to design" congruence, plus a missing part. > SLXltSource m2 = new SLXltSource(); m2.configure("examples/bad-model.xlt", "/lib"); m2.setModelName("MismatchedRig"); m2.declareCpu("SLAMDThreadripper9980X"); < 4-channel HEDT board > m2.declareBoard("trx50"); < needs 8 channels -> disagrees > m2.declareMemory("ddr5_6400_octaChannel", 32768); < not a known bus -> missing > m2.declareBus("pcieGenX"); SLXltBuildResult r2 = xlt.compile(m2); printResult(r2); } void printResult(SLXltBuildResult r) { print("=== XLT model '" + r.model() + "' ==="); if (r.built()) { print("BUILD SUCCESS — built " + r.builtLines() + " parts:"); int i = 0; while (i < r.builtLines()) { print(" + " + r.builtLine(i)); i = i + 1; } } else { print("NOT BUILT — congruence report (" + r.reasonLines() + " issue(s)):"); int i = 0; while (i < r.reasonLines()) { print(" ! " + r.reasonLine(i)); i = i + 1; } print(" (built-so-far list had " + r.builtLines() + " agreeable part(s))"); } } }