qexo-general
[Top][All Lists]
Advanced

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

Re: [Qexo-general] CUP and JFlex for Qexo


From: Per Bothner
Subject: Re: [Qexo-general] CUP and JFlex for Qexo
Date: Fri, 20 Feb 2004 14:52:12 -0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

Joseph Coffland wrote:

Has anyone thought about rewriting the Qexo parser/lexer with the CUP and
JFlex tools?  The existing parser is a fine piece of work, but it would
be easier to modify and maintain a CUP/JFlex based parser.   W3.org is now
releasing a complete CUP grammar as part of the XQuery recommendation.

Where?  I see Ed Willink's parser, but it is not "released by" W3.org.

It should be easier to keep up with the spec this way.

I would be willing to put my money where my mouth is and work on this,
but I don't want to step on any toes.  Does this idea conflict with
Qexo's design goals?

No, but I don't see any benefit.

In general, I'm skeptical of parser generators.  They tend to be harder
to debug than recursive descent, and they don't handle well the
complications of real-life languages.  For example can it set the
correct line- and column-number for each declaration?  In Gcc we have
replaced the C++ parser with a hand-written recursive-descent one, and
people would like to do the same for C.

A CUP grammar may be easier to modify and maintain, but only for the
simple uninteresting syntax changes, and who needs to do that and how
often?

Plus performance would almost probably be worse, it would add an
extra dependency building Qexo, and the existing parser is already
fairly complete and correct - and generates Kawa Expression trees.
Finally, parsing is the easiest and least interesting part of the
compiler.  What problem would be solved by learning the usage and
quirks of a parser generator?

If you want to volunteer, I have other suggestions.  For example,
I'd like to make it option to replace Qexo's XML parser by
Xerces-J.  That could handle some of the XML details Qexo doesn't
handle and (more importantly) allow schema validation.
--
        --Per Bothner
address@hidden   http://per.bothner.com/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]