25.06.2013 Views

1 transparent par page - Montefiore

1 transparent par page - Montefiore

1 transparent par page - Montefiore

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.

ecause it is one manifestation of the difference between syntax and semantics.<br />

The difference should become clearer once we have studied the various<br />

semantics which follow.<br />

Syntaxe concrète versus syntaxe abstraite<br />

On distingue deux types de syntaxe :<br />

Abstract vs Concrete Syntax Saying that we are using abstract syntax<br />

means that all our programs are <strong>par</strong>sed before we start to worry about them.<br />

In this course, we will never be worried about where the brackets are in an<br />

◮ Syntaxe concrète : programme représenté <strong>par</strong> la suite de caractères<br />

tapés <strong>par</strong> l’utilisateur<br />

◮ Exemple expression : 3 + 4 × like 5<br />

3 + 4 × 5<br />

◮ Syntaxe abstraite : programme représenté <strong>par</strong> une structure basée<br />

because we will never deal with such un<strong>par</strong>sed expressions.<br />

sur la définition récursive, typiquement un arbre<br />

Using abstract syntax in fact means we’re dealing with trees such as<br />

◮ Exemple :<br />

+<br />

×<br />

3 4<br />

although we use linear syntax like ((3 + 4) × 5) forthem.<br />

In this course, brackets don’t matter because we’re always using the linear<br />

syntax as a shorthand for the abstract, tree-based syntax. But of course,<br />

when there’s ambiguity about what abstract syntax tree is meant by a <strong>par</strong>ticular<br />

piece of linear “shorthand”, insert brackets if you think it will help.<br />

Passer de la syntaxe concrète à la syntaxe abstraite s’appelle l’analyse<br />

syntaxique du programme.<br />

Dans ce chapitre, on supposera toujours que la syntaxe abstraite est<br />

connue (pas d’ambiguïté sur la manière dont l’expression est obtenue).<br />

Note that taking an abstract, tree-view of syntax makes it clear that +, ×<br />

and so on are program-forming operations: theytaketwoprogramsandgive<br />

you a new one. One of the points of semantics, <strong>par</strong>ticularly denotational<br />

semantics, is to show that these operations on programs have corresponding<br />

5<br />

154

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

Saved successfully!

Ooh no, something went wrong!