Subj : Re: help with ebnf for ebnf newbie? To : comp.programming From : rossum Date : Thu Sep 15 2005 12:08 am On 11 Sep 2005 12:31:30 -0700, "pantagruel" wrote: >I don't have any experience with EBNF or just normal BNF, and I want to >define a comma seperated string of name value pairs, with some >predefined names, although no names that are required, the associator >between name and value should be a '=' character. I am thinking >something like this: > > ::= DefaultNames | Name "=" Value ","| Can be empty? Your definition does not allow it to be. Your third option is ::= which is not very useful. >DefaultNames ::= "callid=" Value "," | "callfrom=" Value "callid=" is followed by a comma and "callfrom=" is not. Also you have an or in the middle, judging by your example you should probably concatenate instead since you seem to want both callid and callfrom on the same line. Would "callid =" (with a space) be accepted? >Value ::= Can a Value be "callfrom" or "callid"? Can a Value include spaces? >Name ::= Can a Name include spaces? > > >this should match > >callid=wotcha,callfrom=whoyathunk,testing=othervalue comma not matched ^ > > >is this wrong? Yes I'm afraid. You might want to introduce the definition of a Name-Value pair. This saves a lot of commas elsewhere in the definitions. Since you want to describe a comma separated list then just start by defining a comma separated list: ::= | "," You can use the definition to describe what it is that you are making a list of. ::= ... HTH rossum The ultimate truth is that there is no ultimate truth .