I have this rather weird CPU architecture for which currently only an assembler exists. I won't go into too much details about this architecture as it is not publicly available. However, some quirks of it are:
- It can only address full 32 bit words in memory
- No shift operations
- No internal registers. It fully operates on the system memory for each access.
- No multiplication / division in hardware
- No indirect jumps
- No calls (subroutines with returns to the jumped of address) at all.
The question of writing a C compiler for this thing came up.
As far as I see, the first point of only being able to access full 32 bit words shouldn't be a problem because I could simply define a 'char' as 32 bits wide, which should be valid, weird but valid.
Missing multiplication / division / shift operations can be constructed from additions and subtractions. So this seems possible as well.
So this actually got me thinking: "What are the requirements to an architecture so that it is actually possible to write a C compiler for it?"
I'm an electrical engineer with a strong background on CPU architectures and C programming. However, I'm not too much into theoretical CS. So an easy formulated answer is highly appreciated (if possible).