Hi Ricky,

Just curious: What actually terminates an 'expr' production? For example,
if they were terminated by newlines and the parser encountered this token
do you intend to treat that as a "missing right-hand-side of SINGLE_SPACE
operator" error?

Likewise, I guess you're saying that this token stream:
would generate a syntax error, penalizing the user who accidentally (or to
make things line up) uses two spaces instead of one?

Trying to figure out exactly where the context boundaries are within which
you want white space to become significant.


On Thu, Dec 1, 2016 at 8:19 PM, Ricky Zhang <zhangchaow...@gmail.com> wrote:

> I have read through 'handling context dependencies' section Bison manual.
> But I still haven't figured out the proper solution to my problem.
> We have production rule:
> expr : expr SINGLE_SPACE expr { /* some operation */ }
>         | expr + expr
>         ...
>         ;
> expr: NUMBER
>        | ID
>        ;
> and also for all white space [SINGLE_SPACE | \t]* in the language should be
> ignored. Are there any easy way to solve it?
> Thanks,
> Ricky
> _______________________________________________
> help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to