new version of Parser Combinators and Syntax Macros's (beta)

2002-03-07 Thread S. Doaitse Swierstra
Title: new version of Parser Combinators and Syntax
Macros's


At:

http://www.cs.uu.nl/groups/ST/Software/UU_Parsing

you will find the latest/greatest version of our combinators,
that are:

- faster (faster than Parsec)
- correct much faster
- compute results lazily, and produce error messages online in
the IO monad while parsing
 (using unsafeInterleavedIO)
- are compatible with the syntax macro mechanism we have
implemented (beta):
 http://www.cs.uu.nl/~arthurb/index.html

Doaitse
-- 

-- 

__
S. Doaitse Swierstra, Department of Computer Science, Utrecht
University

P.O.Box 80.089, 3508 TB UTRECHT, the Netherlands

Mail:
mailto:[EMAIL PROTECTED]

WWW: http://www.cs.uu.nl/


tel: +31 30 253 3962

fax: +31 30 251 3791

mobile: +31 6 2880 1680
__



new version of parser combinators

2001-06-23 Thread S. Doaitse Swierstra

We have been working hard on new versions of the Parser Combinators 
and AG system, with the following improvements:

  even better error repairs
  much faster and simpler basic parsing machine
  permutation (of different types) and list combinators
  extensive reporting about repairs made and what was expected
  the possibility to manipulate your own state during parsing
   and result construction, using classed based (like monads) interfaces

As an example of the permutation combinators we parse a permutation 
of three elements:

   1) a list of 'a's
   2) a 'b'
   3) an optional 'c'

which is described by:

permtest :: Parser Char (String, Char, Char)
permtest = permute $ (,,) ~$~ pList (pSym 'a') ~*~ pSym 'b' ~*~ pOptSym 'c'

pOptSym :: Char - Parser Char Char
pOptSym x = pSym x | pSucceed '_'


which we try on several inputs resulting in:

t permtest acb
Result:
(a,'b','c')

t permtest cdaa
Errors:
Symbol 'd' before 'a' was deleted, because 'b' or ('a')* was expected.
Symbol 'b' was inserted  at end of file, because 'a' or 'b' was expected.
Result:
(aa,'b','c')

t permtest abd
Errors:
Symbol 'd' at end of file was deleted, because 'c' or eof was expected.
Result:
(a,'b','_')

t permtest 
Errors:
Symbol 'b' was inserted  at end of file, because 'c' or 'b' or ('a')* 
was expected.
Result:
(,'b','_')

The manual is still of an earlier version and will be adapted soon. 
As an example of the combinators we provide a parser for bibtex 
files, that returns the repairs made to the erroneous  entries (as 
far as we understand the bibtex format).


   I hope this is useful to you,
Doaitse Swierstra

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell