r/ProgrammingLanguages • u/JanBitesTheDust • Sep 04 '22
Discussion Book recommendations after reading “crafting interpreters”
Hello, I finished the book crafting interpreters by Robert Nystrom. The book has helped me alot and felt like an amazing introduction to the field of language design and implementation.
My question however is: what next to read? I know of the dragon book and have read the first couple of chapters. But maybe there are better alternatives. Also, after crafting interpreters, i have a basic understanding of interpreted language design. However, I have the urge to study compiler design.
So are there any books you would recommend me for my level of knowledge?
View all comments
Show parent comment
1
u/kerkeslager2 Sep 07 '22
At least as of the last time I was doing assembly stuff, there were only minor incompatibilities between Intel and AMD chips, and the vast majority of programs used only the instructions which were supported by both chips. There were occasions where you might use instructions supported only by one chip or the other, but that was only for optimization and wasn't necessary for most cases. In most cases your assembly will work fine on both machines without any special effort.
The other thing to note is that x86 is a 32-bit architecture. Your processor is almost certainly 64-bit, meaning it runs a 64-bit instruction set (known as x64 or x86-64). The 32-bit instructions will still run on a 64-bit processor, but for production you'll probably want to generate 64-bit instructions, as 32-bit instructions limit your addressing space, and may be less performant (I've heard this but never had a reason to profile to find out). The good news is that most of the time assemblers just understand the instructions based on operands, i.e.
movwill either move a 32-bit value to a 32-bit location, or a 64-bit value to a 64-bit location, without you having to do anything different. There are some exceptions here and there, but usually they fall into 2 categories: 1) easy-to-understand operations that do the same thing as 32-bit operations, only with 64-bit operands, and 2) conversions between 32 and 64 bit operands (see here for example).All that is to say, you can definitely learn most of what you need to know to write x86-64 assembly for an AMD chip, using a book on x86 assembly for an Intel chip. :)