1 / 12

CHA2545: WEEK 4

CHA2545: WEEK 4. LECTURE: DENOTIONAL SEMANTICS OF A SIMPLE LANGUAGE TUTORIAL: Do exercises given out DURING THE WEEK: Go through ARJ’s supporting WEB notes (from main web page). The Four Parts of a Semantic Definition:. Syntactic domains Abstract Syntax Semantic Domains

ferrol
Download Presentation

CHA2545: WEEK 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHA2545: WEEK 4 LECTURE: DENOTIONAL SEMANTICS OF A SIMPLE LANGUAGE TUTORIAL: Do exercises given out DURING THE WEEK: Go through ARJ’s supporting WEB notes (from main web page).

  2. The Four Parts of a Semantic Definition: • Syntactic domains • Abstract Syntax • Semantic Domains • Meaning Functions Example syntax domains (see handout) Nml, Ide, Exp, Cmd

  3. DENOTATIONS • The semantics of the various syntactic structures of a language is defined via meaning functions which take the syntactic structure as a parameter and returns its denotation. • A “denotation” is a mathematical representation of the meaning of a construct - its an object belonging to a SEMANTIC DOMAIN.

  4. SEMANTIC DOMAINS - Examples Simple Semantic Domains - T - truth values N - natural numbers Z - integers Complex Domains are made up by combining Simple Domains with operators such as +, x, ->

  5. COMPLEX DOMAINS - Examples • Disjoint Union Domain of all integers and truth values Z + T • Cross Product Domain of all pairs of integers Z x Z • Function Domain consisting of all functions from integers to truth values Z -> Z and pairs of integers to integers (Z x Z) -> Z

  6. COMPLEX DOMAINS - Another Example All “expressible” values in a simple programming language with truth values and natural numbers: E = N + T + {error}

  7. The STORE • The simplest way to represent the STATE of program execution is by a STORE - representing the values stored at any point in the execution of a program. • The store is represented by a function domain S = [ Ide -> E ] + {error} We usually let ‘s’ be a typical store or state.

  8. Commands • Commands change the program state The domain of commands is therefore the functions between states, i.e. S -> S

  9. Semantic Function: Emeans Emeans takes a syntactically well formed expression, and gives it a denotation in terms of a function between stores and expressible values so Emeans : Exp -> S -> E The definition of Emeans depends on the syntactic subclass to which it is applied.

  10. Semantic Function: Cmeans Cmeans takes a syntactically well formed command, and gives it a denotation in terms of a function between stores and stores so Cmeans : Cmd -> S -> S The definition of Cmeans depends on the syntactic subclass to which it is applied

  11. The Problem with Recursive Functions - what do they mean? Cmeans[[while B do C]] = ls.(Emeans[[B]]s -> Cmeans[[while B do C]](Cmeans[[C]]s), s) OR: Cmeans[[while B do C]] = f where f = ls.(Emeans[[B]]s -> f(Cmeans[[C]]s), s)

  12. Recursive Functions - The Fixpoint Equation Given: f = ls.(Emeans[[B]]s -> f(Cmeans[[C]]s), s) Then: H = lf.ls.(Emeans[[B]]s -> f(Cmeans[[C]]s), s) Hf = (lf.ls.(Emeans[[B]]s -> f(Cmeans[[C]]s), s)) f = ls.(Emeans[[B]]s -> f(Cmeans[[C]]s), s) = f SO WE HAVE Hf = f - the fixpoint equation!!

More Related