Skip to content

Implement various stuff #1

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Implement various stuff #1

wants to merge 4 commits into from

Conversation

ahmed605
Copy link

@ahmed605 ahmed605 commented Aug 22, 2025

Moved from: bext-lang/b#240

I want to first apologize for the second time for the size of this PR, I know this is bad and I know I was told to keep it small, I really tried to split this into multiple PRs but couldn't figure out the best way to do that since most of stuff depend on each others and each part alone isn't useful in any way (as in doesn't make any more examples run on its own), so I'm really really really sorry for that, and I really hope I'm not annoying you with that in any way.

List of changes:

  • run ilasm_mono executables directly on Windows, skipping mono, this will make the executable run via .NET Framework 4.x which is equivalent to Mono
  • added .NET Core (ilasm-core) target, including emitting runtimeconfig.json files, both ilasm-core and ilasm-mono share the same backend code, ilasm-core emits a dll rather than an exe due to ilasm emitting wrong .NET version (hardcoded?) in the PE metadata resulting in it loading the wrong runtime when ran directly
  • implemented data sections for ilasm (rather than direct string literals) to match other backends
  • implemented external functions support (currently only supports external functions of dynamic libraries and not static ones), libc is linked by default
  • implemented variadic functions support (including on macOS ARM64)
  • implemented the following libb functions: usleep (because Windows), and char
  • implemented the following opcodes: Op::Index, Op::Store, Op::Return, and Op::ExternalAssign
  • implemented the following binops: Binop::Mult, Binop::NotEqual
  • implemented the following arg types: Arg::Deref, Arg::External, Arg::RefExternal
  • implemented global variables (including arrays), arrays are currently implemented using malloc in the static constructor of Program for all cases, maybe in the future consider using data sections in cases where all values are immediate values
  • implemented Op::UnaryNot and Op::Negate (by @failaip12)
  • implemented rest of binops (by @failaip12)

These changes resulted in making the following examples compiling and running:

  • mandelbrot
  • name
  • duffs_device
  • rule110
  • game_of_life
  • langtons_ants
  • fib
  • raylib
  • brainfck
  • snake (only on Linux/Unix)

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

Successfully merging this pull request may close these issues.

1 participant