DavidPH / GDCC

Game Data Compiler Collection
Other
39 stars 7 forks source link

Named natives in ACS front #19

Closed DavidPH closed 5 years ago

DavidPH commented 6 years ago

There currently exists no syntax in the special declaration to declare natives without a number. This is a problem for targets which reference natives by name in the bytecode, or if the number is otherwise provided externally. One syntactic solution is to make the special-address optional to declare line specials, use - for natives, and {} for assembly functions. As in:

special int LineSpecial(int, int);
special int -:Native(int);
special int {}:AssemblyFunction(int, int, int);

This is not a very refined syntax for natives and assembly functions, but such declarations only need to be so clean. New keywords could be introduced, but that is undesirable from a compatibility perspective. A sort of contextual keyword, where the integer-constant in special-address is replaced with an identifier is also possible, but would likely introduce undesired syntactic restraints later.

DavidPH commented 5 years ago

Ended up allowing the use of a string literal in place of the integer literal. This avoids issues with needing to match the ACS name mangling to the target's native naming convention.