It seemed that using postfix-decorating operators would be a good fit for the DSL. Exploring this idea further showed however, that such a scheme is indeed a good fit from the implementation side, but leads to rather confusing and hard to grasp DSL statements for many non-trivial syntax definition. The reason is: such a postfix-decorator will by default work on ''everything defined'' up to that point; this is too much in many cases. The other alternative would be a function-style definition, which has the benefit to take the sub-clause directly as argument (so the scope is always explicit). The downside is that argument arrangement is a bit more tricky for the repetition combinator (there can be mis-matches, since we take the »SPEC« as free-template argument) And, moreover, with function-style, having more top-level entrance points would be helpful. Overall, no fundamental roadblock, just more technicalities in the setup of the DSL functions. With that re-arrangd structure, an optional combinator could be easily integrated, and a solution was provided to pick up the parser function from a sub-expression defined as Syntax object.
8.9 MiB
8.9 MiB
| The file is too large to be shown. |