17.01.2015 Views

S - Intranet - Department of Computer Science: Login

S - Intranet - Department of Computer Science: Login

S - Intranet - Department of Computer Science: Login

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Parser Conflict Resolution<br />

Example: “dangling-else” problem (from Mini Triangle grammar)<br />

single-Command<br />

::= if if Expression then single-Command<br />

| if if Expression then single-Command<br />

else single-Command<br />

LR(1) items (in some state <strong>of</strong> the parser)<br />

sC ::= if E then sC • {… else …}<br />

sC ::= if E then sC • else sC {…}<br />

Shift-reduce<br />

conflict!<br />

Resolution rule: shift has priority over reduce.<br />

Q: Does this resolution rule solve the conflict What is its effect<br />

on the parse tree<br />

45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!