[plt-scheme] Parser error...
On 16/03/06, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
> Paulo J. Matos wrote:
> > Hi all,
> >
> > I've developed a CNF parser using srfi 1, readline and tokenize
> > combinations but compared to a C parser this one takes brutally
> > longer, so I decided to give parser tools a try, which I never did
> > before, having only experience with lex/yacc in C. I developed the
> > parser, ran it on a valid CNF file and... Error! Which one? You tell
> > me... I got this:
> > parser: Cannot continue after error
> >
> > Is there a way to debug the parser so that I can know what's really
> > happening... it is not even indicating me a line or something.
> >
> > Any tips would be great. In any case if you wish to check the parser
> > and the input file I can send it in...
>
> Did you use (error <expr>) in the parser specification? [And did you
> record the source location in the tokens?]
>
OK, you got me... :) I just merely checked the examples calc.ss and
read.ss and the initial text... I didn't want to lose much time
reading all the text in the doc.
Thanks for clearing me out instead of using the well-known you know
what I deserve 4 letter acronym. ;)
Cheers,
Paulo Matos
> > (parser args ...) where the possible args may come in any order (as
> long as there are no duplicates and all non-optional arguments are
> present) and are:
>
> ...
>
> > (error expression) expression should evaluate to a function which
> will be executed for its side-effect whenever the parser
> encounters an error. If the src-pos option is present, the
> function should accept 5 arguments,
> (lambda (token-ok token-name token-value start-pos end-pos) ...).
> Otherwise it should accept 3,
> (lambda (token-ok token-name token-value) ...).
> The first argument will be #f iff the error is that an invalid
> token was received. The second and third arguments will be the
> name and the value of the token at which the error was detected.
> The fourth and fifth arguments, if present, provide the source
> positions of that token.
>
> --
> Jens Axel Søgaard
>
>
>
--
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group