I've been working on a compiler for a few weeks now - 2 hours or so in the evening, sometimes a whole 4 hours when I stretch myself to midnight. Still have to get up around 6 or 6:30, so that's pushing it...
Anyway, the language is a basic-ish language to use in my embedded and small (read: ancient) computer projects. What I've implemented to date actually works and is using an assembler I had written before with a few touch-ups. I have the basic control statements (for-next, while-do, repeat-until, goto, gosub, return, addition/subtraction, comparison operators, logical operators, along with embedded assembly and minor peephole optimizations).
I haven't added the distinction of various datatypes. I originally planned for byte, short, integer, long, possibly real, and strings. Working standard sizes, that long becomes an 8 byte datatype which is a bit large for an embedded language -- think of 8 bit microcontrollers that may only operate on one byte at a time. Is there a 'standard' data typing for 1, 2, 3, and 4 byte numbers? I'm thinking byte (1), short (2), short integer (3), integer (4). But, I'm afraid that "short integer" is too confusing - since "short" is really a "short integer". Thoughts?
I can just skip it too - but in a constrained memory footprint I may want a 3 byte number with a range to 16 million.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment