- PowerPoint PPT Presentation

About This Presentation
Title:

Description:

Title: PowerPoint Author: Last modified by: ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 30
Provided by: 7026
Category:
Tags: ocha

less

Transcript and Presenter's Notes

Title:


1
??????
  • semantics (???) ????????? method (??) ???????
  • ??? (?) ????? method ?????????????
    (??????????????)
  • ??? method ???????????

Specify ??????? illustrate ??????????
application ????????, ??
2
????????
  • semantics ?????????????????????
  • ?????????????????????
  • ? syntax ? semantics ????????????????
    (???????????)

Represent ?? implementation ??, (??????)
analysis ??
3
Syntax ? Semantics
  • Syntax grammatical structure(??,??)
  • parser ????????
  • Semantics the meaning (??)
  • ???????????????

Syntax analysis ????
4
Semantics ?3????
  • Operational semantics ???????
  • Denotational semantics
  • ?????????
  • Axiomatic semantics
  • ??????????????

Execute ???? Construct ?? (syntax
??????????) Effect ??, ?????
(????????????????????????) Statement ???
Sequence ??
5
?
  • z x x y y z
  • (x ? y ????????????????)

Assign ???, ????, ????
6
Operational semantics
  • zx xy yz ???????????
  • ? ???????????????????????
  • ( ??????)

A variable followed by ? (??) ????????????
zx ?? z ????????????????
7
Structual operational semantics
  • ????????????????????????(small-step semantics)
  • ????????????????????????????
  • ??????????? derivation sequence ??? (P3 ???)

Abstraction ?? abstract ??? derivation
?? Derivation sequence ???????
8
Natural semantics
  • ??????????state (??) ?????????????????????
  • ???? state ????????????????????? (big-step
    semantic)
  • ????? state ???????????????derivation tree
    (???) ??? (P.3 ???)

abbreviation ??
9
Denotational semantics
  • ???????????????????????? (P.4 ?????)
  • ????z x ??z ????????????????
  • ??????????????????????
  • ???????????????????????? (Chapter 5 ???????????)

Reason ???? functional composition ????
apply ????
10
Denotational Operational
  • ???????? (?) ????? Denotational semantics ???
  • ??????? implement (??) ???? Operational
    semantics ???
  • Operational ? Denotational ????????????? ?
    Chapter 4.3 ??????

Equivalent ??? be adapt to ?????
11
Axiomatic semantics
  • ????????????? Precondition (????) ?
    Postcondition (????) ????????????
  • precondition construct postcondition
  • ?????
  • ????????????????????????????(???????????)

Partial ??????????????????(???????)?????
(????) total ??????, ????????????????
12
Pre ?? Post ??????
  • ????????????
  • ????2???????????????????????????????????????????
    ????a, b, c ??????????
  • a ! 0, b2 - 4ac gt 0
  • ?2???????????????????precondition ???

Partial correctness property (?????????????????)
??????
13
Pre ?? Post ??????
  • ??????????(?) ????????? x ??????? (????)
    ???????????????? Postcondition ???

???????????? assertion ?????(????????????)
????????????????????????????????????????????!???
?????????????????? ? ?????????????????????? Precon
dition ?? Postcondition ? (???? axiomatic
semantics ?) ?????????????? construct
??????????????????????assertion ??????????????
14
????? Axiomatic
  • ???????????????????????????? (P.6 ???)
  • ???? ????????????????????????????????? (P.6
    ???)
  • Axiomatic semantics ???????????????????????????

Specification ??(?)
15
?????
  • 3?? semantics ? While ????????
  • 3?? semantics ??????? While ???????????????
  • While (????) ?????3????????????
  • ????????????????????????????????

3?? semantics ?????????????????????????????
16
While ??
  • ??????????????? (???P.7)

