<< lib/cpu/SLFrontendJava.sleela SLeeLa Standard Library Definition. Definition: Defines SLFrontendJava — the Java frontend. Java is already compiled to JVM bytecode by javac, so this frontend lowers from that stack-based bytecode to the common SLIR: bytecode locals become IR temporaries, the operand stack is linearized into three-address IR, invokestatic/invokevirtual become IR_PARAM/IR_CALL, and System.out writes lower to a syscall. SCOPE NOTE: a full classfile reader (constant pool, all ~200 bytecodes, verification) is a project of its own; this models the canonical bytecode-to-IR lowering and demonstrates one complete lowering. The IR and backend are shared with the other languages. Family: cpu. Extends SLFrontend. >> #sleela 2.5 material; class SLFrontendJava extends SLFrontend { < ---- 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 = 10221; 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; } void init(String path) { configure("java", LANG_JAVA, path); } < Model lowering of JVM bytecode for the CANONICAL equivalence program: > < static void main(String[] a){ int x = 2 + 3; System.out.write(x); } > < Bytecode: iconst_2; iconst_3; iadd; istore_1; iload_1; invokevirtual. > < The bytecode's operand stack is linearized into SSA temporaries; the > < computed value (x = 2 + 3) matches every other frontend so the languages > < are 1:1 in Turing effect once reduced to the Sleela opcode substrate. > SLIR lower() { SLIR m = intermediate(); SLIRInstruction k = new SLIRInstruction(); < iconst_2 pushes > int s2 = m.allocTemp(); < iconst_3 pushes > int s3 = m.allocTemp(); < iadd -> istore_1 (local var x) > int x = m.allocTemp(); m.emit(k.IR_CONST, s2, -1, -1, 2); m.emit(k.IR_CONST, s3, -1, -1, 3); < iadd; istore_1 > m.emit(k.IR_ADD, x, s2, s3, 0); < iload_1; invokevirtual write > m.emit(k.IR_SYSCALL, -1, x, -1, 0); < return -> SYS_EXIT > m.emit(k.IR_SYSCALL, -1, -1, -1, 4); m.emit(k.IR_HALT, -1, -1, -1, 0); return m; } }