<< lib/cpu/SLCompilerDriver.sleela SLeeLa Standard Library Definition. Definition: Defines SLCompilerDriver — the multi-language compiler driver. It selects the right frontend for a source language (C, C++, Java, Sleela), runs frontend -> SLIR -> SLLowering, and returns a runnable SLProgram for the Sleela CPU. This is the single entry point that makes the ISA accept all four languages: one driver, one IR, one backend. source(.c/.cpp/.java/.sleela) -> SLFrontend{C,Cpp,Java,Sleela}.lower() -> SLIR -> SLLowering.lower() -> SLProgram (SLInstructionSet machine code) Family: cpu. Composes the frontend hierarchy, SLIR, SLLowering, SLProgram. >> #sleela 2.5 material; class SLCompilerDriver { < ---- 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 = 10208; 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-06"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < 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; } SLInstructionSet isa; int lastLanguage; < the operating point stamped into compiled output > SLTimingProfile profile; void configure(SLInstructionSet instructionSet) { isa = instructionSet; lastLanguage = -1; profile = null; } < Give the driver a timing/voltage/expertise profile. Every program it > < compiles from here on carries that profile's sealed manifest, so the VM > < and loader operate the STATED timings rather than guessing hardware > < quality. Without a profile, output compiles exactly as before (no header). > void useTimingProfile(SLTimingProfile p) { profile = p; } < Build the appropriate frontend for a language id. > SLFrontend frontendFor(int langId, String path) { if (langId == 1) { SLFrontendC f = new SLFrontendC(); f.init(path); return f; } if (langId == 2) { SLFrontendCpp f = new SLFrontendCpp(); f.initCpp(path); return f; } if (langId == 3) { SLFrontendJava f = new SLFrontendJava(); f.init(path); return f; } SLFrontendSleela f = new SLFrontendSleela(); f.init(path); return f; } < Infer the language from a file extension. > int languageOf(String path) { if (endsWith(path, ".c")) { return 1; } if (endsWith(path, ".cpp") || endsWith(path, ".cc") || endsWith(path, ".cxx")) { return 2; } if (endsWith(path, ".java") || endsWith(path, ".class")) { return 3; } < .sleela / default > return 0; } boolean endsWith(String s, String suffix) { int sl = length(s); int fl = length(suffix); if (fl > sl) { return false; } return substring(s, sl - fl, sl) == suffix; } int length(String s) { return native sleela_str_length(s); } String substring(String s, int a, int b) { return native sleela_str_substring(s, a, b); } < Compile a source file in the given language into a runnable SLProgram. > SLProgram compile(String path, int langId, String programName) { lastLanguage = langId; SLFrontend fe = frontendFor(langId, path); fe.parse(); SLIR ir = fe.lower(); SLProgram prog = new SLProgram(); prog.configure(programName, 4096); SLLowering backend = new SLLowering(); backend.configure(isa, prog, ir); backend.lower(); < Stamp the stated operating point into the compiled image so downstream > < consumers honor declared timings instead of assuming hardware quality. > if (profile != null) { prog.attachTiming(profile.toManifest()); } return prog; } < Convenience: infer language from the path extension. > SLProgram compileFile(String path, String programName) { return compile(path, languageOf(path), programName); } int language() { return lastLanguage; } }