BNF ??????????????????(???????)
?????? Syntactic category ???? cf.????
???????? ??? ?? ????? ?? Meta-variables ????
???????????????syntactic category ?????? ????
???? n, (?????????)???? str ??????? Range over
????, (??, ?????????) Numeral (syntactic
category ????) ? Arithmetic expressions ?????
(???) ??????? (?????) Boolean expressions
????????????? (?????) Statement ???
17
While ??
  • ????????????????????????????????? (syntax tree)
    ??????????
  • ???????????? (?????????)
  • ?????????????????? syntactic category
    ?????????????
  • ? () ?????????????
  • ? ??????? - and or not ????????????????????

Primed ???????? subscripted ?????????
string (??????) ??? digit (??????) ??
Letter ?? (???????) Basis element ???? b ?
expression ???? b ??????? Composite element ????
b ? expression ???? b ?????
18
While ??
  • While ?? (??????????) ?????Semantic function
    (????, ??) ?????????
  • Semantic function ???????????????

Entity ?? (syntax ?????????????) assume
???? Syntactic entity (syntax ??????????????)
argument ?? Assign ????????? Semantics
function ???? ????????P.7 ? syntax
??????????? (syntactic entity) ?????????????
(???????????????) ???????? (??????)
19
???? Semantics
  • ??!!
  • ?????????numerals ?2???????
  • ??????10???????????????2????????????????????????
    ???

Binary system 2??
20
??????????
  • P.9 ?????
  • ? syntactic entity ? semantics (meaning)
    ????????????????? (????????????????)
  • ?????????????????????

Number (???????10???) ? Total function
??????????????????????? clause ? bracket
???? (???????, ??????????????????) Corresponding
(???1?1?) ???? application ?? Semantics
clause ???????????? P.10 ?????????????????? Equa
tion ???
21
N ????????
  • P.10 ??????
  • P.9 ? numeral ??????????????
  • ? ?????????? syntax ???
  • (???? syntax ??????????????????)
  • ? ???? semantics (meaning) ???????????????????
  • ??????? syntactic entity ????? semantics ???
    (?????????)

Compositional definition ???? Obtain ??
Subconstruct construct ???, ???
22
N ? well-defined ?????
  • P.10 ????P.11???

Well-defined ??????????? cf. ????? Induction
?????? Base case ????????????? Induction
step n ????????????n ???? ???? Hypothesis
?? Hold ?????, ???? Omit ?? ex. The case ?
is similar and we omit the details.
23
Compositional definition
  • syntactic category ? basis element ? composite
    element ?????(???)?????????
  • syntactic category ???? element ?????semantic
    clause ??????Composite element ???????????????????
    ??

Immediate constituents of the element Composite
element ??????????? syntactic category ???????
????????????? ????b ?????b1 b2 ? b1 ? b2 ????
24
Compositional Definition
  • composite element ?????????????? syntactic
    category ????????
  • ??????????????????????
  • ? composite element ????????????????? basis
    element ????????????!
  • ????????(?????)

Immediate constituents of the element Composite
element ??????????? syntactic category ???????
????????????? ????b ?????b1 b2 ? b1 ? b2 ????
25
Structual Induction
  • compositional definition ??????
  • ???basis element ???????????????
  • ???composite element ??immediate constituents
    of the elements ?????????????? (induction
    hypothesis) ?????????

Structual Induction ????? ? ????? numeral
???10?????
26
Semantic function
  • ????????(?)?????
  • ? ????????????????????

Semantic function ????
27
State
  • ??????????????????
  • ?? ???? (state ??????????)
  • ?? s ??? x ??????????
  • s x
  • ???
  • ??????????????????

State ??, ??
28
???? A
  • expression ? state ??????????
  • ? expression ? state ????????????? (A) ?????
  • p.9 ??????A ? AExp ?????state
    ??????????????????????state????????????????????
  • ???? ? ?????????

Functionality ???, ?
29
???? A
  • ???? (??) ??? p.10 ???
  • Compositional Definition ????????? A
    ???????????????? syntactic entity ???? (immediate
    ?) ??????
  • ????????????????????????? semantic
    ???????????? (??????????)

Sum ? product ? difference ?
Write a Comment
User Comments (0)
About PowerShow.com