Visite Webhosting Latino, el site sobre alojamiento web.
pure and error correction in ml-yacc - Mombu the Programming Forum
Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > pure and error correction in ml-yacc
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 12th November 15:38
External User
Posts: 1
Default pure and error correction in ml-yacc

I'm building a language of sorts using Standard ML, and I've run into
an interesting little issue.

The problem is that in order to make certain optimizations possible, I
need to resolve variables in the lexer as the file is being parsed in.
That means that the productions' associated smantic actions need to be
evaluated immediately so that the values that have already been read in
can be made available.

By default, ml-yacc delays evaluation of production actions. I've
managed to figure out that the %pure option in the grammar file turns
this behavior off. The problem is that ml-yacc also has this feature
where it will try to parse past syntax errors, calling the production
actions an arbitrary number of times and screwing up the data structure
of values. Now this only happens when there's a syntax error anyway (I
hope!) so it in theory is no big deal. But in order to see the parser
print out the syntax errors, I've had to modify my code in a way that
ignores this behavior of the parser, and the modifications are such
that they might hide other errors in my code--which I don't want to do.

How do people tend to deal with the situation where the lexer and the
parser have to share information with each other? Is there a way to
tell the parser not to do its error-correction dance? That is, set the
parser guesser to zero? I think the ml-yacc do***ent mentioned there's
a plain non-error-correcting parser available but I can't find anything
about it.

Much obliged for any advice,

  Reply With Quote

  sponsored links


Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -