-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Standardized text formats such as HTTP, JSON and XML specifies generic rules for several elements, however when writing state machines, sometimes I want to parse some specific elements specially, such as certain HTTP fields or certain XML elements. Ragel's priorities allow me to achieve this effect, however I'm still subject to programming errors. In order to protect users from mistakes, Ragel should provide a facility to ensure that specific machines adhere to the definition of more generic machines. A friend tells me this is a decidable task. It would also serve as documentation.
Proposed solution: introduce a keyword such as is
to assert that a specific machine doesn't offend the definition of a more generic machine, aborting the compilation if the programmer fails to do so.
The suggest syntax is a single statement:
specific_machine is generic_machine;
Challenge: Interaction with the when
keyword. (I gave it zero thought so far)