3 ms·
About 30-some years ago, I bought a book entitled "The Unix Programming Environment". I was just going to college, and the machines were all unix-based. I figur
by spacedcowboy 4y ago
About 30-some years ago, I bought a book entitled "The Unix Programming Environment". I was just going to college, and the machines were all unix-based. I figured it was worth some of my student grant to figure out how to use them..
A few months ago, I picked up my significantly dog-eared copy of TUPE and leafed through it to a section I'd remembered being about 'hoc', the higher-order calculator language they derive from first principles. I'm currently writing a 6502 compiler and I was implementing the assembler stage. I wanted my assembler to have macros and be able to calculate expressions etc., because I'm planning on having an asm [...] block in the high-level code. Being able to call the macro "_xfer32 r1,r2" is a lot more appealing than a long series of lda/sta...
So I sat and read about hoc, and worked my way through it, eventually coming up with something I could put into my code and call for any expression calculation. The compiler is a full-blown AST-based model but assemblers are much simpler beasts, and accepting of more limitations. Hoc (or rather an adaption of it) was an ideal basis for what I wanted.
Some old books have timeless wisdom within.