Discussion:
[1003.1(2008)/Issue 7 0000226]: Questions on awk grammar
Austin Group Bug Tracker
2014-04-17 15:25:56 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Under Review
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 15:25 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

----------------------------------------------------------------------
(0002226) nick (manager) - 2014-04-17 15:25
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
Subject: Re: [bug-gawk] use of ;; as terminator, request for grammar
help
Date: 17 April 2014 09:45:07 BST
X-Diagnostic: Not on the accept list
Hi Eric and Austin Group folks,
I apologize for the delay in replying. Real Life(tm) gets in the way
of these things.
I am cc'ing Brian Kernighan for his opinion on these issues as well.
Date: Thu, 03 Apr 2014 10:18:54 -0600
Subject: [bug-gawk] use of ;; as terminator, request for grammar help
Hello GNU awk readers,
On today's Austin Group call (the people in charge of POSIX), we
visited
http://austingroupbugs.net/view.php?id=226.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
Among other things, there were two action items pointed out that this
1. GNU awk has a bug regarding ;; as a terminator. The POSIX grammar
awk '{print};;{print}'
but gawk rejects this case. This was deemed to be a bug in gawk, since
POSIX was based on the nawk behavior at the time POSIX was
standardized,
and nawk has always supported this.
I'm not convinced this is a real bug. In particular, accidents of the
Unix awk implementation should not necessarily be formally codified
in the standard. mawk, which was written based on the 1988 awk book,
also does not support this.
If there are awk programs that use this, they should best be changed to
have only one ';', in my humble opinion; there's no real added value
to codifying this into the language.
2. Based on existing implementations, there is consensus that the POSIX
awk '{print} {print}'
awk '/foo/; {print}'
since existing implementations all support it. But to do that, we need
someone with help in writing grammars to propose the changes to the one
appearing on the POSIX page. Any input would be appreciated.
I disagree with the first desired change. The ground I'm standing on
here is
firmer. The 1988 awk book disallowed rules without any separators, on
the
grounds that rules and statements within them should be syntactically
consistent (a semicolon is required when multiple Xs [rules or statments]
appear
on one line). And the very early released versions of nawk in fact
enforced
this rule. (I remember testing against it.)
Later on, after the awk book, Brian changed his awk. If you look at his
FIXES
With fear and trembling, modified the grammar to permit
multiple pattern-action statements on one line without
an explicit separator. By definition, this capitulation
to the ghost of ancient implementations remains undefined
and thus subject to change without notice or apology.
DO NOT COUNT ON IT.
The sentiment here is quite clear - while it might work, it should
not be formalized.
The gawk documentation follows this example, documenting clearly that
a semicolon is required between multiple rules on one line, and NOT
documenting that it can be left off. I do not plan to change this,
either.
The second change (awk '/foo/; { print }') should be supported by the
POSIX
grammar, since that is clearly two different rules.
As an aside, there are one or two other areas where gawk implements
undocumented (= unspecified) behavior for compatibility with Unix awk,
but those remain purposely undocumented in the gawk manual; the case
/*
* A simple_stmt exists to satisfy a constraint in the POSIX
* grammar allowing them to occur as the 1st and 3rd parts
* in a `for (...;...;...)' loop. This is a historical oddity
* inherited from Unix awk, not at all documented in the AK&W
* awk book. We support it, as this was reported as a bug.
* We don't bother to document it though. So there.
*/
In my humble opinion, the ';;' issue is so trivial that it's not even
worth
the effort I put in for simple statements in for loops.
I hope all this helps. Further discussion is welcome.
Arnold
Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
======================================================================
Austin Group Bug Tracker
2014-04-17 16:23:28 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Under Review
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 16:23 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

----------------------------------------------------------------------
(0002227) rhansen (reporter) - 2014-04-17 16:23
http://austingroupbugs.net/view.php?id=226#c2227
----------------------------------------------------------------------
On page 2470 lines 79189-79471 change the awk grammar as follows:

<pre>diff --git a/awk.y b/awk.y
index b12ecd9..c63ce89 100644
--- a/awk.y
+++ b/awk.y
@@ -49,23 +49,18 @@


program : item_list
- | actionless_item_list
+ | item_list item
;


-item_list : newline_opt
- | actionless_item_list item terminator
- | item_list item terminator
- | item_list action terminator
+item_list : /* empty */
+ | item_list item terminator
;


-actionless_item_list : item_list pattern terminator
- | actionless_item_list pattern terminator
- ;
-
-
-item : pattern action
+item : action
+ | pattern action
+ | normal_pattern
| Function NAME '(' param_list_opt ')'
newline_opt action
| Function FUNC_NAME '(' param_list_opt ')'
@@ -83,21 +78,27 @@ param_list : NAME
;


-pattern : Begin
- | End
- | expr
+pattern : normal_pattern
+ | special_pattern
+ ;
+
+normal_pattern : expr
| expr ',' newline_opt expr
;


+special_pattern : Begin
+ | End
+ ;
+
+
action : '{' newline_opt '}'
| '{' newline_opt terminated_statement_list '}'
| '{' newline_opt unterminated_statement_list '}'
;


-terminator : terminator ';'
- | terminator NEWLINE
+terminator : terminator NEWLINE
| ';'
| NEWLINE
;</pre>

Add to RATIONALE as new paragraphs after P2481, L79677:

Earlier versions of this standard required implementations to
support multiple adjacent <semicolon>s, lines with one or more
<semicolon>s before a rule ("pattern {action}" pairs), and lines
with only <semicolon>(s). These are not required by this standard
and are considered poor programming practice, but can be
accepted by an implementation of awk as an extension.

Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
2014-04-17 16:23 rhansen Note Added: 0002227
======================================================================
Austin Group Bug Tracker
2014-04-17 16:29:12 UTC
Permalink
The following issue NEEDS AN INTERPRETATION.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Interpretation Required
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: Pending
Final Accepted Text: See bugID:22288.
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 16:29 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

----------------------------------------------------------------------
(0002228) Don Cragun (manager) - 2014-04-17 16:29
http://austingroupbugs.net/view.php?id=226#c2228
----------------------------------------------------------------------
Interpretation response
------------------------
The standard states that multiple adjacent <semicolon>s must be accepted as
terminators, and conforming implementations must conform to this. However,
concerns have been raised about this which are being referred to the
sponsor.

Rationale:
-------------
This is not historic practice and is considered to be a poor programming
practice.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Make the changes specified in http://austingroupbugs.net/view.php?id=226#c2227.

Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
2014-04-17 16:23 rhansen Note Added: 0002227
2014-04-17 16:24 rhansen Note Edited: 0002227
2014-04-17 16:27 rhansen Note Edited: 0002227
2014-04-17 16:28 rhansen Note Edited: 0002227
2014-04-17 16:29 Don Cragun Interp Status --- => Pending
2014-04-17 16:29 Don Cragun Final Accepted Text => See bugID:22288.
2014-04-17 16:29 Don Cragun Note Added: 0002228
2014-04-17 16:29 Don Cragun Status Under Review =>
Interpretation Required
2014-04-17 16:29 Don Cragun Resolution Open => Accepted As
Marked
======================================================================
Austin Group Bug Tracker
2014-04-17 16:31:34 UTC
Permalink
The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Interpretation Required
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: Pending
Final Accepted Text: See bugnote:22288.
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 16:31 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
2014-04-17 16:23 rhansen Note Added: 0002227
2014-04-17 16:24 rhansen Note Edited: 0002227
2014-04-17 16:27 rhansen Note Edited: 0002227
2014-04-17 16:28 rhansen Note Edited: 0002227
2014-04-17 16:29 Don Cragun Interp Status --- => Pending
2014-04-17 16:29 Don Cragun Final Accepted Text => See bugID:22288.
2014-04-17 16:29 Don Cragun Note Added: 0002228
2014-04-17 16:29 Don Cragun Status Under Review =>
Interpretation Required
2014-04-17 16:29 Don Cragun Resolution Open => Accepted As
Marked
2014-04-17 16:31 rhansen Note Edited: 0002227
2014-04-17 16:31 Don Cragun Final Accepted Text See bugID:22288. => See
bugnote:22288.
======================================================================
Austin Group Bug Tracker
2014-04-17 16:48:50 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Interpretation Required
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: Pending
Final Accepted Text: See bugnote:22288.
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 16:48 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

