29.04.2015 Views

Syntax Analysis

Syntax Analysis

Syntax Analysis

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Recursive Descent Predictive Parsing (RDPP)<br />

(ASU Ch 2.4)<br />

• Define the (disjoint) sets “first” for each NT on RHS of P<br />

– first() = {integer, char, num}<br />

– first(^id) = {^}<br />

– first(array …) = {array}<br />

• PP (predictive Parser) requires<br />

– procedure for every NT - takes action based on first(a) for a<br />

on the RHS of a production P (using lookahead)<br />

– RHS of P<br />

• NT => call to corresponding procedure<br />

• T => match expected token with actual token (no match =><br />

error) and get next token<br />

– left recursion may have to be removed from the grammar<br />

2<br />

14/10/2014 DFR - CC - <strong>Syntax</strong> <strong>Analysis</strong>

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

Saved successfully!

Ooh no, something went wrong!