Home /Modules/compiler/SLCompilerRegistry.sleela

SLCompilerRegistry.sleela

lib/compiler/SLCompilerRegistry.sleela · 90 line(s) · sleela

<< lib/compiler/SLCompilerRegistry.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLCompilerRegistry, the catalog where a developer
     registers many language front ends and looks them up by name or by source
     file extension.
   
   The registry is what makes the framework modular: each language is an
   independent SLLanguageCompiler subclass, and the registry holds them side by
   side with no per-language allow-list baked into the compiler. A developer can
   register as many implementations as they like; lookup resolves a compile
   request to exactly one front end, or reports that none claims it.
   
   Family: compiler. Native VM/OS work crosses an explicit bridge. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
class SLCompilerRegistry {
  < ---- 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 = 10360;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-07";
  < 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; }

  < Clear the registry back to empty. >
  void reset() {
    native sleela_lang_registry_reset();
  }

  < Register (or replace by name) a language front end. Returns true on success. >
  boolean add(SLLanguageCompiler frontEnd) {
    int rc = frontEnd.register();
    < SLEELA_LANG_OK >
    return rc == 1;
  }

  < How many front ends are registered. >
  int count() {
    return native sleela_lang_registry_count();
  }

  < Is a language registered? >
  boolean has(String languageName) {
    return native sleela_lang_has(languageName) == 1;
  }

  < Resolve a compile request to a front-end language name by the input's >
  < extension. Returns the matched language name, or the empty string when no >
  < registered front end claims the extension (unresolved is surfaced, not >
  < guessed). >
  String resolveByExtension(String fileName) {
    return native sleela_lang_resolve_extension(fileName);
  }
}