How to specify arbitrary order #4026
Replies: 2 comments 3 replies
-
Nope. do_ : KWD_DO do_rep? ...
do_rep : assignment do_cnt?
| ...
;
do_cnt : dot dob? dof?
| dot dof? dob?
| dob dot? dof?
| dob dof? dot?
| dof dot? dob?
| dof dob? dot?
;
dot : KWD_TO expression ;
dob : KWD_BY expression ;
dof : KWD_FOR expression ;It ain't pretty, but it works. The formal Rexx syntax specification (ANSI X3J18-199X) looks even uglier: |
Beta Was this translation helpful? Give feedback.
-
|
So how about something like this: W: (X? ^ Y? ^ Z?);Perhaps a simple tool could be created that can accept that and generate the expansion? as a proof of concept? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Look at this rule:
I've written it like this because this did not work:
The latter rule recognized the
returns_descriptorbut not thecoprocedure_specifier. It reported an error when it was present.I thought that having
(a | b | c)meant one could have one or more of the three and in any order too, is that wrong? have I misunderstood?In a programming language, in which all of these are valid:
The list of possible combinations grows as we add more optional terms. So this is my problem, is there a way to define a grammar rule that says we expect "dcl" then IDENTIFIER then zero_or_more_in_any_order_of("static", "decimal", "fixed") ?
Or must I define a distinct rule for each of all the possible orderings of the terms?
Beta Was this translation helpful? Give feedback.
All reactions