erde-lang / erde

A programming language that compiles to Lua.
https://erde-lang.github.io
MIT License
39 stars 4 forks source link

Add bitexpr + deprecate bitlib #40

Closed bsuth closed 1 month ago

bsuth commented 1 month ago

This PR introduces bitexpr, which is similar to bitlib except it allows arbitrary expressions instead of only require names. It is strictly more powerful than bitlib, hence why bitlib has been marked as deprecated in favor of bitexpr.

bitexpr is settable both via the CLI (--bitexpr) and programmatically via the compile options:

erde --bitexpr "require('bit')" compile myfile.erde
local erde = require('erde')

erde.compile("...", {
  bitexpr = "require('bit')",
})

Closes https://github.com/erde-lang/erde/issues/38

bsuth commented 1 month ago

@wauterboi do you mind if i ask you to check this out and see if it suffices? this should be enough to close https://github.com/erde-lang/erde/issues/38 but just want to double check first :eyes:

wauterboi commented 1 month ago

Sorry for the wait. Based on a cursory test, it looks like it compiles exactly as I would expect it to. This is great. I think this is good to go.