asoffer / Icarus

An experimental general-purpose programming language
Apache License 2.0
9 stars 2 forks source link

Icarus bazel rules #38

Closed asoffer closed 2 years ago

asoffer commented 3 years ago

Add bazel rules for Icarus. Ideally the rule could either run the compiler or the interpreter based on flags, but I'd settle for a starlark macro that generates two rules

asoffer commented 2 years ago

Thinking a bit more about this design, I think bazel rules for libraries should default to building serialized intermediate representations. And we can use Bazel Aspects to generate .o files on request. Binaries should default to building the actual binary. It'd be nice to have a way to only build serialized IR (and link and interpret) at this level.

Rules certainly need srcs and deps, but we also want to distinguish some dependencies as compile-time only. This is probably a separate attribute named something like compilation_deps. In theory runtime only dependencies are also possible, but I'm not sure how important this is to codify; these dependencies still need to be declared at compile-time and if you attempt to use them but they can't be found, you'll still get compile-time errors.

asoffer commented 2 years ago

There's always more to do here, but we have these working.