HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
cksystemsteaching
selfie
Jupyter Notebook2020–2024
cksystemsteaching / selfie

selfie

An educational software system of a tiny self-compiling C compiler, a tiny self-executing RISC-V emulator, and a tiny self-hosting RISC-V hypervisor.

8Distinct people
11Mentions
0Explicit recommenders
2.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

An educational software system of a tiny self-compiling C compiler, a tiny self-executing RISC-V emulator, and a tiny self-hosting RISC-V hypervisor.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2020-02-27 09:25:17 UTC to 2024-01-06 22:38:01 UTC.

02462020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC624
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202

What Hacker News says

11 sources
this sort of exists at https://github.com/cksystemsteaching/selfie (http://selfie.cs.uni-salzburg.at/) > Selfie is a self-contained 64-bit, 12KLOC C implementation of: (...) a tiny (...) subset of C called C Star (C*) (...) to a tiny (...) subset of RISC-V called RISC-U[;] a[n] (...) emulator (...) that executes RISC-U code[;] (...) a (...) hypervisor (...) that provides RISC-U virtual machines so they have a self-hosted instruction set architecture, compiler, and operating system, though the operating system is much simpler than xv6. because the instruction set is a subset of risc-v you can run its code on actual risc-v hardware (or qemu-system-riscv), but presumably you could also design risc-u hardware in verilog that was simpler than a full implementation of rv64i with whatever extensions the hypervisor needs
In Project Oberon: Design of an operating system, a compiler, and a computer [pdf]
From reading the code [1], both aren't needed; the `SIZEOFUINT64 = (uint64_t) ((uint64_t*) SELFIE_URL + 1) - (uint64_t) SELFIE_URL;` statement is the value that always ends up being used (once the library is initialized). An optimizing compiler would likely optimize the calculation away anyway. My guess is that it's predefined at the top simply for clarity and verbosity's sake (remember that this is built for educational purposes). [1]: https://github.com/cksystemsteaching/selfie/blob/5de675a0f08...
In Selfie – A tiny RISC-V C compiler, emulator and hypervisor
According to the GitHub README, selfie's emulator and hypervisor can only support programs in RISC-U, "a tiny and easy-to-teach subset of RISC-V".[1] So... not the full RISC-V ISA. For what it's worth, the selfie compiler can build RISC-U programs for you. Still a really cool project! I've been meaning to learn more about compiler backend development. I usually spend time on the frontend. [1] https://github.com/cksystemsteaching/selfie
In Selfie – A tiny RISC-V C compiler, emulator and hypervisor
From the project’s README [1]: > Selfie is implemented in a single (!) file and kept minimal for simplicity. There is also a simple in-memory linker, a RISC-U disassembler, a garbage collector, L1 instruction and data caches, a profiler, and a debugger with replay as well as minimal operating system support in the form of RISC-V system calls built into the emulator and hypervisor. The garbage collector is conservative and even self-collecting. It may operate as library in the same address space as the mutator and/or as part of the emulator in the address space of the kernel. I was a bit skeptical reading that, but I’m very impressed right now [2] . . . [1]: https://github.com/cksystemsteaching/selfie/blob/5de675a0f08... [2]: https://github.com/cksystemsteaching/selfie/blob/5de675a0f08...
In Selfie – A tiny RISC-V C compiler, emulator and hypervisor
My (tiny) CS department has a pretty nice compilers course, I thought. You work on a single, ~10k LoC file [0] that is written in a subset of C, compiles that subset to RISC-V, and also has a small VM and even a hypervisor for running the code it generates. The only thing is, the video lectures are 8 years old [1]. Though last semester, all lectures were online and anyone could join. Might be the same next spring/summer. You’d have to check the professor’s Twitter account. [0]: https://github.com/cksystemsteaching/selfie [1]: https://vimeopro.com/user12798068/university-of-salzburg-int...
In Essentials of Programming Languages

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.