[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] lexgen examples

From: Ivan Raikov
Subject: Re: [Chicken-users] lexgen examples
Date: Mon, 08 Jun 2009 13:51:16 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Hi Matt,

   I recently changed the interface of the lexgen procedures, and I did
not document my changes. Apologies about that.  The lexgen parsers
actually take two arguments, a continuation procedure and a list of
streams. So the first example would actually be:

(define a-pat (tok #\a (try char=?)))
(define abc-stream      (list `(() ,(string->list "abc"))))

(a-pat (lambda (s) (print "a-pat result: " s)) abc-stream)

You can find more examples in the lexgen tests found in file
tests/run.scm in the lexgen trunk directory:

Please let me know if you have any other questions.


Matt Gushee <address@hidden> writes:

> Hello chickeneers--
> As part of trying to learn the lexgen egg, I am trying to run the
> examples from the documentation, but I am getting errors.
> First, I tried an example from an older version of the docs:
>   csi> (define a-pat (tok #\a (try char=?)))
>   csi> (define abc-stream (list `(() ,(string->list "abc"))))
>   csi> (print (a-pat abc-stream))
>   Error: bad argument count - received 1 but expected 2: #<procedure>
>       Call history:
>       <syntax>                (print (a-pat abc-stream))
>       <syntax>                (a-pat abc-stream)
>       <eval>          (print (a-pat abc-stream))
>       <eval>          (a-pat abc-stream)      <--
> When I run the "numpat" example from the current version, I get the
> same error.
> I note that the doc says:
>   Every combinator procedure in this library returns a procedure that
>   takes in a list of streams as an argument.
> "A list," thus one argument, correct? So the example code is
> consistent with the description.
> So clearly something is broken. Is it
>   a) the egg code itself;
>   b) the docs; or
>   c) my installation?
> Please advise, and thanks for any info.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]