Joseph K. Myers
Sunday, February 1, 2004
The markup language I have invented is a strong improvement over XML and similar concepts.
I've written a parser in JavaScript.
<script type="text/javascript" src="ml.js"> </script>
If you wish to load a set of XML and other various sources to test the parser, then open the markup language parser fully loaded with source libraries.
Note: some large XML sources are difficult to load within a textarea. If this is the case, then you must follow these steps in order to parse them.
A markup tree is made of children/parents with
properties
child.name
,
child.y['attribute']
,
and parent.children
.
The only effect of a </label>
disjuncture is to create a new anonymous child,
without children
. The purpose of anonymous
children is to handle substrings between any parsed
tags, which otherwise would have no logical order in
the tree.
Because the markup parser, as JavaScript, cannot
alter processing, processing instructions
as <?y-string?>
by definition won't be used in their most essential
purpose.
Other members share the characteristics of having
children, zero or greater, and being the child of
a parent
.
The parser does a number of jobs, part of which can't be optimized, and part of which can. Dividing the processing time up into percentages of different tasks helps one realize which things can be improved.
Removing comments: 65;94 ms, 2.3;1.2 %
Splitting string: (171;226 ms) + 106;132 ms, 3.8;1.7 %
Tree: (2054;4938 ms) + 1883;4712 ms, 68.7;62.7 %
Names and attributes: (2737;7506 ms) + 683;2568 ms, 24.9;34.2 %
Legend: Firebird;Safari
The evaluations were performed by returning from the parsing function after a given step, and taking the percent of the mean time from the mean time of total parsing.
Error handling is rather unobtrusive. However, without it would be 2629 for Firebird, or 7364 for Safari, for example.
The kjs engine has an optimization problem when compiling scripts with a large number of separated strings concatenated together in source code. (I.e., 'a...' + 'b...' + ...). The optimization which should be performed is compile a single string, rather than forming string objects separately prior to joining together.
This is observed when loading the source code of the W3C XML 1.0 version 2 document, as generated by Jsinc. A browser is put down for a lengthy amount of time before it responds, while receiving the fully loaded version of this page.
1-31-04. This has been remedied by using other options; however, the problem still exists.