10.02.2013 Views

Foundations of Software - LAMP - EPFL

Foundations of Software - LAMP - EPFL

Foundations of Software - LAMP - EPFL

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.

The Basic Idea<br />

For each language (identified by grammar symbol S), define a<br />

function fS that, given an input stream i,<br />

� if a prefix <strong>of</strong> i is in S, return Success(Pair(x, i ′ )) where x is<br />

a result for S and i ′ is the rest <strong>of</strong> the input.<br />

� otherwise, return Failure(msg, i) where msg is an error<br />

message string.<br />

The first behavior is called success, the second failure.<br />

29

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

Saved successfully!

Ooh no, something went wrong!