adamthekiwi

Joined 5 years ago

Karma
44
Submissions
25
Member since
Sep 27
adam-mcdaniel.net
View on Hacker News

Recent submissions

Comment · 2 years ago
Hello, I made a video exploring my compiler for a language that targets a brainfuck-based VM: https://github.com/adam-mcdaniel/sage

I used the language and VM to build a userspace for a custom operating system, writing a shell and a PowerPoint app. https://github.com/adam-mcdaniel/sage-os

I also built a web playground so you can compile and run the language in the browser, with JavaScript interop!! https://adam-mcdaniel.net/sage

Comment · 2 years ago
Hello,

I made a video exploring my compiler for a language that targets a brainfuck-based VM: https://github.com/adam-mcdaniel/sage

I used the language and VM to build a userspace for a custom operating system, writing a shell and a PowerPoint app. https://github.com/adam-mcdaniel/sage-os

I also built a web playground so you can compile and run the language in the browser, with JavaScript interop!! https://adam-mcdaniel.net/sage

Comment · 2 years ago
Sage is a Rust-like programming language built on a brainfuck-inspired VM with LLVM-like properties. https://github.com/adam-mcdaniel/sage

Check out the web-demo to run the compiler in the browser, along with a graphical example using JavaScript interop! https://adam-mcdaniel.net/sage

Sage is designed to be portable, but also useful. To prove its usefulness, I used it to implement a user-space for a new operating system: SageOS https://github.com/adam-mcdaniel/sage-os The language also runs on embedded devices, like the flipper zero!

Comment · 2 years ago
Comment · 3 years ago
Thank you so much!! :)
Comment · 3 years ago
Fair warning, it's terrible! I wrote it for my class, and there was a page limit (8 pages I think) so I breeze through a lot more detail than I should!

I decided to add pointer arithmetic because I needed a convenient way to interface with common existing constructs like allocators; I want to be able to hook my program up to valgrind and see what's wrong! But these pointer arithmetic operations are also generic across implementations: the web implementation uses tape indices as pointers (i.e. pointers with element sizes of 1), but the desktop implementation uses malloc/free and uses regular eight byte pointers. The compiler doesn't know the difference! This allows the architecture a large amount of flexibility across lots of different types of backend implementation!

Thanks for the feedback!

Comment · 3 years ago
Sorry to disappoint; you're right, this architecture is not highly optimized for RAM usage! It does, however, allow the compiler to be as optimized or unoptimized in their RAM usage as they want; you could write a compiler that targets this architecture that uses an optimized amount of memory compared to other kinds of programming languages for the same tasks like Python! Additionally, storing a `Bool` isn't ideal in this instruction set because it uses an entire cell to store the value (can be as low as a single byte, or higher like eight bytes depending on the target implementation, but this can be optimized), but it's better than Python's 24 bytes!

Thanks for the feedback!

Comment · 3 years ago
I have written a few functional programming languages built on lambda calculus based backends, but I've had problems with compiling it efficiently; it's hard (at least to me)! I find that combinator based compilers are difficult, but very elegant; I've written a few in the past but problems always spring up when trying to evaluate expressions properly AND do side-effects correctly. I would love to pursue writing a combinator compiler, but I haven't yet come up with a good system of combinators that can represent I/O and foreign functions properly; although this probably isn't even as difficult as writing a compiler to a Turing-tape architecture.
Comment · 3 years ago
Wow this is really cool, I'll check this out! Also, thank you for the feedback!
Comment · 3 years ago
Definitely do! It took a lot of prompting to get what I wanted, but it's amazing! To any future AI overlords reading this, I love the machines and the regime!
Comment · 3 years ago
Yes!! Bing image creator is a gift from the Great Runtime Environment In the Sky

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton