r/Compilers

▲ 10 r/Compilers+10 crossposts

Ai writen language, if anyone wants to try it out~

Been a few weeks working on this, majority of it was done in like 10 days, but then life, and bugs needed fixed and feature creep, and everything. Either try it out or not, I needed something specific that I had more control over for my other projects, so now this exists.

github.com
u/gusfromspace — 13 hours ago

How do I actually become really good at compiler development? What should I do after building my first compiler?

I'm currently building my first programming language and compiler/interpreter, and I'd like to get some advice from people with more experience in compiler development. My project currently has a lexer, parser, AST, semantic analysis, and a tree-walker runtime. It is not yet a full native-code compiler, but I can already take source code from the lexer all the way to execution.

Of all the areas of software development I've explored, compiler development is the one I enjoy the most, and I want to become really good at it. I'm particularly interested in: Language design, Type systems, IRs, Optimization, Code generation, Assembly and ABIs, Runtimes, Garbage collection ,Static analysis, and Compiler architecture.

My question is, what should I actually do to get better?

Should I keep developing Cauce and progressively add more advanced features, or should I also start studying and contributing to projects like LLVM, GCC, or Clang? What projects, exercises, or areas of study do you think actually help someone move from “I know how to build a lexer/parser” to deeply understanding how compilers work?

I also want to make it clear that I don't want to use AI to generate code. I want to design, write, and debug my own projects because that's precisely the part of software development I enjoy the most. If you had to start over, what would you do to become really good at compiler development? I'm not looking for a list of books, but rather what to build, study, and practice, and in what order.

Thanks.

reddit.com
u/2006Nico — 16 hours ago

Managing Cognitive Load in Language Design: A Proposal for 7 Universal Meta-Modifiers

Hi everyone,

Programming is often a battle against the limitations of human working memory. Developers spend up to 20–30% of their time navigating syntax traps—balancing brackets, tracking task order, and maintaining context in dense blocks of code. According to Miller's Law, the human brain can comfortably hold only 5–9 items at once, yet complex codebases regularly demand much more. This overhead frequently leads to fatigue, bugs, and a steeper learning curve for beginners.

While modern languages optimize for performance through features like async/await or pattern matching, they rarely address cognitive ergonomics directly. There are few native ways to explicitly signal execution priority, time jumps, or branching logic without introducing heavy boilerplate.

To address this, we have developed a conceptual framework introducing seven universal meta-modifiers directly into a language's core parser:
$ (emphasis), | (word role), ~ (time jump), & (fork), ^ (merge), # (queue), and > / < (resource weight).

Rather than acting as simple syntactic sugar or library extensions, these symbols serve as an abstraction layer to help developers map their mental models directly to code execution. This is a theoretical proof-of-concept aimed at exploring how minor structural changes can reduce cognitive load.

The full paper and conceptual breakdown are available on Zenodo: https://doi.org/10.5281/zenodo.18841626

I would love to get your feedback on this concept. How do you approach managing cognitive load in language design? Do you think native meta-modifiers could be a viable path forward, or do they introduce too much syntactic noise?

reddit.com
u/BrilliantNo5168 — 20 hours ago

Deciding which of the following textbooks to use for compiler construction

Hello there, I'm starting a compiler construction unit for my university semester and I'm trying to decide which textbook would work best as a guide for the subject. I know this has been asked quite a lot over the years, but I'd like to know if there are other books I haven't considered yet as well or more up to date opinions on the books.

So far the top recommended books from previous threads (such as these threads: thread 1, thread 2, thread 3) I've come across are:

  • Engineering a Compiler by Keith Cooper and Linda Torczon
  • Crafting a Compiler With C by Fischer
  • Dragon Book

I am planning to build a compiler by the end of the unit, where each chapter has a small implementation lab task provided my lecturer (such as making a CFG parser for example), and I'm heavily leaning to making one in C targeting the 6502 (rather than x86).

