Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2874
| From | "Ev. Drikos" <drikosev@gmail.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Why no shift-shift conflicts? |
| Date | 2022-01-28 15:22 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <22-01-117@comp.compilers> (permalink) |
| References | <22-01-112@comp.compilers> |
On 25/01/2022 23:58, Roger L Costello wrote:
> ...
In example, you would care if you wanted to execute some
actions on-shift, assuming you had a supporting tool. In
example, given this grammar fragment, what the parser is
supposed to do, increase or decrease variable 'a' after
reading '1' on input?
X: '1' { a = a + 1; } '2' 'x'
;
Y: '1' { a = a - 1; } '2' 'y'
;
Z: '1' '2' 'z' { a = 0 }
;
Without the mid-rule actions above, any LR based parser is
capable, after reading '1', to shift it onto a stack without
reject any of the above three rules (imagine ie that an LR
parser moves some dot on the above rules after '1', and the
parser state is combination of the alive dotted items). So,
the parser wouldn't see any conflict in such a transition.
Regards,
Ev. Drikos
[The mid-rule action is a cheat, a shorthand for this:
X: '1' x1 '2' 'x' ;
x1: { a = a + 1; } ;
Y: '1' y1 '2' 'y' ;
y1: { a = a - 1; } ;
That's why those actions create conflicts where there were none before.
-John]
Back to comp.compilers | Previous | Next — Previous in thread | Find similar
Why no shift-shift conflicts? Roger L Costello <costello@mitre.org> - 2022-01-25 21:58 +0000
Re: Why no shift-shift conflicts? Kaz Kylheku <480-992-1380@kylheku.com> - 2022-01-28 01:20 +0000
Re: Why no shift-shift conflicts? Andy Walker <anw@cuboid.co.uk> - 2022-01-28 10:13 +0000
Re: Parsing multiple inputs, was Why no shift-shift conflicts? Thomas Koenig <tkoenig@netcologne.de> - 2022-01-28 19:19 +0000
Re: Parsing multiple inputs, was Why no shift-shift conflicts? Andy Walker <anw@cuboid.co.uk> - 2022-01-28 19:42 +0000
Re: Why no shift-shift conflicts? "Ev. Drikos" <drikosev@gmail.com> - 2022-01-28 15:22 +0200
csiph-web