💾 Archived View for republic.circumlunar.space › users › dbane › gemlog › 2021-09-27.gmi captured on 2023-07-10 at 14:21:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Hardened Interpreters, Beyond C

As I wrote previously, I'm quite happy with the EISL interpreter by now. It's somewhat useful in my daily life. However, the implementation is about as reliable as I know how to make it in C. This led me to look into alternatives to C. My previous post was about Oberon.

OBNC (Oberon Compiler) Home Page

I learned Ada a long time ago, and that was the first place I looked. However, the M1 Mac architecture isn't well-supported here. I also remembered the Cyclone research project, which was closer to C but won't work on modern computers.

Cyclone

Rust

Rust Programming Language

Both Ada and Cyclone are often mentioned in the same context as Rust. I had half-followed the development of this language for a long time, but didn't think it had the critical mass to make it worthwhile learning. That seems to be changing now. Arguably, it's not a massive improvement over Ada technically, but for whatever reason it has acquired significant industrial support which may be more important.

So I started reading the Rust book, and reading some source code. I've got to the stage where I can read most source code I see, and write simple stuff myself now. But there's a long way to go.

The Rust Programming Language

For the area that I've been playing with for the past while, language interpreters, there is actually quite a lot of reusable foundation code. The "Crafting Interpreters" book seems popular, although using wasm as a backend may be a better choice for real-world. Both of these have code you could start from. Or there is the option of starting from the other end, and adapting Sasagawa-san's FAST compiler to emit wasm s-expression form.

"Writing Interpreters in Rust: a Guide"

Rust implementation of the Lox programming language

This may all be a bit premature though. In summary, it looks like Rust is finally worth learning. And so far, I've been reasonably impressed with the language. However, I wonder how people who haven't specialized in software will get along. In particular, I'm thinking of the C code I've seen written by hardware engineers in the past, which would need significant redesign to just compile. Honestly, there probably is no alternative by now. With the payment channel provided by cryptocurrency to ransomware companies, writing code in unsafe languages is like juggling hand grenades by now.

Oberon & Conclusion

My previous post was about Oberon instead. I think Rust is now worth learning for $DAYJOB, but for personal/hobby low-level programming I'd still probably prefer Oberon. As is often the case, this is largely a matter of taste.

Back to my gemlog