Re: Is there a way to have two "cases" with one method?
Hans Åberg <[email protected]> Mon, 22 Aug 2022 21:04:48 +0200
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
> On 22 Aug 2022, at 18:12, Maury Markowitz <[email protected]> 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;