----------------------------------------------------------------------
(0002229) rhansen (reporter) - 2014-04-17 16:48
http://austingroupbugs.net/view.php?id=226#c2229
----------------------------------------------------------------------
http://austingroupbugs.net/view.php?id=226#c2227 contains a diff of the grammar.
For the full version, see the
attached awk.y or awk.txt files (the two files are the same, but the Mantis
bug tracker software assigns different MIME types based on the file
extension).

Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
2014-04-17 16:23 rhansen Note Added: 0002227
2014-04-17 16:24 rhansen Note Edited: 0002227
2014-04-17 16:27 rhansen Note Edited: 0002227
2014-04-17 16:28 rhansen Note Edited: 0002227
2014-04-17 16:29 Don Cragun Interp Status --- => Pending
2014-04-17 16:29 Don Cragun Final Accepted Text => See bugID:22288.
2014-04-17 16:29 Don Cragun Note Added: 0002228
2014-04-17 16:29 Don Cragun Status Under Review =>
Interpretation Required
2014-04-17 16:29 Don Cragun Resolution Open => Accepted As
Marked
2014-04-17 16:31 rhansen Note Edited: 0002227
2014-04-17 16:31 Don Cragun Final Accepted Text See bugID:22288. => See
bugnote:22288.
2014-04-17 16:33 rhansen Note Edited: 0002227
2014-04-17 16:42 rhansen File Added: awk.y
2014-04-17 16:44 rhansen File Added: awk.txt
2014-04-17 16:48 rhansen Note Added: 0002229
======================================================================
Austin Group Bug Tracker
2014-04-17 16:50:46 UTC
Permalink
The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
Reported By: nick
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 226
Category: Shell and Utilities
Type: Clarification Requested
Severity: Comment
Priority: normal
Status: Interpretation Required
Name: Stephane Chazelas <stephane_chazelas-***@public.gmane.org>
Organization:
User Reference:
Section: awk
Page Number: 2447-2453
Line Number: 77855
Interp Status: Pending
Final Accepted Text: See
http://austingroupbugs.net/view.php?id=226#c2228.
======================================================================
Date Submitted: 2010-03-25 15:59 UTC
Last Modified: 2014-04-17 16:50 UTC
======================================================================
Summary: Questions on awk grammar
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2010-03-25 15:59 nick New Issue
2010-03-25 15:59 nick Status New => Under Review
2010-03-25 15:59 nick Assigned To => ajosey
2010-03-25 15:59 nick Name => Stephane Chazelas
<stephane_chazelas-***@public.gmane.org>
2010-03-25 15:59 nick Section => awk
2010-03-25 15:59 nick Page Number => 2447-2453
2010-03-25 15:59 nick Line Number => 77855
2010-03-25 15:59 nick Interp Status => ---
2014-04-03 16:14 rhansen Note Added: 0002216
2014-04-03 16:50 shware_systems Note Added: 0002217
2014-04-03 16:51 shware_systems Note Edited: 0002217
2014-04-03 17:19 shware_systems Note Edited: 0002217
2014-04-03 18:41 shware_systems Note Edited: 0002217
2014-04-03 19:31 shware_systems Note Edited: 0002217
2014-04-03 22:55 shware_systems Note Edited: 0002217
2014-04-17 15:25 nick Note Added: 0002226
2014-04-17 16:23 rhansen Note Added: 0002227
2014-04-17 16:24 rhansen Note Edited: 0002227
2014-04-17 16:27 rhansen Note Edited: 0002227
2014-04-17 16:28 rhansen Note Edited: 0002227
2014-04-17 16:29 Don Cragun Interp Status --- => Pending
2014-04-17 16:29 Don Cragun Final Accepted Text => See bugID:22288.
2014-04-17 16:29 Don Cragun Note Added: 0002228
2014-04-17 16:29 Don Cragun Status Under Review =>
Interpretation Required
2014-04-17 16:29 Don Cragun Resolution Open => Accepted As
Marked
2014-04-17 16:31 rhansen Note Edited: 0002227
2014-04-17 16:31 Don Cragun Final Accepted Text See bugID:22288. => See
bugnote:22288.
2014-04-17 16:33 rhansen Note Edited: 0002227
2014-04-17 16:42 rhansen File Added: awk.y
2014-04-17 16:44 rhansen File Added: awk.txt
2014-04-17 16:48 rhansen Note Added: 0002229
2014-04-17 16:49 Don Cragun Note Edited: 0002228
2014-04-17 16:50 Don Cragun Tag Attached: tc2-2008
2014-04-17 16:50 Don Cragun Final Accepted Text See bugnote:22288. =>
See http://austingroupbugs.net/view.php?id=226#c2228.
======================================================================
Ranjit Singh
2014-06-13 18:59:28 UTC
Permalink
Post by Austin Group Bug Tracker
A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=226
======================================================================
..
Post by Austin Group Bug Tracker
(0002226) nick (manager) - 2014-04-17 15:25
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
From: Aharon Robbins
Subject: Re: [bug-gawk] use of ;; as terminator, request for grammar
help
Date: 17 April 2014 09:45:07 BST
X-Diagnostic: Not on the accept list
Date: Thu, 03 Apr 2014 10:18:54 -0600
From: Eric Blake
Subject: [bug-gawk] use of ;; as terminator, request for grammar help
2. Based on existing implementations, there is consensus that the POSIX
awk '{print} {print}'
awk '/foo/; {print}'
since existing implementations all support it. But to do that, we need
someone with help in writing grammars to propose the changes to the one
appearing on the POSIX page. Any input would be appreciated.
I disagree with the first desired change. The ground I'm standing on
here is
firmer. The 1988 awk book disallowed rules without any separators, on
the
grounds that rules and statements within them should be syntactically
consistent (a semicolon is required when multiple Xs [rules or statments]
appear
on one line). And the very early released versions of nawk in fact
enforced
this rule. (I remember testing against it.)
Later on, after the awk book, Brian changed his awk. If you look at his
FIXES
With fear and trembling, modified the grammar to permit
multiple pattern-action statements on one line without
an explicit separator. By definition, this capitulation
to the ghost of ancient implementations remains undefined
and thus subject to change without notice or apology.
DO NOT COUNT ON IT.
The sentiment here is quite clear - while it might work, it should
not be formalized.
The gawk documentation follows this example, documenting clearly that
a semicolon is required between multiple rules on one line, and NOT
documenting that it can be left off. I do not plan to change this,
either.
I have to disagree; there is no syntactic ambiguity and it's very
useful in awk one-liners. It's as unambiguous as any other braced
statement in terms of where it ends, so there is no problem in the
parser, and I don't see the utility in forbidding it.

