Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build system proposal #1280

Open
alex-s168 opened this issue Feb 21, 2025 · 1 comment
Open

build system proposal #1280

alex-s168 opened this issue Feb 21, 2025 · 1 comment

Comments

@alex-s168
Copy link
Contributor

I want the build system to be extremely extensible, and also work for LM unrelated projects.

Important features that I want integrated:

  • there should be a LM library / project hub, from which the projects are downloaded
  • if the project is already installed locally, then it doesn't download from there!!
  • the LM compiler itself, and related plugins should be libraries / projects too
  • documentation generation for LM can just be a LM AST consumer plugin

projects provide tasks which are kinda like functions. Functions also take in settings and information about the project, like description and others.
For example:

  • LM stdlib has lm-std::lib() -> lm::AST and lm-std::docs() -> lm-doc::Docs (it just provides the AST and docs of the lib)
  • LSTS frontend has: lm-lsts::parse(File) -> lm::AST
  • LM frontend has: lm-lm::parse(File) -> lm::AST
  • C frontend has: lm-c::parse(File) -> lm::AST
  • LM documentation generator has: lm-doc::gen(lm::AST) -> lm-doc::Docs, lm-doc::parse-md(File): lm-doc::Docs, lm-doc::combine(Vector<lm-doc::Docs>), lm-doc::render2md(lm-doc::Docs) -> File, and lm-doc::render2html(lm-doc::Docs) -> File
  • the core LM compiler has lm::combine(Vector<lm::AST>) -> lm::AST, lm::compile(lm::AST) -> lm::Compiled
  • C backend has: lm-emitc::emit(lm::Compiled) -> File
  • cc has: cc::c2o(File) -> File
  • LM vxcc backend has: lm-vxcc::emit(lm::Compiled) -> vxcc::IR
  • vxcc backend has: vxcc::ir2ir(vxcc::IR) -> vxcc::IR, vxcc::ir2asm(vxcc::IR) -> File, and vxc::ir2o(vxcc::IR) -> File
  • binutils has: bin::ar(Vector<File>) -> File, bin::link2exe(Vector<File>) -> File, bin::link2shared(Vector<File>) -> File
  • lm-backend unifies all the LM backends that generate object files: lm-backend::compile(lm::Compiled) -> File
  • lm-publish allows you to easily publish your project to either the project hub and / or to the local repository: lm-publish::publish()
  • glob: glob::glob(String) -> Vector<File>

then when you are building a project like a JSON parser, you can do this in your project file:

let project = Project {
  name: "json",
  version: "1.0.0",
  author: "name <email>"
  description: "Parse JSON to LSTS SerialVal",
  depends: [
    "glob",
    "lm-std",
    "lm", "lm-lsts", "lm-doc", "lm-publish"
  ]
};

let src(): Vector<File> = (
  glob::glob("src/*.lsts")
);

let lib(): lm::AST = (
  lm::combine(lm-std::lib(), src().map(lm-lsts::parse))
);

let docs(): lm-doc::Docs = (
  lm-doc::combine([
    lm-doc::parse-md(glob::glob("docs/*.md")),
    lm-doc::gen(lib())
  ])
);

# publish all exposed functions (`src`, `lib`, and `docs`)
lm-publish::publish();

still left to decide:

  • should use LSTS for build scripts?, if yes, need module support first
  • how caching works
  • everything else
@andrew-johnson-4
Copy link
Owner

"doby" yeah, I want this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants