On Sat, Jun 04, 2011 at 10:09:52PM -0400, Hendrik Boom wrote:
On Sat, Jun 04, 2011 at 06:44:57PM -0400, Marc Feeley wrote:
If you want to parse HTML in Scheme, let me recommend htmlprag (http://www.neilvandyke.org/htmlprag/) which is very portable.
This looks like the right kind of thing. Thanks.
There's also, I've been advised, the html package for PLT Scheme, which seems to make extensive use of some kind of inherited object types. htmlprag looks simpler.
Next I suppose I get to wonder whether all this data structure will fit in memory. I have about 8 megabytes of the stuff, and a 1G machine, but the largest individual file seems about 350K. Probably OK, unless gambit is very wasteful of space. I remember Java was terrible at storing small strings. Scheme should be able to do better.
-- hendrik
For the record, I ended up with a sed script, followed by hand-editing the input to the sed script. This wasn't what I had in mind at all when I phrased the original query here, but it worked because the horrible HTML had a very simple pattern.
I don't think it'll work for the next conversion I have to do, though, which looks like it has complex CSS applied to complicated HTML or XML. The CSS is aimed at making things look good in a web browser, with links and stuff. EPUB will probably want it all to be different. Maybe some of these parsers I've been pointed to will still see some real use.
-- hendrik
If you want to generate a lexer or parser yourself, check out Silex and LALR-SCM (Scheme equivalents of lex and yacc), which were developed at the University of Montreal by Danny Dubé and Dominique Boucher respectively (http://www.iro.umontreal.ca/~dube/ and http://code.google.com/p/lalr-scm/).
No, that's not what I'm after -- not this time, anyway.
Marc
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list