[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PROPOSAL] identifiers are like identifiers in programs



Let me echo Jay's position requesting a change to the syntax of
identifiers.  I think it is good practice to make message names and
keys easily mapped into identifiers of a programming language.  For
example, if identifiers are limited to letters and underscore followed
by any number of letters, digits, underscore, and minus sign, it is
easy to map identifiers into C or Java names.  Simply tranlate each
minus sign into a dollar sign.

I have a program that produces a Java class which handles MCP
messages.  The input to the translator is a a description of each MCP
message type handled along with a Java code fragment that consumes the
MCP message.  The code generator creates Java identifiers from message
names and keys.  The current syntax makes the translation messy.
Please change the MCP syntax as follows:

John


<message-line> := '#$#' <message> EOL

<message> := <message-start>
           | <message-continue>
           | <message-end>

<message-start> := <message-name> <space> [<auth-key> <space>] <keyval>*
<message-continue> := '*' <space> <datatag> <space> <simple-key> ' ' <line>
<message-end> := ':' <space> <datatag>

<message-name> := <ident>
<auth-key> := <unquoted-string>
<datatag> := <unquoted-string>
<keyval> := <key> <space> <value>
<key> := <simple-key> | <multiline-key>
<simple-key> := <ident> ':'
<multiline-key> := <ident> '*' ':'
<value> := <unquoted-string> | <quoted-string>

<ident> := <alpha> <ident-chars>
<unquoted-string> := <simple-char>+
<quoted-string> := '"' <string-chars> '"'
<line> := any number of characters, but no newlines.

<ident-chars> ::= '' | <ident-char> <ident-chars>
<string-chars> := '' | <string-char> <string-chars>

<space> := ' '+

<ident-char> := <alpha> | <digit> | '-'
<string-char> := <simple-char> | <space> | '\"' | '\\'
        | ':' | '*'
<simple-char> := <alpha> | <digit> | <other-simple>
<other-simple> := '-' | '~' | '`' | '!' | '@' | '#' | '$' | '%' | '^'
        | '&' | '(' | ')' | '=' | '+' | '{' | '}' | '[' | ']' | '|'
        | ''' | ';' | '?' | '/' | '>' | '<' | '.' | ','
<digit> := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
<alpha> := 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j'
        | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't'
        | 'u' | 'v' | 'w' | 'x' | 'y' | 'z'
        | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J'
        | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T'
        | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '_'