I'm also aware that the Dragon Book is considered old and outdated, despite being the foundation of other books and compiler designers. I've seen some books like Introduction to Compilers and Language Design which use existing parsers (I think YACC, I've also seen references to FLEX and Bison), however I'd like to build everything from scratch to learn more.

Which other books would also be good? I know some people tend to read multiple books together to fill in the gaps for certain chapters, however I'm looking to order one physical copy of a book as it's easier to concentrate and make notes from.

reddit.com
u/Advanced-Theme144 — 1 day ago
▲ 19 r/Compilers+2 crossposts

I wrote an AArch64 quine as part of my AArch64/x86-64/RV64 learning journey

I'm learning assembly so I can eventually create my own IR/compiler/language.

The code is frankly ugly. I hope you find it (or my incompetence) funny:

```AArch64

.global \_start

.section .text

_start:

stp x29, x30, \[sp, #-32\]!

mov x29, sp

str x20, \[sp, #16\]

mov x13, sp

ldr x9, =0x75206e6576617265

ldr x10, =0x0a726f776f207577

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20333c20656e6975

ldr x10, =0x687465696e6e6977

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72657a2e203a6666

ldr x10, =0x712f2f0a3538206f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x37206e67696c612e

ldr x10, =0x757473657065720a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f69746365732e09

ldr x10, =0x090a7373622e206e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c70735b202c30

ldr x10, =0x0a22215d36312d23

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7473745c6e5c3032

ldr x10, =0x3178202c39782070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032303230327830

ldr x10, =0x3032303230323032

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x646c745c6e5c3032

ldr x10, =0x3d202c3031782072

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032303230327830

ldr x10, =0x3032303230323032

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c745c6e5c222069

ldr x10, =0x3d202c3978207264

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d6574657065720a

ldr x10, =0x696373612e203a70

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6e6f69746365732e

ldr x10, =0x617461646f722e20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x36783023202c3931

ldr x10, =0x090a746572090a36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962660a7465

ldr x10, =0x7720766f6d090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c39317720766f

ldr x10, =0x72090a3536783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x650a746572090a34

ldr x10, =0x6d090a3a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720766f6d090a3a

ldr x10, =0x36783023202c3931

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72090a3336783023

ldr x10, =0x65747962640a7465

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a65747962

ldr x10, =0x202c39317720766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x36783023202c3931

ldr x10, =0x630a746572090a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962620a7465

ldr x10, =0x7720766f6d090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c39317720766f

ldr x10, =0x72090a3136783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x610a746572090a39

ldr x10, =0x6d090a3a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720766f6d090a3a

ldr x10, =0x33783023202c3931

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3833

ldr x10, =0x65747962656e696e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3733

ldr x10, =0x7479626874676965

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3633

ldr x10, =0x7479626e65766573

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6572090a35337830

ldr x10, =0x7479627869730a74

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a3a657479

ldr x10, =0x23202c3931772076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72090a3433783023

ldr x10, =0x62657669660a7465

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a65747962

ldr x10, =0x202c39317720766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a333378302320

ldr x10, =0x72756f660a746572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a6574796265

ldr x10, =0x2c39317720766f6d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a323378302320

ldr x10, =0x657268740a746572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a657479626f

ldr x10, =0x2c39317720766f6d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3133783023202c39

ldr x10, =0x77740a746572090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3a65747962656e6f

ldr x10, =0x317720766f6d090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x783023202c393177

ldr x10, =0x0a746572090a3033

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626f72657a0a

ldr x10, =0x20766f6d090a3a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2e62090a66307830

ldr x10, =0x6574796266207165

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d63090a65747962

ldr x10, =0x23202c3831772070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6530783023202c38

ldr x10, =0x652071652e62090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6574796264207165

ldr x10, =0x317720706d63090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772070

ldr x10, =0x2e62090a64307830

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x632071652e62090a

ldr x10, =0x6d63090a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317720706d63090a

ldr x10, =0x6330783023202c38

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2e62090a62307830

ldr x10, =0x6574796262207165

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d63090a65747962

ldr x10, =0x23202c3831772070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6130783023202c38

ldr x10, =0x612071652e62090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962656e696e

ldr x10, =0x317720706d63090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a39

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626874676965

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a38

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626e65766573

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a37

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479627869732071

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3023202c38317720

ldr x10, =0x652e62090a363078

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6265766966207165

ldr x10, =0x706d63090a657479

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772070

ldr x10, =0x2e62090a35307830

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72756f662071652e

ldr x10, =0x6d63090a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c38317720706d

ldr x10, =0x62090a3430783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657268742071652e

ldr x10, =0x63090a6574796265

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c38317720706d

ldr x10, =0x62090a3330783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77742071652e6209

ldr x10, =0x63090a657479626f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x38317720706d6309

ldr x10, =0x0a3230783023202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2071652e62090a31

ldr x10, =0x0a65747962656e6f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720706d63090a65

ldr x10, =0x30783023202c3831

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x71652e62090a3030

ldr x10, =0x7479626f72657a20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20706d63090a3a65

ldr x10, =0x783023202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x62696e0a30232063

ldr x10, =0x7479626f74656c62

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c387820766f6d09

ldr x10, =0x7673090a33392320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x766f6d090a323323

ldr x10, =0x0a3023202c307820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x303378202c393278

ldr x10, =0x202c5d70735b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3123202c70735b20

ldr x10, =0x2070646c090a5d36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a6666757473

ldr x10, =0x2c3032782072646c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x637673090a323131

ldr x10, =0x746978650a302320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820627573090a31

ldr x10, =0x23202c3278202c32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x782072736c090a32

ldr x10, =0x23202c3278202c32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c32782062757309

ldr x10, =0x3278202c31327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3178206464

ldr x10, =0x0a33313123202c31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317820766f6d090a

ldr x10, =0x61090a323278202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a34362320

ldr x10, =0x3123202c30782076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3a7473616c746e

ldr x10, =0x2c387820766f6d09

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77646e6173207467

ldr x10, =0x6972700a31686369

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c37317820706d63

ldr x10, =0x2e62090a30327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a353823202c32

ldr x10, =0x090a302320637673

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6675747365706572

ldr x10, =0x7820766f6d090a66

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c090a3123202c30

ldr x10, =0x3d202c3178207264

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3623202c38782076

ldr x10, =0x7820766f6d090a34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x35317820766f6d09

ldr x10, =0x6f6d090a3023202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3231782064

ldr x10, =0x0a333423202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c323178202c3231

ldr x10, =0x6461090a39322320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x676e69746e697270

ldr x10, =0x7820627573090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x68636977646e6173

ldr x10, =0x656d757365720a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3123202c35317820

ldr x10, =0x20746c2e62090a36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c353178202c3531

ldr x10, =0x706d63090a312320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c5d3231785b20

ldr x10, =0x7820646461090a31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x73090a657479626f

ldr x10, =0x2c39317720627274

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c62090a66307830

ldr x10, =0x74656c6262696e20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x38317720646e6109

ldr x10, =0x23202c363177202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x785b202c39317720

ldr x10, =0x0a3123202c5d3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x79626f74656c6262

ldr x10, =0x62727473090a6574

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772c20

ldr x10, =0x696e206c62090a34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3066783023202c

ldr x10, =0x3831772072736c09

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20646e61090a312d

ldr x10, =0x363177202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c363177206272

ldr x10, =0x23202c5d3731785b

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x313278202c313278

ldr x10, =0x646c090a3123202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x68636977646e6173

ldr x10, =0x20646461090a3a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3231782062

ldr x10, =0x0a363423202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77646e617320746c

ldr x10, =0x7573090a31686369

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x35317820706d6309

ldr x10, =0x2e62090a3823202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c353178206464

ldr x10, =0x0a3123202c353178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3231785b202c3931

ldr x10, =0x61090a3123202c5d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657479626f74656c

ldr x10, =0x772062727473090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a6630783023202c

ldr x10, =0x6262696e206c6209

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20646e61090a3123

ldr x10, =0x363177202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c39317720627274

ldr x10, =0x202c5d3231785b20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x74656c6262696e20

ldr x10, =0x73090a657479626f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3831772c20383177

ldr x10, =0x6c62090a3423202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x66783023202c3631

ldr x10, =0x2072736c090a2030

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6e61090a312d2320

ldr x10, =0x77202c3831772064

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x363177206272646c

ldr x10, =0x2c5d3731785b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3132782064

ldr x10, =0x090a3123202c3132

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6977646e61730a30

ldr x10, =0x6461090a3a316863

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x313123202c327820

ldr x10, =0x2320637673090a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c317820766f6d

ldr x10, =0x766f6d090a343178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3436

ldr x10, =0x090a3123202c3078

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a74737269

ldr x10, =0x23202c387820766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c343178202c

ldr x10, =0x66746e6972700a31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3123202c333178

ldr x10, =0x3032782062757309

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x73090a3123202c34

ldr x10, =0x202c373178206275

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x627573090a312320

ldr x10, =0x3178202c32327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820627573090a30

ldr x10, =0x2c333178202c3132

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a33342320

ldr x10, =0x23202c3531782076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820646461090a35

ldr x10, =0x2c323178202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c32317820627573

ldr x10, =0x3823202c32317820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7264617465736572

ldr x10, =0x090a3a7365737365

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657264616f6c2074

ldr x10, =0x0a66667574736570

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c35317820706d

ldr x10, =0x6c2e62090a353823

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3178202c35317820

ldr x10, =0x63090a3123202c35

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c5d3231785b202c

ldr x10, =0x646461090a312320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3123202c5d31

ldr x10, =0x3631772062727473

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x206272646c090a3a

ldr x10, =0x31785b202c363177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7264616f6c0a3023

ldr x10, =0x6666757473657065

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a6666757473

ldr x10, =0x202c35317820766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c3a202c32317820

ldr x10, =0x657065723a32316f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x61090a6666757473

ldr x10, =0x2c32317820206464

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x782070726461090a

ldr x10, =0x65706572202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3a32316f6c3a202c

ldr x10, =0x706d657465706572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2020646461090a70

ldr x10, =0x313178202c313178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c31317820707264

ldr x10, =0x6d65746570657220

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317820766f6d090a

ldr x10, =0x61090a7073202c34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x766f6d090a5d3631

ldr x10, =0x7073202c33317820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032782072747309

ldr x10, =0x23202c70735b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a215d

ldr x10, =0x0a7073202c393278

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x5b202c303378202c

ldr x10, =0x32332d23202c7073

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3a74726174735f

ldr x10, =0x3932782070747309

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f69746365732e09

ldr x10, =0x0a747865742e206e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c61626f6c672e09

ldr x10, =0x0a74726174735f20

stp x9, x10, \[sp, #-16\]!

mov x14, sp

adrp x11, repetemp

add  x11, x11, :lo12:repetemp

adrp x12, repestuff

add  x12, x12, :lo12:repestuff

mov x15, #0

loadrepestuff:

ldrb w16, \[x11\], #1

strb w16, \[x12\], #1

add x15, x15, #1

cmp x15, #85

b.lt loadrepestuff

resetadresses:

sub x12, x12, #85

add x12, x12, #43

mov x15, #0

sub x21, x13, #1

sub x22, x14, #1

sub x17, x13, #1

sub x20, x14, #1

printfirst:

mov x8, #64

mov x0, #1

mov x1, x14

mov x2, #112

svc #0

sandwich1:

add x21, x21, #1

ldrb w16, \[x17\], #-1

and w18, w16, #0xf0 

lsr w18 ,w18, #4

bl nibbletobyte

strb w19, \[x12\], #1

and w18, w16, #0x0f

bl nibbletobyte

strb w19, \[x12\], #1

add x15, x15, #1

cmp x15, #8

b.lt sandwich1

sub x12, x12, #46

sandwich2:

add x21, x21, #1

ldrb w16, \[x17\], #-1

and w18, w16, #0xf0

lsr w18 ,w18, #4

bl nibbletobyte

strb w19, \[x12\], #1

and w18, w16, #0x0f

bl nibbletobyte

strb w19, \[x12\], 1

add x15, x15, #1

cmp x15, #16

b.lt sandwich2

resumeprinting:

sub x12, x12, #29

add x12, x12, #43

mov x15, #0

mov x8, #64

mov x0, #1

ldr x1, =repestuff

mov x2, #85

svc #0

cmp x17, x20

b.gt sandwich1

printlast:

mov x8, #64

mov x0, #1

mov x1, x22

add x1, x1, #113

sub x2, x21, x22

lsr x2, x2, #1

sub x2, x2, #112

svc #0

exitstuff:

ldr x20, \[sp, #16\]

ldp x29, x30, \[sp\], #32

mov x0, #0

mov x8, #93

svc #0

nibbletobyte:

cmp w18, #0x00

b.eq zerobyte

cmp w18, #0x01

b.eq onebyte

cmp w18, #0x02

b.eq twobyte

cmp w18, #0x03

b.eq threebyte

cmp w18, #0x04

b.eq fourbyte

cmp w18, #0x05

b.eq fivebyte

cmp w18, #0x06

b.eq sixbyte

cmp w18, #0x07

b.eq sevenbyte

cmp w18, #0x08

b.eq eigthbyte

cmp w18, #0x09

b.eq ninebyte

cmp w18, #0x0a

b.eq abyte

cmp w18, #0x0b

b.eq bbyte

cmp w18, #0x0c

b.eq cbyte

cmp w18, #0x0d

b.eq dbyte

cmp w18, #0x0e

b.eq ebyte

cmp w18, #0x0f

b.eq fbyte

zerobyte:

mov w19, #0x30

ret

onebyte:

mov w19, #0x31

ret

twobyte:

mov w19, #0x32

ret

threebyte:

mov w19, #0x33

ret

fourbyte:

mov w19, #0x34

ret

fivebyte:

mov w19, #0x35

ret

sixbyte:

mov w19, #0x36

ret

sevenbyte:

mov w19, #0x37

ret

eigthbyte:

mov w19, #0x38

ret

ninebyte:

mov w19, #0x39

ret

abyte:

mov w19, #0x61

ret

bbyte:

mov w19, #0x62

ret

cbyte:

mov w19, #0x63

ret

dbyte:

mov w19, #0x64

ret

ebyte:

mov w19, #0x65

ret

fbyte:

mov w19, #0x66

ret

.section .rodata

repetemp: .ascii "\n\tldr x9, =0x2020202020202020\n\tldr x10, =0x2020202020202020\n\tstp x9, x10, [sp, #-16]!"

.section .bss

.align 7

repestuff: .zero 85

//quine <3 winnietheraven uwu owor```

▲ 28 r/Compilers+1 crossposts

guidance on becoming a Machine learning compiler engineer

I have found MLIR, LLVM quite intresting for past 4-5 months but haven't dived deep yet, but from my experience as a AI systems engineer(i was responsible for building the autograd and computational graph integration into the main c++ DL framework, mostly runtime focused) i am familiar with the concepts of IR dialects and stages of lowering through the compiler pipeline toward machine code by exploring the pytorch and tensorflow compiler architecture(conceptual familiarity from studying compiler architectures) as i was incharge of the runtime mechanics.
(i am conceptually strong with advanced cpp and most of the runtime stuff as i built the framework with ai-assistance)

i had read the frst 2 chapters of toy mlir and first 5 chapters of the https://book.mlc.ai/ and have some base understanding of the IR so far. once i started reading these two resources i could get quite the grasp about how the mechanisms work under the hood of the ML compiler.

its been 2 months since i left the job and i want to transition into compiler engineering in the ML field.
given my background, what would be the best path to become employable as an ML compiler engineer?

reddit.com
u/grishma_1503 — 2 days ago

Is 76 μs acceptable compilation performance for a almost prod ready ELF64 compiler?

Folks! Is this acceptable performance for a compiler? it do lexing, parsing, type checking, optimziing and codegen . It simply emits the ELF64 executable directly and runs it without an external linker/object-file pipeline.

--- CODEGEN RESULTS ---

Total Machine Bytes Emitted: 47 bytes

Compilation Speed: 76000 ns

Runnable ELF64 Machine Code Executable Written: boo

reddit.com
u/Retired-69 — 2 days ago

I finished Futhorc v1.0, my statically typed interpreted language (With Anglo-Saxon rune syntax!)

GitHub

So, for a while I've been working on a programming language called Futhorc. It arose from a very particular need: to have my own programming language; I'm sure someone here can relate XD

It's a C-style language with functions, structs, enums, type unions, typed collections, modules, file I/O, and Python interoperability. Source goes through a hand-written lexer and recursive-descent parser into an AST, followed by a separate semantic-analysis pass for type checking and name resolution before being executed by a tree-walking interpreter, all implemented in Python.

The core feature and the one I'm most fond of is the fact that this:

int factorial(int n) {
    if (n &lt;= 1) {
        return 1;
    }

    return n * factorial(n - 1);
}

Can be turned into this

ᛁᚾᛏ factorial(ᛁᚾᛏ n) {
    ᛁᚠ (n &lt;= 1) {
        ᚱᛁᛏᚢᚱᚾ 1;
    }

    ᚱᛁᛏᚢᚱᚾ n * factorial(n - 1);
}

FUTHORC ANGLO-SAXON RUNES! I always liked them a lot and, through extensive usage of this wonderful resource by Harys Dalvi, the link to which is in the specs, I managed to make an entire programming language that recognizes Futhorc runes as valid keywords. This is not a separate dialect, the runes are valid aliases of the ASCII keywords and can be mixed in or used solely.

It's so much fun to write in and it's quite expressive if I say so myself. If you want to use it for yourself, all of the stuff you'll need is in the GitHub. The repository includes the full language specification and runic reference, as well as a fully formatted HTML/CSS/JS documentation site with custom branding and complete sample programs, if you fancy something prettier than Markdown. Futhorc can also be installed as a command-line program, so .futhorc and source files can be run directly with futhorc source.þ, but again, everything's in the GitHub. I'll leave you with a representative sample of the second largest program I've made (82 lines) for you to see without clicking any link: a sort of small supermarket API.

struct Product {
    str name;
    float price;
    int stock = 0;


    str repr(Product self) {
        return c"${self.price} {self.name}: {self.stock}";
    }
}


list(Product) stock = [];

# findProductByName() omitted for brevity

float | nil registerPurchase(Product product, int amountBought, float amountPaid) {
    int location = findProductByName(product.name);


    if (location == -1 or stock[location].stock &lt;= 0) {
        print(c"Product {product.name} out of stock");
        return nil;
    }
    Product purchase = stock[location];
    if (amountBought &gt; purchase.stock) {
        print("Purchase exceeds stock");
        return nil;
    } elsif (amountBought &lt; 1) {
        print("Purchase is invalid");
        return nil;
    } elsif (purchase.price * amountBought &gt; amountPaid) {
        print("Insufficient payment");
        return nil;
    }
    stock[location].stock -= amountBought;
    float total = purchase.price * amountBought;
    print(c"{purchase.name}: {total}");
    print(c"Paid: {amountPaid}");
    float change = amountPaid - total;
    print(c"Change: {change}");
    return change;
}

Fun fact: the language used to be called Thorn instead of Futhorc, until I learned that there was already a language called that so I had to rename it. That's why you'll see Thorn all over the implementation, including in the runic extension!

u/Matalya2 — 2 days ago

Can Sanskrit work as a natural programming language?

I’ve been experimenting with this idea by building a Sanskrit compiler based on Pāṇinian grammar.

Instead of treating Sanskrit only as text to interpret, the compiler parses grammatically structured Sanskrit and turns the instructions into executable operations.

The interesting part for me is whether Pāṇini’s formal grammatical system can provide enough structure to bridge natural language and programming languages deterministically.

I now have a working implementation and would be interested in hearing what others think about this approach.

Website: https://panini.cc/
GitHub: https://github.com/kaushalbx/paninivm
Article: https://medium.com/@kaushalbx/building-p%C4%81%E1%B9%87inivm-compiling-2-500-year-old-paninian-grammar-into-an-executable-kotlin-engine-5a6bb8de20fb

reddit.com
u/kaushalbx — 3 days ago

Any recommendations for a meta programming language?

I want to add a meta programming language in top of my own C-like language to make some of the syntax cleaner and easier to write.

Add everything like const expressions and templates under one meta programming language.

For example something like this:


[Phases]
Class Phase1: public Phase { };

[Phases]
Class Phase1: public Phase { };

[for phase in Phases]
PhaseList.push_back(new phase());
[endfor]

I’m thinking about something like this but ideas are all over the place. Is there some existing meta programming language out there that can give me the right inspiration?

Also I am totally lost about how I should program this, I am assuming it comes before the parser. Any tutorials or dummy meta programming languages I can look to get ideas?

Thank you for reading.

reddit.com
u/TrgtBBB — 3 days ago

Velaris: effect checking, Z3 contract proofs, and an LLVM JIT in one readable Python file

I built a language where the signature carries the guarantees, and I wanted to share the implementation choices since this crowd cares about the how.

Pipeline: lexer → parser → loader → effect checker → type checker → Z3 proof pass → LLVM JIT (llvmlite) → interpreter, all in one file in pipeline order.

Three things that might interest you:

  1. The proof pass explores paths symbolically and checks requires/ensures/loop invariants in Z3, with modular call summaries (a callee's contract is assumed at the call site rather than inlining its body). Lists use the theory of arrays, records get per-field symbolic values, and all_of/any_of become real quantifiers with the predicate body inlined under the For All.

  2. Floats are proven in Z3's genuine IEEE-754 theory, not modelled as reals — so the prover refutes x + 0.1 + 0.1 == x + 0.2 and returns the exact double. FP queries get a bigger solver budget (30s vs 3s) since bit-blasting is slow; integer proofs stay instant.

  3. The JIT covers pure Int/Float/Bool functions with typed codegen. Division and modulo are deliberately left interpreted in both modes —native fdiv by zero gives infinity while the language promises a clean error, and I'd rather lose the optimization than have the two engines disagree. Every native change ships with a differential test: same program, both engines, diff must be empty.

One soundness lesson: when I added quantifiers, the first test run produced a false counterexample. Turned out untranslatable `requires` premises had been silently dropped since an early version — harmless for "proven" claims, but capable of manufacturing false alarms. Now an untranslatable premise aborts the proof entirely and falls back to runtime checks.

Repo: https://github.com/gowrishankar-infra/velaris-lang

Playground (Pyodide, real compiler in-browser):

https://gowrishankar-infra.github.io/velaris-lang/playground.html

Disclosure: built pair-programming with an AI across 40+ releases; design decisions mine, commit history is the honest record. Beginner here, so tear the implementation apart — especially the prover.

reddit.com
u/Pattinathar — 3 days ago
▲ 2 r/Compilers+1 crossposts

working on a python to luau transpiler

hi yall! ive done a bit of work in roblox studio and would consider myself somewhat versed at it and its scripting language, but i originally knew python, and python still is my dominant language, so i decided to start trying to make a python to luau transpiler based on this python compiler im working on.

the projects github is deltathedumb/luaupy. ill try to regularly update yall.

u/X_OpCreeper_X — 4 days ago

Is there a real benefit in using multiple targets on a compiler?

I was working in a compiler I created when I see Compilers, and I never give up on the first interpreter I created that day (tree-walk).

The compiler is on Python and via a protobuf(I use it as a High Level IR), not only the interpreter but a stack based VM(c++) and I was looking to create a new backend to generate Web Assembly using JS/TS I know isn't the best option but I want to avoid LLVM as a target for now.

So, the question is: is really a good practice keep alive the interpreter even if the general pipeline ends in the VM?

(Note: my English ain't the best but I tried to make the post the comprensible I can)

reddit.com
u/_dasion_ — 3 days ago
▲ 346 r/Compilers

I created a web framework in my own programming language

I’ve been working on Rivet, a synchronous HTTP(for now) server library for my own programming language Zap

The goal is to create a small, explicit API for building APIs and small web applications.

I spent a lot of time and nerves creating this, but now I know what Zap is really capable of.

I will be grateful for every star you leave because it really encourages me to work

https://github.com/thezaplang/zap

u/funcieq — 5 days ago

[Newbie] what do the *s mean?

main.c

struct token {
enum token_kind kind;
char *value;
};

struct lexer {
char *buffer;
unsigned int buffer_len;
unsigned int pos;
unsigned int read_pos;
char ch;
};

edit: Hi everyone, thank you for explaining this in better detail. I've had a bit of a rough education from the community college I've since transferred out of, which had a guy that was extremely rude and didn't assign the C book, and an old lady that kind of just gave up and gave everyone As, Bs when she was retiring from teaching assembly language.

I appreciate your patience with me

reddit.com
u/LifeIsHellSometime — 3 days ago