PLEASE use macros to check instruction arguments in the compiler #15

Open
opened 2026-01-21 16:46:55 +11:00 by SpookyDervish · 1 comment
Member

You could create a couple macros like:

  • EXPECT_NUM_ARGS(args, num_aargs) checks if the number of args is equal to the number parsed
  • EXPECT_MIN_ARGS(args, min_args) self explanitory...
  • EXPECT_MAX_ARGS(args, max_args) and so on...
  • EXPECT_ARG_TYPE(args, index, arg_type) checks to make sure the type of the arg at the specified index is the expected type

this would mean you avoid duplicating if statements and can provide generic and consistent error messages.

You could create a couple macros like: - `EXPECT_NUM_ARGS(args, num_aargs)` checks if the number of args is equal to the number parsed - `EXPECT_MIN_ARGS(args, min_args)` self explanitory... - `EXPECT_MAX_ARGS(args, max_args)` and so on... - `EXPECT_ARG_TYPE(args, index, arg_type)` checks to make sure the type of the arg at the specified index is the expected type this would mean you avoid duplicating if statements and can provide generic and consistent error messages.
Owner

I do that in solstice I probably should do this in the compiler

I do that in solstice I probably should do this in the compiler
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ground/cground#15