2017-06-12 20:05:49 +0000, Yann Régis-Gianas: > Dear members of the Opengroup, > > the shell grammar is defining the non terminal for compound_list as follows: > > compound_list : linebreak term | linebreak term separator ; > > and this non terminal is used in compound_commands like "until" for > instance: > > until_clause : Until compound_list do_group ; > > However, a "term" may derive a simple command like "a". > > Therefore, the following script seems accepted by the grammar: > > until a do b; done > > while the usual shell implementations require a semicolon or a newline to > be inserted just after the "a" for this script to be syntactically correct. > > Are we missing some rule of the grammar or an special rule described > somewhere in the specification? [...]
I agree you've identified a bug in that grammar. As Joerg said, you're bound to find more. That grammar can't really be used to write a shell implementation anyway, so I don't expect it will have been tested that way. Your initiative is probably goind to be very beneficial in that regard. AFAICT, it should be: Until linebreak term sequential_sep Do And there are similar problems with if_clause, else_part, while_clause, until_clause, case_clause, brace_group, do_group at least. -- Stephane