[Proj] proj.4 BNF
Gerald I. Evenden
geraldi.evenden at gmail.com
Tue Oct 21 11:36:57 PDT 2008
On Monday 20 October 2008 11:05:41 pm support.mn at elisanet.fi wrote:
> The problem using + alone as a staement separator is obvious,
> since it can be mixed with positive number sign. One way is to forbid
> to use "+" as a positive number sgn. But then it would trop all
> future expressions also. Maybe best is to agree, that if "+" is
> used as statement separator (and continuation mark) it should
> be preceded by <SEP>, which is usually the case.
>
> So it would be more like:
>
>
> <SEP> ::= (<SPACE> | <TAB> | <EOL>) {<SEP>}
>
> <continuation> ::= <SEP> "+"
>
>
> That would require some white space before + and would make it
> most clear?
>
> ----
>
> Janne.
I should stay out of this thread other than to discourage it because it is making a grand mountain out of a
mole hill.
Regarding the "+": it has nothing to do as a separator and if bothering to use BNF, use something like:
<proj_key>::= "+"<id> | <id>
where id is your typical identifier definition. Treating "+" as a delimiter only confuses the issue. In fact, treating
it like white space could cause a failure---"+proj=poly+ellps=intl" would fail becaue the second + would be
treated as part of the projection name and there is no projection called "+ellps=intl",
<proJ_option> ::= <proj_key> | <proj_key>"="<proj_value>
<proj_option_list> ::= <proj_option> | <proj_option_list><white_space><proj_option>
<white_space> ::= <white_space_char> | <white_space><white_space_char>
<white_space_char> ::= " " | <tab> | <new_line>
I do not think the above (given it's possible BNF warts and incompleteness> is really necessary as it is a
common scenario for keyword control entry. Users may get confused as to what and how of the <proj_key>s
but I do not think entering the values is that confusing because it is virtually identical to entering runline
control options.
Alas.
As a final note: it we really want to get serious about BNF and such descriptions of control entry then we may
have to install a lexical analyzer designed with programs lex or flex and possibly a parsing machine designed
with yacc or bison. Do programmers, installers of libproj4 want to get involved with these beasts?
> -----------------------------------------
>
> support.mn at elisanet.fi kirjoitti:
> > Frank Warmerdam <warmerdam at pobox.com> kirjoitti:
> > > support.mn at elisanet.fi wrote:
> > > > Maybe should define the correct BNF (BackusNaur Form) for proj.4?
> > > >
> > > > http://en.wikipedia.org/wiki/Backus-Naur_form
> > > >
> > > > That would help people to write correct proj.4 inits. I am still
> > > > wondering that if sombody enters wrong proj.4 attributes, the library
> > > > takes them in, but does
> > > > something else and never informs the user that something he was
> > > > entering was totally ignored. Not a very nice situation.
> > > >
> > > > There might be some kind of a stand alone pre scanner, that could be
> > > > called on demand and that checked the user entry and gave full
> > > > information about typos. errors and similar matters. It could be
> > > > bypassed by those who do not need it. But I don't see why anybody
> > > > wanted to bypass checking of his input.
> > >
> > > Janne,
> > >
> > > While this seems like a reasonable idea, I am doubtful that it will
> > > occur due to the challenges in implementing and keeping it up to date.
> >
> > Well, I can start with it. Here is an example, maybe full of errors, but
> > something to start with.
> >
> > ------------------
> >
> > <proj.4 definition> ::= <statement list>
> >
> > <statement list> ::= <statement> {<SEP> <statement list> }
> >
> > <statement> ::= <empty> | <comment line> | <assignment statement> |
> > <identifier>
> >
> > <empty ::=
> >
> > <comment line> ::= # <anything but EOL> <EOL>
> >
> > <assignment statement> ::= <identifier> = <right side>
> >
> > <right side> ::= <identifier> | <identifier list> | <number> | <number
> > list>
> >
> > ........
> >
> > <EOL> ::= <CR> <LF> | <CR> | <LF>
> >
> > <SEP> ::= <SPACE> | <TAB> | <EOL> | "+"
> >
> > <SPACE> :: = " "
> >
> > <TAB> ::= chr(09)
> >
> >
> > etc. etc.
> >
> >
> >
> > regards: Janne.
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
--
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist
More information about the Proj
mailing list