DavidPH / GDCC

Game Data Compiler Collection
Other
39 stars 7 forks source link

ACS script type extensions #17

Closed DavidPH closed 6 years ago

DavidPH commented 6 years ago

The ACS front currently has a fixed set of keywords it accepts for script types/flags. This creates an extra step to adding ACS script types and makes the feature useless for non-ACS targets.

Replacing script-type and script-flag-sequence with identifier-sequence in script-declaration is grammatically unambiguous, so that seems like the best route. This would need to be accompanied by a warning/error in the ZDACS bytecode module for unrecognized script types, however. Also it would require the bytecode module to be case insensitive about type names or for the canonical names to be made lowercase. I am inclined to the latter, but it would break existing C code. (Although, it would produce a compile-time error rather than silently breaking code and would be a minor syntactic fix.)

The big question is whether to make this change in the base grammar or the extension grammar. Most likely the former, though, as it would be easy enough to justify acc's stricter requirements as a note.

DavidPH commented 6 years ago

Decided to regard it as an extension syntax, deferring to acc as the authoritative reference for ACS syntax for now. Also extended the identifier-sequence script type handling to functions, since that is useful for other targets which don't have script calls, but do have script types.