Re: how to store list of varying types

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



See below...
On Tue, 1 Jul 2008 18:17:08 +0200, "Giovanni Dicanio" <giovanni.dicanio@xxxxxxxxxxx>
wrote:


"Joseph M. Newcomer"

Thanks for your historical perspective, Joe.


On the other hand, the data structures discussed by the OP are very
trivial structures;
they do not have complex nesting, or need to be checked against various
complex
predicates. The cost of parsing what is essentially a "flat" structure is
very small. So
it is not clear the efficiency arguments are quite as compelling. While
the text can be
xml, a simple parser is a tiny effort to write (a few hours at most for a
flat structure.
I wrote an XML parser from scratch for a complex nested structure in six
hours, including
all the high-level parsing, and I will publish it when I release the
program on my MVP
Tips site, Real Soon Now)

Joe: you can't consider yourself a "benchmark" for programming :) I mean,
you are superior of the "average programmer". If that work took to you 6
hours, I believe for the average programmer it will took much more :)
Moreover, I understand that you have deep knwoledge of compiler technology
(and I think that the parser is a sub-system of compiler technology), so you
must be very familiar with this kind of stuff and parsing algorithms.
****
I was writing this stuff 44 years ago; it isn't deep or complex at all. It doesn't even
require a deep understanding of compiler technology. I've got to finish the project and
do the writeup, but fundamentally, it is very straightforward. I used to assign projects
like this to beginning programming classes...it gives them a feel about how things that
they think are overly complex are really straightforward.
****

Frankly speaking, I would write an XML parser only for learning purposes
(and time spent for learning new things is of course quality time), but for
production code I would use a well written and well tested 3rd party XML
parser like TinyXML (or XmlLite).
(It is kind of like STL containers: I wrote some linked-list and array
classes for learning and practicing some C++, but for production code I
prefer using robust well-tested STL.)
*****
I wrote it because I had asserted here that I could write an XML parser in an afternoon,
and I did (much of the time spent was not on the parser itself, but on designing and
implementing the data structures for my application. I went through a couple iterations
before I finished). Now, having written it, it demonstrates that in the simple case this
is very straightforward (the lexer was coded in under an hour) and I plan to use the code
as a tutorial on doing simple parsing. Too many things to do...
joe
****

My 2 cents.
Giovanni


Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: how to store list of varying types
    ... The cost of parsing what is essentially a "flat" structure is ... I wrote an XML parser from scratch for a complex nested structure in six ... I would write an XML parser only for learning purposes ...
    (microsoft.public.vc.mfc)
  • Re: how to store list of varying types
    ... I should also add that I had a 12-year-old writing parsing code after a month of training ... I wrote an XML parser from scratch for a complex nested structure in six ... you are superior of the "average programmer". ...
    (microsoft.public.vc.mfc)
  • Re: OFF-TOPIC:: Why Lisp is not my favorite programming language
    ... The interpreter would be written in C. ... It is always possible to beat any interpreted language for speed using ... >at me for calling lisp a parsing language... ... I would write a parser to do so. ...
    (comp.lang.python)
  • Re: "Intro to Pyparsing" Article at ONLamp
    ... and then construct the corresponding grammar parser. ... > With data-driven parsing, you are starting with data to be parsed, and you ... I'd like to add another parser type, lets call this a natural language ...
    (comp.lang.python)
  • Re: What is the fastest method of parsing scheme?
    ... Recursive descent parsing is O, ... used to compile the parser, and the hardware used to run ... has been about performance of compilers and interpreters: ...
    (comp.lang.scheme)