It would be like requiring a semi-colon after: if (cond) { .. };
in C, or at least that's how it feels: puzzling.

Certainly the vast majority of usage I see in #awk when I am in there,
uses the implicit separation of the grammar. And one-liner usage has
always been a strong aspect of awk. It just feels odd for POSIX to
require a terminator, when the reference impl took a different path,
albeit with trepidation.

I'd say it worked out quite well, and as you said gawk allows it
already. In standardisation terms, it seems similar to sed -E, which
was also undocumented, and also supported from the beginning.
It certainly counts as idiomatic usage for one-liners, imo.

Thanks for your work,

Regards,
Ranjit.
--
"One can be a gentleman, without being a push-over."
Geoff Clare
2014-06-16 08:47:58 UTC
Permalink
Post by Ranjit Singh
Post by Austin Group Bug Tracker
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
From: Aharon Robbins
[...]
Post by Ranjit Singh
Post by Austin Group Bug Tracker
2. Based on existing implementations, there is consensus that the POSIX
awk '{print} {print}'
awk '/foo/; {print}'
[...]
Post by Ranjit Singh
Post by Austin Group Bug Tracker
I disagree with the first desired change.
[...]
Post by Ranjit Singh
I have to disagree; there is no syntactic ambiguity and it's very
useful in awk one-liners. It's as unambiguous as any other braced
statement in terms of where it ends, so there is no problem in the
parser, and I don't see the utility in forbidding it.
It would be like requiring a semi-colon after: if (cond) { .. };
in C, or at least that's how it feels: puzzling.
Certainly the vast majority of usage I see in #awk when I am in there,
uses the implicit separation of the grammar. And one-liner usage has
always been a strong aspect of awk. It just feels odd for POSIX to
require a terminator, when the reference impl took a different path,
albeit with trepidation.
I'd say it worked out quite well, and as you said gawk allows it
already. In standardisation terms, it seems similar to sed -E, which
was also undocumented, and also supported from the beginning.
It certainly counts as idiomatic usage for one-liners, imo.
This is something we could reconsider for Issue 8. Currently, bug 226
is targeted at TC2 but this extra change would (IMO) not be suitable for
inclusion in a TC. So if you want to pursue this, please submit a new
bug report (with type "Enhancement Request").
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Ranjit Singh
2014-06-19 19:07:08 UTC
Permalink
Post by Geoff Clare
Post by Ranjit Singh
Post by Austin Group Bug Tracker
http://austingroupbugs.net/view.php?id=226#c2226
----------------------------------------------------------------------
From: Aharon Robbins
[...]
Post by Ranjit Singh
Post by Austin Group Bug Tracker
2. Based on existing implementations, there is consensus that the POSIX
awk '{print} {print}'
awk '/foo/; {print}'
[...]
Post by Ranjit Singh
Post by Austin Group Bug Tracker
I disagree with the first desired change.
[...]
Post by Ranjit Singh
I have to disagree; there is no syntactic ambiguity and it's very
useful in awk one-liners.
This is something we could reconsider for Issue 8. Currently, bug 226
is targeted at TC2 but this extra change would (IMO) not be suitable for
inclusion in a TC. So if you want to pursue this, please submit a new
bug report (with type "Enhancement Request").
Sure, I'll do that. I am however a bit concerned about the Rationale change
in 226 mentioning the deliberate forbidding of the first case. It implies
that it's going to continue like that, and that there are good standardisation
reasons for doing so; hence the addition to the Rationale, explicitly noting
it as a syntax error.

I think it would appear inconsistent to then change the grammar specifically
to allow it, in the next revision; and I'd hate for that to be a factor in the
process. It's not cogent to the bug itself, though, and is more about 226,
which is Accepted as Marked (sorry for being so late to the party.)

Thanks for the info: I was wondering what type of bug I'd need.

Regards,
Ranjit.
--
"One can be a gentleman, without being a push-over."
Ranjit Singh
2014-06-19 19:16:41 UTC
Permalink
Post by Ranjit Singh
Sure, I'll do that. I am however a bit concerned about the Rationale change
in 226 mentioning the deliberate forbidding of the first case.
Oops, that's the Rationale for the change, not the Rationale in the accepted
change.

Apologies for noise.
--
"One can be a gentleman, without being a push-over."
Continue reading on narkive:
Loading...