On 6 Feb., 08:17, Gnome Nomad <[email protected]> wrote:

> XML would be much easier to parse

It depends. There are ready-made libraries to parse XML, but this
would introduce yet another library dependency into the body of code.
Usually this is a bad idea, because it increases maintainance effort.
But the first modification I proposed (see my musings about 'linear
P') would create a superset of the current pto and remain compatible:

- allow mulit-character line headers

if line headers weren't restricted to identifier format ( [A-Za-z][A-
Za-z0-9_]* ) but allowed to contain non-alphanumeric characters,
constructs like

#-hugin
#hugin_ptoversion
#hugin_optimizeReferenceImage

would constitute legal line headings, and the grammar would be reduced
to the one-liner I proposed. The idea is basically to parse a superset
of pto that encompasses all deviant syntax and then pick the
meaningful bits from it and reject the rest - similar to what I do it
in my python parser.

The semanics would be dealt with in the next step, when the structure
(set of lines of a given type with a set of fields that have values) -
has already been established. This would allow to plug in the
semantics from a formal specification and keep them out of the parser,
so reducing maintainance. The formal specification could be used in
other places to generate code, like the technique dubbed 'lazy
metaprogramming' is abusing a C header to serve as such a meta-
specification. It could carry extra information that could lead to
better documentation and clear error messages, all quite
automatically, once the mechnism is established, so we'd have an up-to-
date document containing the current status quo of used line and field
headers, like doxygen generates a document of the used clases and
methods.

Kay

-- 
You received this message because you are subscribed to the Google Groups 
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to