On 10/16/2012 07:27 AM, Alexei Golovko wrote:
Can someone suggest some parser generator, suitable for pure strict
lambda calculus?
For example, does it make sense to try PEG like in
http://www.impredicative.com/pipermail/ur/2011-February/000520.html ?
I don't think any parser generators have been written for Ur yet.
Personally, I would just write a direct recursive descent parser for XML
(and that is what I did in the Feed library).
If you run into performance problems with a direct recursive descent
parser, then probably it's a fundamental limitation with
optimization/code generation to JavaScript in the Ur/Web compiler.
12.10.2012, 17:12, "Alexei Golovko" <[email protected]
<mailto:[email protected]>>:
I parse them to list of elements:
datatype myXml =
Text of string
| Open of string * list { N : string, V : string } * option string
| Close of string
| Other
I've attached related modules, but the main problem is that I don't
want to write full XML parser (dealing with entities, for example).
Current code does not cover all cases (it is dirty and seems to have
a silly bugs even with escaping; I have used it for two test files
only for work with UI part). Probably, it is better do not invest
time to optimization...
12.10.2012, 16:53, "Adam Chlipala" <[email protected]
<mailto:[email protected]>>:
OK, then I'd expect to parse fragments into a simple tree datatype.
Maybe if you point us to an example of your parsing code, I can give
some advice on making it faster. (Linear-time/space parsing of
strings in pure Ur code should be pretty easy, if you use the right
standard library functions.)
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur