Title: XML ????????
1???????????????????????????????????????
- ?? ?? (????)
- ?? ?? (??????)
- ?? ?? (??????)
2XML ????????
- ?????
- ????????????
- ? DOM API, XDuce, CDuce
- ???????
- ?????????????????
- ? SAX
3?????
?????
???
????, ??????
ltnodegt ltleafgt2lt/leafgt ltleafgt3lt/leafgtlt/nodegt
ltnodegt ltleafgt3lt/leafgt ltleafgt4lt/leafgtlt/nodegt
4???????
???
????, ??????
?????
ltnodegt ltleafgt2lt/leafgt ltleafgt3lt/leafgtlt/nodegt
ltnodegt ltleafgt3lt/leafgt ltleafgt4lt/leafgtlt/nodegt
5????????????????
????? ???????
??? ?
????? ?
6?????
?????
???
????, ??????
ltnodegt ltleafgt2lt/leafgt ltleafgt3lt/leafgtlt/nodegt
ltnodegt ltleafgt3lt/leafgt ltleafgt4lt/leafgtlt/nodegt
7?????
????????????????????????
???
????, ??????
ltnodegt ltleafgt2lt/leafgt ltleafgt3lt/leafgtlt/nodegt
ltnodegt ltleafgt3lt/leafgt ltleafgt4lt/leafgtlt/nodegt
?????
8?) ?????1??????????
- ?????
- fix f. ?t. case t of leaf x ?
leaf (x 1) node x1 x2 ? node (f x1) (f x2) - ???????
- fix f. ?t. case read() of leaf ?
write(leaf) write(read() 1) node ?
write(node) f () f ()
???????????
9??????????????
? ??????????????????????
10???????????...
- ?????????????????????????????
- ????? ????, ?????
- ??? ?????????????
- ????????????, ???????????????????????
11?????
- ?????????????????????????
- ??????????????
- ???????????????????????
- ??????????????????
- ???????????????????
- ???????????????????
- ?????????????
12?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
13?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
14?????????????
- ????? ?????
- ????????????
- ??? ???????????
- ??????? ???????
- ???????????????????
- ??? ?????????????
15?????? syntax
- M (?) i (??) x ?x.M M1 M2
M1 M2 fix f. M leaf M node M1
M2 (case M of
leaf x ? M1 node x1 x2 ?
M2)
16??????
- ???? 1 ?????????? fix f. ?t. case t of
leaf x ? leaf (x 1) node x1
x2 ? node (f x1) (f x2)
17???????? syntax
- e (?) i x ?x.e () e1 e2
e1 e2 fix f. e leaf node
read e write e (case e of
leaf ? e1 node ?
e2)
node (leaf 1) (leaf 2) ?node leaf 1 leaf 2
??? ???????? (?????????)
18??????
- ???? 1 ???????????? fix f. ?x. (case read
() of leaf ? write leaf write (read()
1) node ? write node f () f ())
19?????? (??)
- ????????
- fix f.?t.(case t of
- leaf x ? leaf (x 1) node x1 x2 ?
node (f x1) (f x2)) - ??????????
- fix f.?t.(case read() of
- leaf ? write(leaf)write(read()1) node
? write(node)f ()f ())
20?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
21?????
- ?????????????????????????
- ????????????????????
- ?????????, ???????? 1 ???????
- ????????????
22?? syntax
- t (?) Int t1 ? t2 Treed
- d (???) - (??) (??)
???? (Tree-) ????? (Tree) ???
23???????
- (????) ??? G
- x1t1, x2t2, ..., xntn (ti ? Treed)
- ????????
- ??????????????????
- ????????? ?
- x1Tree-, x2Tree-, ..., xnTree-
- ???????
- ?????????????????????????
24???
G ? M t
- M ?????????? G, ? ????????
- ???????, M ???????t?????,
- ???? ? ??????????????
25?????
- G f Tree- ? Tree ???
- G x1 Tree-, x2 Tree-
- node (f x1) (f x2)
Tree - G x1 Tree-, x2 Tree-
node (f x2) (f x1) Tree
26????? (1/3)
(T-VAR1)
GxTree xTree
-
-
(T-VAR2)
G,xt Ø xt
???????????????????? ??????????????
27????? (2/3)
GxTree M t
-
(T-ABS1)
-
GØ ?x.M Tree ?t
G,xt1ØM t2
(T-ABS2)
GØ ?x.M t1?t2
28????? (3/3)
G?1M1 Tree G?2M2 Tree
(T-NODE)
G?1,?2 node M1 M2 Tree
-
G?1M Tree G,xInt?2M1 t Gx1Tree ,x2Tree
,?2M2 t
-
-
(T-CASE)
G?1,?2 case M of leaf x ? M1 node x1 x2 ? M2 t
29????
GØ f Tree- ?Tree Gx1Tree- x1 Tree
Gx1Tree- f x1 Tree Gx2Tree- f x2
Tree
GtTree- t Tree- GxIntØ leaf (x1)
Tree Gx1Tree-,x2Tree- node (f x1) (f x2)
Tree
GtTree-case t of leaf x gt leaf (x 1)
node x1 x2 gt node (f
x1) (f x2) Tree
GØ?t.(case t of leaf x gt leaf (x 1)
node x1 x2 gt node (f x1) (f
x2)) Tree- ? Tree
ØØ fix f.?t.(case t of leaf x gt leaf (x 1)
node x1 x2 gt node (f
x1) (f x2)) Tree- ? Tree
(???G fTree- ? Tree???)
30?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
31????????
- A(x) x
- A(i) i
- A(?x.M) ?x.A(M)
- A(M1M2) A(M1)A(M2)
- A(M1 M2) A(M1) A(M2)
- A(fix f.M) fix f.A(M)
- A(leaf M) write(leaf)write(A(M))
- A(node M1 M2) -gt write(node)A(M1)A(M2)
- A(case M of leaf x gt M1 node x1 x2 gt M2)
- (case A(M)read() of
- leaf gt let xread() in A(M1)
- node gt ()/x1,()/x2A(M2))
32???
- A(fix f.?t.(case t of
- leaf x ? leaf (x 1) node x1 x2 ? node
(f x1) (f x2))) - fix f.?t.(case tread() of
- leaf gt let x read() in (write(leaf)write(x
1)) - node gt write(node)f ()f ())
33??????
- ????????????, ??????????????
- ???????, ??????????????????????????????
34?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
35???????????
- ?????????????
- ????????
- ???????????
- ??? XML ????
- ????????? 2 ???
- ????????
- ??????????????????
??????????
36?????
- ???????
- ???????????????????
- ????????????????????
- ??????????????????
- ?????
- ??????? ?? (MTree) ???
- ???????, MTree?????????
- ???????????????
- ?????????????
37???????????
- e (?) i x ?x.e () e1 e2
e1 e2 fix f. e leaf node
read e write e skip e memtree e
(case e of leaf ? e1 node ? e2)
(mcase e of leaf x ?
e1 node x1 x2 ? e2)
38????
- t (?) Int t1 ? t2 Treed MTree
- d (???) - (??) (??)
39??????
- ?????????????????
- ??????????????
G ? M t ? e
M ?????????? G, ? ???????? ???????, M
???????t?????, ???? ? ?????????????, M ??????
????????? e ???
40????????? (????)
(T-MEMTREE)
G ? M t ? e
(T-SKIP)
G xTree-, ? M t ? let x skip () in e
41?????
- ????? syntax
- ?????
- ??????????????
- ??????
- ????
- ???
42????
- ????????XML?????????????(?? 03)
- ?? ??????????????????
- ?? ???????????????
- XML?????????????XP(??,?? 03)
- ?? ?????????????
- ?? ???????????????
43????
- Ordered Linear Logic and applications.(Polakow
01) - A type theory for memory allocation and data
layout. (Petersen et al. 03) - ?????????????????
44???
- ???????????????????????????????????????
- ????????????????????????????????
- ?????????
45Fin
46?) ?????1??????????
- ?????
- let rec f t match t with
Leaf x ? Leaf (x 1) Node x1 x2 ? Node
(f x1) (f x2) - ???????
- let rec f () match read () of Leaf ?
write Leaf write (read() 1) Node ? write
Node f () f ()
47????????? (????)
(T-MEMTREE)
(T-MCASE)