This profile might be incomplete.
Open on hachyderm.io notgullWebsite:
GitHub:
Personal infoAbout:
Open-source programmer and SCP author. Also known as notgull, Saltbag and EelRemoval. All opinions are my own and not my employer's.
Wall 8 posts
⚠️ BIG DOZER NEWS ⚠️ Dozer, my Rust compiler written in C, just compiled its first "hello world" application! Thanks to the power of "linking to libc" we can now print "hello world" to the console! This is a start. Next I want to get traits and generics working. Sorry for the lack of updates for the past few weeks. It's been a little weird for me. Anyways, function calls now work in dozer. Some weirdness with this: the way I do expressions is that every expression gets a variable slot. So I first encounter the function pointer (add_two_numbers), put that into a QBE temporary, then call it with the later arguments. I was worried that this would cause issues, but it looks like QBE is able to optimize it down to just calling the global. Which is nice!
Show previous comments
@notgull Good luck! How much have you looked into the implementation of a trait solver, out of interest? I'll bet that's likely going to be the most complex element of the project. 🚨 BIG NEWS 🚨 Dozer has now compiled its first Rust program! Granted, all it does is tokenize it, do some basic parsing, and the emission code only handles integer literals and doesn't handle signatures that aren't "() -> i32". But what is just compiled is basically valid Rust. Only one way to go from here! rustc, here I come! @notgull for C, I'd recommend using meson as your build system. It's super ergonomic, has a lot of useful features and can be really fast OOTB Check it out! My Rust compiler written in C (now called "dozer") just parsed its first function! I’m trying to think ahead as to how I want to do the expansion phase (e.g. macros, cfg directives, external modules). I’m thinking that it should be reasonable to do it at the same time I’m doing parsing, right? Since it’s just yielding tokens from other files/directives. Haters in shambles! My Rust compiler (written in 100% C with no extensions) can now parse basic expressions. @notgull I've been thinking cutting the chains off to LLVM and hook the AST business to binaryen for specialist wasm use-case - involving multi-memories - How difficult .. or enjoyable lol ^o^ .. did you find doing the AST bit in C without hooking to the comp internal crate that does the AST via FFI ? A while back I said it would be really nice for bootstrapping if there was a Rust compiler or interpreter written in C. Of course, that would be ridiculous. But it’s worth trying. I’ve written a tokenizer for Rust in pure C. I’ve tested it on a few Rust crates and it seems to work. Now moving on to the syntax tree parser. Effectively rewriting the syn crate in C, with no real tools (no yacc!). I’ll probably give up on this eventually, but let’s see how far I can push it. @notgull Doesn’t Rust have its own bootstrapping compiler, which uses a non-safety checked subset of Rust or something like that? You could target that in portable C and then have that as your C bootstrapper compiler perhaps My goal is that it should be possible to bootstrap a working copy of rustc using nothing but a basic C compiler (I'm targeting cproc and tinycc) as well as a basic shell interpreter (Kaem). This would mean Rust can be introduced at a very early point in the Live Bootstrap process. |