Edit: Back to working on this, made some real progress, spec attached below. Some of the post below is outdated.
Before posting this, I went back and reread this thread (Among others) to see if there were any ideas I overlooked.
http://nesdev.com/bbs/viewtopic.php?t=7976
The op's ideas were pretty close to my own: The syntax is going to be very simple, almost BASIC-like, but it does adapt things from C:
-Pointers are a separate type and must be declared. Uses Indirect-Y.
-Structs are very much in play. An array of structs would use Direct Indexing.
-Local variables will be simulated, but there's no stack manipulation with Indirect.
The plan is to generate asm roughly close to what would be hand-written.
Some issues that might crop-up (Or, things from C that didn't make it):
-No 24-bit or 32-bit vars: These will be implemented when the compiler targets 16-bit cpus. What do you call a 24-bit variable when 'int' is reserved for 32-bits and 'long' for 64-bits? For now, the carry flag is available if more than 16-bits are needed.
-1D arrays only: Readily maps to processor addressing modes. On x86 and Arm, 2D and more arrays would be trivial with their multiply instruction, but Noism will not be targeting those platforms. You'll have to use a pointer table to simulate 2D arrays.
One change to the spec: I'm not crazy about retaining any feature of C pointer syntax, so
ptr pointer_var = &var
might become
ptr pointer_var = [var]
Also, forgot negation (~).
Reasons to use Noism:
-Scoping removes the need to juggle temporary variables
-Create a portable code base for NES and GB (Others to be added later)
-Syntax maps closely to a handful of asm instructions
Right now the compiler does syntax error checking. Once I get the compiler functional, the plan is to release it with at least one demo that will run on both NES and GB. Looking forward to feedback -- Hopefully someone else will use it.
Before posting this, I went back and reread this thread (Among others) to see if there were any ideas I overlooked.
http://nesdev.com/bbs/viewtopic.php?t=7976
The op's ideas were pretty close to my own: The syntax is going to be very simple, almost BASIC-like, but it does adapt things from C:
-Pointers are a separate type and must be declared. Uses Indirect-Y.
-Structs are very much in play. An array of structs would use Direct Indexing.
-Local variables will be simulated, but there's no stack manipulation with Indirect.
The plan is to generate asm roughly close to what would be hand-written.
Some issues that might crop-up (Or, things from C that didn't make it):
-No 24-bit or 32-bit vars: These will be implemented when the compiler targets 16-bit cpus. What do you call a 24-bit variable when 'int' is reserved for 32-bits and 'long' for 64-bits? For now, the carry flag is available if more than 16-bits are needed.
-1D arrays only: Readily maps to processor addressing modes. On x86 and Arm, 2D and more arrays would be trivial with their multiply instruction, but Noism will not be targeting those platforms. You'll have to use a pointer table to simulate 2D arrays.
One change to the spec: I'm not crazy about retaining any feature of C pointer syntax, so
ptr pointer_var = &var
might become
ptr pointer_var = [var]
Also, forgot negation (~).
Reasons to use Noism:
-Scoping removes the need to juggle temporary variables
-Create a portable code base for NES and GB (Others to be added later)
-Syntax maps closely to a handful of asm instructions
Right now the compiler does syntax error checking. Once I get the compiler functional, the plan is to release it with at least one demo that will run on both NES and GB. Looking forward to feedback -- Hopefully someone else will use it.