help-bison
[Top][All Lists]
Advanced

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

Re: Is there a way to have two "cases" with one method?


From: Hans Åberg
Subject: Re: Is there a way to have two "cases" with one method?
Date: Mon, 22 Aug 2022 21:04:48 +0200

> On 22 Aug 2022, at 18:12, Maury Markowitz <maury.markowitz@gmail.com> wrote:
> 
> In my BASIC interpreter’s bison code I have one of these:
> 
>  CHANGE variable TO variable
…
> CHANGE is from the original Dartmouth BASIC. It turns out that HP included an 
> identical feature in their dialect, CONVERT. So I did:
…
>  CONVERT variable TO variable
> Works great.
> 
> My question is whether there is a simple way to combine the two to eliminate 
> the duplicated code?

For example:

CHANGE_or_CONVERT variable TO variable;

CHANGE_or_CONVERT: CHANGE | CONVERT;





reply via email to

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