News for hackers. Stuff that matters.
Re:Write your own retro compiler by 082349872349872 on Sunday December 10, 2023 @02:02PM (#38593896)
Here's one way to avoid going into detail on ELF: https://news.ycombinator.com/item?id=38592000

"(nearly) constant" means you can pick either (a) a constant blob, at the cost of a fixed image size, à la COM, or (b) patch up length (one or two places, iirc) if you're feeling fancy.

Re:Write your own retro compiler by nils-m-holm on Sunday December 10, 2023 @02:12PM (#38593981)
In one of my other compiler books (http://t3x.org/t3x/book.html) I just use a template for the ELF header, but I still think it adds too much complexity. One reader complained about it.
Re:Write your own retro compiler by 082349872349872 on Sunday December 10, 2023 @03:33PM (#38594763)
found it: elfheader() in https://t3x.org/t3x/t.t.html

fwiw, I think you commented it very nicely; de gustibus!

Did you come up with if vs. ie ... else ... independently or inherit it from BCPL?

Re:Write your own retro compiler by nils-m-holm on Sunday December 10, 2023 @03:47PM (#38594894)
> fwiw, I think you commented it very nicely;

Thanks, I thought so, too, but I can also understand that the comments are not very helpful, if you know nothing about linkers, paging, and object files.

I think I adopted IE/ELSE from BCPL, but thought that IE is nicer than TEST, because it is itself short for If/Else and because it looks almost like IF.

> de gustibus!

Funny, I just started to brush up my Latin! :)