Language grammar opinions

"Clive D.W. Feather" <clive@demon.net> Mon, 08 January 2007 16:10 UTC

Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1H3x4e-0001ET-PA; Mon, 08 Jan 2007 11:10:12 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1H3x4d-0001DS-P4 for cosmogol@ietf.org; Mon, 08 Jan 2007 11:10:11 -0500
Received: from anchor-internal-1.mail.demon.net ([195.173.56.100]) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1H3x4c-0004s5-CG for cosmogol@ietf.org; Mon, 08 Jan 2007 11:10:11 -0500
Received: from finch-staff-1.server.demon.net (finch-staff-1.server.demon.net [193.195.224.1]) by anchor-internal-1.mail.demon.net with ESMTP� id l08GA9Rt020741; Mon, 8 Jan 2007 16:10:09 GMT
Received: from clive by finch-staff-1.server.demon.net with local (Exim 3.36 #1) id 1H3x4b-000HJX-00 for cosmogol@ietf.org; Mon, 08 Jan 2007 16:10:09 +0000
Date: Mon, 08 Jan 2007 16:10:09 +0000
From: "Clive D.W. Feather" <clive@demon.net>
To: cosmogol@ietf.org
Message-ID: <20070108161009.GU12419@finch-staff-1.thus.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
User-Agent: Mutt/1.5.3i
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 82c9bddb247d9ba4471160a9a865a5f3
Subject: Language grammar opinions
X-BeenThere: cosmogol@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: DIscussion on state machine specification in IETF protocols <cosmogol.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/cosmogol>, <mailto:cosmogol-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/cosmogol>
List-Post: <mailto:cosmogol@ietf.org>
List-Help: <mailto:cosmogol-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/cosmogol>, <mailto:cosmogol-request@ietf.org?subject=subscribe>
Errors-To: cosmogol-bounces@ietf.org

Unlike my previous message, this is my opinions on the proposed language
grammar. It's mostly based on the comments in the grammar.

I prefer to list the possible declaration types in the grammar, so would
prefer the commented-out version of "declaration".

There's a parsability problem. Consider the sequence:

    alpha, bravo, charlie, delta, echo, foxtrot, golf, hotel, india,
    juliet, kilo, lima, mike, november, oscar, papa, quebec, romeo,
    sierra, tango, uniform, victor, whisky, x-ray, yankee: zulu

Only after you see the next token (semicolon or comma or arrow) do you know
if this is a declaration with an unknown type, or a transition. This
produces a shift/reduce conflict in yacc or other such parser generators.
To resolve it, I would suggest reversing the order of declarations to
*begin* with the type:

    STATE : alpha, bravo, charlie ;

I'd also make the various types be reserved words, so you can't have a
state called "message" or an action called "state".

In fact, looking further, I suggest that assignments are actually a form of
declaration and can both be written the same way:

    Title = "My example (version 2)";
    STATE = alpha, bravo, charlie;
    Initial = alpha;

and be the same concept in the grammar. Using = will eliminate some parsing
problems.

Identifiers like foo----bar: I know this looks strange, and it's possible
to write a syntax that forbids it:

    identifier = ALPHA *(["-"] 1*ALNUM)

but I'm not convinced that it's worth it. Note that ABNF itself allows both
double dashes and trailing dashes. However, I think we could usefully avoid
allowing "x----->x---" to be valid.

[Oops, omission in my last message: I defined ALNUM.]

I see no benefit in restricting the characters in double-quoted names. At
the very least, why allow comma and semicolon but not full stop and colon?
Why not allow parentheses? I would simply define it as:

    dquote-chars = SP / %x21 / %x23-7E
        ; Space and all printable characters except double quote

-- 
Clive D.W. Feather  | Work:  <clive@demon.net>   | Tel:    +44 20 8495 6138
Internet Expert     | Home:  <clive@davros.org>  | Fax:    +44 870 051 9937
Demon Internet      | WWW: http://www.davros.org | Mobile: +44 7973 377646
THUS plc            |                            |

_______________________________________________
Cosmogol mailing list
Cosmogol@ietf.org
https://www1.ietf.org/mailman/listinfo/cosmogol