Befunge
stage0
Our great sponsors
Befunge | stage0 | |
---|---|---|
5 | 22 | |
18 | 869 | |
- | - | |
3.5 | 3.9 | |
6 months ago | about 2 months ago | |
JavaScript | Assembly | |
- | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Befunge
-
The Rust Performance Book
1. C compilers don't do a good job, & thus even CPython, which has historically stuck to rather vanilla C, uses computed goto, as described in https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e...
I resorted to similar techniques in optimizing Befunge: https://github.com/serprex/Befunge (See bejit.c & marsh.c/marsh.h)
2. Rust enums are not variable sized, think of them as tagged C unions, where the Rust compiler can sometimes apply tricks to make Option> the same size as Vec
3. match can specialize for straight forward cases, when in doubt use https://godbolt.org
- Ask HN: Recommendation for general purpose JIT compiler
-
Why asynchronous Rust doesn't work
I've found async to be straight forward anytime I've used it. Promise#then is equivalent to callbacks
async/await often requires very little changes compared to synchronous code, whereas reworking a program into callbacks is much more impactful. & the async/await compilation process tends to produce better performance in addition to this. My first async/await work was a few years ago to increase a data importer's performance by an order of magnitude compared to the blocking code
Here's an example where looping made for a callback that recursively called, using async/await I get to use a plain loop:
before: https://github.com/serprex/Befunge/blob/946ea0024c4d87a1b75d...
after: https://github.com/serprex/Befunge/blob/9677ddddb7a26b7a17dd...
I don't see why people find it so complicated to separate begin-compute & wait-on-compute
I've since rewritten a nodejs game server into rust, https://github.com/serprex/openEtG/tree/master/src/rs/server... handleget/handlews are quite straight forward
- Python interpreter written in rust reaches 10000 commits
-
Compilers Are Hard
You'll also find them used in CPython's ceval.c
I use them in both my C befunge implementations:
https://github.com/serprex/Befunge/blob/c97c8e63a4eb262f3a60...
https://github.com/serprex/Befunge/blob/c97c8e63a4eb262f3a60...
stage0
- Running the "Reflections on Trusting Trust" Compiler
- Goodbye to the C++ Implementation of Zig
-
Nixpacks takes a source directory and produces an OCI compliant image
Somewhat tangential, but I'm curious how big the bootstrap seed for Nix is. That is, if you wanted to build the entire world, what's a minimum set of binaries you'd need?
Guix has put quite a bit of work into this, AFAIU, and it's getting close to being bootstrappable all the way from stage0 [0]. Curious if some group is also working on similar things for Nix.
-
Common libraries and data structures for C
Even if they aren't, people absolutely should be able to bootstrap new platforms from scratch. It's important to have confidence in our tools, in our ability to rebuild from scratch, and to be safe against the "trusting trust" attack among other things.
Lately I've been catching up on the state of the art in bootstrapping. Check out the live-bootstrap project. stage0 starts with a seed "compiler" of a couple hundred bytes that basically turns hex codes into bytes while stripping comments. A series of such text files per architecture work their way up to a full macro assembler, which is then used to write a mostly architecture-independent minimal C compiler, which then builds a larger compiler written in this subset of C. This then bootstraps a Scheme in which a full C compiler (mescc) is written, which then builds TinyCC, which then builds GCC 4, which works its way up to modern GCC for C++... It's a fascinating read:
https://github.com/oriansj/stage0
https://github.com/fosslinux/live-bootstrap/blob/master/part...
Even if no one is "using" this it should still be a primary motivator for keeping C simple.
- A minimal C compiler in x86 assembly
- My boundaries as an open source developer
-
Bitcoin v22.0 and Guix; Stronger defense against the "Trusting Trust Attack"
Stage0 Project
- Trojan Source: Invisible Vulnerabilities
-
Trustworthy Computing in 2021
It's great to see that more people are still working on this and that people have an interest.
If you are interested in this kind of thing, then you'll also want to check out LibreBoot[1] and Bootstrappable Builds[2]. The latter is working with stage0 [3] and mes [4] to bootstrap Guix (among other projects.) All of that is further down the chain, but we'll need it if we want to build trustworthy systems.
2. https://www.bootstrappable.org
-
[Rust advocates] demean software that's not memory safe the way that politicians use their words to sow anger. C has won, and Rust blew it's shot aiming at C++ instead.
Bootstrap compiler != PL compiler. See also stage0. Compiler can be cross-compiled to architectures, whereas a bootstrap compiler can not. For other differences see the stage0 repository.
What are some alternatives?
rizin - UNIX-like reverse engineering framework and command-line toolset.
arocc - A C compiler written in Zig.
chibicc - A small C compiler
libcperciva - BSD-licensed C99/POSIX library code shared between tarsnap, scrypt, kivaloo, spiped, and bsdiff.
bug - Scala 2 bug reports only. Please, no questions — proper bug reports only.
c4 - C in four functions
swc - Rust-based platform for the Web
sc - Common libraries and data structures for C.
pkgconf - package compiler and linker metadata toolkit
ubpf - Userspace eBPF VM
qbe-rs - QBE IR in natural Rust data structures
Rustler - Safe Rust bridge for creating Erlang NIF functions