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

Re: gnubol: Re: which parser tool



Bob,

The problem with shuffling the tokens around, as with renaming tokens and adding
extra fake tokens (eg to delimit statements) is that it messes up the error
messages. You can do this better IMHO by changing the token types.

I think this will confuse the programmer. I have found three areas of problems
here:

- changing token names to tell the parser what's coming (eg end-if); or to give
it symbol table information
- adding token names to delimit constructs to help to construct error productions

- resequencing tokens to support LALR(1) parsers.

You can hack around to get past the renaming fairly easy. In my test parser I use
this technique

tk_M_generic_name_M_condition_name_M

The original token name was

tk_generic_name

The new name is

tk_condition_name

So it's a bit like a sed s/a/b/ statement. I an scan for this in the error
messages and fix them up to meaningful values including removing tk_.

So:

syntax error: expecting with or like, got condition_name



Tim Josling

RKRayhawk@aol.com wrote:

> In a message dated 11/21/99 12:36:50 PM EST, TIMJOSLING@prodigy.net writes:
>
> <<
>  1. section names require 2 token lookahead. Easy fix via prescan.
>      a section.
>      a section.
>      a.
>
> >>
>
> A really neat hack would be an intercept that reverses section-name and the
> SECTION token. That could help immensely with dangling preceeding statements.
>




--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.