[Haskell-cafe] parsing machine-generated natural text

Evan Martin martine at danga.com
Sat May 20 20:46:07 EDT 2006

On 5/21/06, Udo Stenzel <u.stenzel at web.de> wrote:
> do power
>    colon
>    integer
>    reserved "Supply centers,"
>    integer
>    reserved "Units:"
>    ((reserved "Builds" >> return id) <|>
>         (reserved "Disbands" >> return negate))
>         `ap` integer
>    reserved "units." <|> reserved "unit."
> Come on, it isn't nearly as bad as you make it sound.  Use the
> combinators, they are far more powerful than ugly never-quite-correct
> regexes.

Thanks!  I had looked at using the lexeme parser before but it didn't
seem like you can make newlines significant.  Here's the beginning of
the file, where it's not obvious to me how to distinguish elements in
the "::" section from the rest of the file.
  :: Judge: USDP  Game: dip  Variant: standard
  :: Deadline: F1901M Mon 20 Feb 2006 20:00 PST
  :: URL: http://www.diplom.org/dpjudge?game=dip

  Movement results for Fall of 1901.  (dip.F1901M)
I guess I could make "Movement" a reserved word?

> Oh, and drop me a line when your Diplomacy bot is finished.


It's actually just for rendering nicer maps of the game state.
(It's draggable, too.)

I was trying to do it with Firefox's SVG+XUL but it's terribly slow,
XUL isn't quite there yet, and doing a large app with JavaScript is
http://neugierig.org/software/darcs/xuldip/dip.xul  (no install
necessary; only works in Firefox)

More information about the Haskell-Cafe mailing list