annotate slide.html @ 17:a176ea5c0264

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 19 Apr 2019 23:22:02 +0900
parents d3036d998236
children 1fc9d0bd924f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
1
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
2
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
3
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
4
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
5
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 <!DOCTYPE html>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 <html>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 <head>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 <meta http-equiv="content-type" content="text/html;charset=utf-8">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 <title>Perl6の内部表現</title>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
12 <meta name="generator" content="Slide Show (S9) v4.1.0 on Ruby 2.6.3 (2019-04-16) [x86_64-darwin17]">
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
13 <meta name="author" content="Takahiro Shimizu" >
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 <!-- style sheet links -->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 <link rel="stylesheet" href="s6/themes/projection.css" media="screen,projection">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 <link rel="stylesheet" href="s6/themes/screen.css" media="screen">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <link rel="stylesheet" href="s6/themes/print.css" media="print">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <link rel="stylesheet" href="s6/themes/blank.css" media="screen,projection">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <!-- JS -->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 <script src="s6/js/jquery-1.11.3.min.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 <script src="s6/js/jquery.slideshow.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 <script src="s6/js/jquery.slideshow.counter.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 <script src="s6/js/jquery.slideshow.controls.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 <script src="s6/js/jquery.slideshow.footer.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 <script src="s6/js/jquery.slideshow.autoplay.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 <!-- prettify -->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 <link rel="stylesheet" href="scripts/prettify.css">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 <script src="scripts/prettify.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 <script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 $(document).ready( function() {
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 Slideshow.init();
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 $('code').each(function(_, el) {
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 if (!el.classList.contains('noprettyprint')) {
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 el.classList.add('prettyprint');
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 });
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 prettyPrint();
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 } );
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 </script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 <!-- Better Browser Banner for Microsoft Internet Explorer (IE) -->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 <!--[if IE]>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 <script src="s6/js/jquery.microsoft.js"></script>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 <![endif]-->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
52
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 </head>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 <body>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 <div class="layout">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 <div id="header"></div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 <div id="footer">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 <div align="right">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 <img src="s6/images/logo.svg" width="200px">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 <div class="presentation">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 <div class='slide cover'>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 <table width="90%" height="90%" border="0" align="center">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 <tr>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 <td>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 <div align="center">
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
73 <h1><font color="#808db5">Perl6の内部表現</font></h1>
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 </td>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 </tr>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 <tr>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 <td>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 <div align="left">
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
80 Takahiro Shimizu
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
81
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:100%;height:0.2em;">
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 </td>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 </tr>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 </table>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
89
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
91 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
92
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
93 <!-- _S9SLIDE_ -->
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
94 <h2 id="このセッションの内容">このセッションの内容</h2>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
95
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
96 <ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
97 <li>Perl6の主要な実装であるRakudoの内部構造を探ります</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
98 <li>Rakudoの内部で利用されているVMや, Perl6のサブセットなどについて探索します</li>
3
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
99 <li>スクリプト言語で主に使われているバイトコードインタプリタの気持ちになります</li>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
100 </ul>
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
102
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
103
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
104 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
105
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
106 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
107 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
108 <h2 id="内容">内容</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
109 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
110 <li>Perl6とは?</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
111 <li>スクリプト言語処理系の動き</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
112 <li>Perl6の内部構造
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
113 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
114 <li>NQP</li>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
115 <li>MoarVM
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
116 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
117 <li>NQPとMoarVMのバイトコード対応</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
118 <li>バイトコードインタプリタのC言語実装</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
119 <li>MoarVMの詳細</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
120 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
121 </li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
122 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
123 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
124 <li>MoarVMのバイトコード実行</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
125 <li>まとめ</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
126 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
127
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
128
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
129
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
130 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
131
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
132 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
133 <!-- _S9SLIDE_ -->
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
134 <h2 id="perl6とは">Perl6とは</h2>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
136 <li>当初Perl5の時期バージョンとして開発されていたプログラミング言語
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
137 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
138 <li>現在は別の言語として開発がそれぞれ進んでいる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
139 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
140 </li>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
141 <li>仕様と実装が分離しており, 現在はテストが仕様となっている</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
142 <li>実装は歴史上複数存在しているが,主流な実装はRakudo</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
143 <li>言語的にはスクリプト言語であり, 漸進的型付き言語</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
144 <li>動作環境は、独自のVMのMoarVM, JVM、一部JavaScript上で動作する</li>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
145 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
146
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
147 <p><img src="fig/2000px-Camelia.svg.png" alt="" style="width: 31%; height: auto;" /></p>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
148
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
149
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
150
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
153 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
154 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
155 <h2 id="現在のperl6">現在のPerl6</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
156
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
157 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
158 <li>現在のバージョンは <code>6.d</code></li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
159 <li><a href="https://perl6.github.io/6pad/">ブラウザ上で実行可能な環境</a>が存在する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
160 <li><a href="https://commaide.com/">IDE</a>が開発されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
161 <li>WebApplicationFrameworkなども開発されており、 Perl5のモジュールを移行したものがいくつか存在する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
162 <li>日本では趣味のプロダクト以外社会では使用されていない
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
163 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
164 <li>海外では実際に使われているケースも存在する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
165 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
166 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
167 <li>処理速度では一部Perl5に勝っているが、それでも大分遅い</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
168 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
169
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
170
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
171
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
172 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
173
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
174 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
175 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
176 <h2 id="参考perl5のソースコード">[参考]Perl5のソースコード</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
177
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
178 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
179 <li>Perl5時代
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
180 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
181 <li>スカラ、配列、ハッシュの3種類</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
182 <li>それぞれの変数への参照であるリファレンスが使用可能</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
183 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
184 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
185 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
186
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
187 <pre><code class="language-perl">use ustrict;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
188 use warnings;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
189
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
190 my $scalar_value = "hello!";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
191 print "$scalar_value\n";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
192
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
193 my @array = (1..10);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
194 print "$array[0]\n";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
195
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
196 my %hash = ( this_is_key =&gt; "this_is_value");
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
197 print "$hash{this_is_key}\n";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
198
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
199 my $hash_ref = \%hash;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
200 print "$hash_ref-&gt;{this_is_key}\n";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
201 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
202
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
203
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
204
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
205 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
206
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
207 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
208 <!-- _S9SLIDE_ -->
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
209 <h2 id="perl6のソースコード概要">Perl6のソースコード概要</h2>
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
212 <li>Perl5の文法とは比較的変更が多い
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
213 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
214 <li>雰囲気は似ている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
215 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
216 </li>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
217 <li>変数がオブジェクトと化した事により, 変数からsayメソッドを呼ぶことが可能</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
218 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
219
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
220 <pre><code>my $str_value = 'hello world!';
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
221 $str_value.say; # hello world!
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
222 </code></pre>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
223
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
224 <ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
225 <li>Perl5と同様に,変数にはデフォルトでは型がないような振る舞いをする</li>
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 </ul>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
228 <pre><code>my $sample_value = 'hello world!';
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
229 $sample_value.say; # hello world!
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
231 $sample_value = '31';
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
232 $sample_value.say; # 31
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
233
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
234 say($sample_value * 3);
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
235 </code></pre>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
236
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
237
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
238
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
239 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
240
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
241 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
242 <!-- _S9SLIDE_ -->
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
243 <h2 id="perl6の言語的な特徴">Perl6の言語的な特徴</h2>
1
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
244
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
245 <ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
246 <li>漸進的型付き言語である為, 型を強制することも可能となる</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
247 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
248
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
249 <pre><code>my Int $int_value = 31;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
250 $int_value = "hello"; # Compile error!
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
251 </code></pre>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
252
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
253 <pre><code>$ perl6 type_invalid.p6
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
254 Type check failed in assignment to $int_value; expected Int but got Str ("hello")
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
255 in block &lt;unit&gt; at type_invalid.p6 line 4
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
256 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
257
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
258
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
259
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
260 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
261
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
262 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
263 <!-- _S9SLIDE_ -->
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
264 <h2 id="perl6の言語的な特徴-1">Perl6の言語的な特徴</h2>
4
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
265
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
266 <ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
267 <li>型を独自に定義することも可能</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
268 <li>入力の型によって実行する関数を変える事などができる</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
269 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
270
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
271 <pre><code class="language-perl6">my subset Fizz of Int where * %% 3;
4
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
272 my subset Buzz of Int where * %% 5;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
273 my subset FizzBuzz of Int where Fizz&amp;Buzz;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
274 my subset Number of Int where none Fizz|Buzz;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
275
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
276 proto sub fizzbuzz ($) { * }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
277 multi sub fizzbuzz (FizzBuzz) { "FuzzBuzz" }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
278 multi sub fizzbuzz (Fizz) { "Fizz" }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
279 multi sub fizzbuzz (Buzz) { "Buzz" }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
280 multi sub fizzbuzz (Number $number) { $number }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
281
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
282 fizzbuzz($_).say for 1..15;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
283 </code></pre>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
284
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
285 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
286 <li>型を利用したFizzBuzz</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
287 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
288
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
289
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
290
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
291 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
292
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
293 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
294 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
295 <h2 id="スクリプト言語">スクリプト言語</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
296 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
297 <li>Perl6は現状コンパイルすることはできない
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
298 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
299 <li>スクリプト言語の分類</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
300 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
301 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
302 <li>現在広く使われているスクリプト言語(Perl,Python,Ruby…)などとPerl6の構成は類似している</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
303 <li>今回はPerl6の実装を追いながら、最近のスクリプト言語処理系の大まかな実装を理解する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
304 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
305
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
306
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
307
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
308 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
309
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
310 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
311 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
312 <h2 id="スクリプト言語処理系">スクリプト言語処理系</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
313 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
314 <li>スクリプト言語は入力として与えられたソースコードを、 直接評価せずにバイトコードにコンパイルする形式が主流となっている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
315 <li>その為スクリプト言語の実装は大きく2つで構成されている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
316 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
317 <li>バイトコードに変換するフロントエンド部分</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
318 <li>バイトコードを解釈する仮想機械</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
319 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
320 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
321 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
322
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
323 <p><img src="fig/bytecode_sample_generally_lang.svg" width="80%" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
324
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
325
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
326
4
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
327 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
328
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
329 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
330 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
331 <h2 id="perl6以外のスクリプト言語">Perl6以外のスクリプト言語</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
332
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
333 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
334 <li>現在使われているプロセスVMは言語に組み込まれているものが多い</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
335 <li>JVMやElixirなどのVMは複数の言語で使用されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
336 <li>Java
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
337 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
338 <li>JVM</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
339 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
340 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
341 <li>Ruby
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
342 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
343 <li>YARV</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
344 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
345 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
346 <li>Python
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
347 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
348 <li>PythonVM</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
349 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
350 </li>
12
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
351 <li>Erlang</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
352 <li>Elixir
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
353 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
354 <li>BEAM</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
355 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
356 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
357 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
358
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
359
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
360
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
361 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
362
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
363 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
364 <!-- _S9SLIDE_ -->
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
365 <h2 id="perl6の処理系の構成">Perl6の処理系の構成</h2>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
366
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
367 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
368 <li>Perl6の処理系で現在主流なものはRakudoと呼ばれる実装である(歴史上複数存在する)</li>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
369 <li>Rakudoは3つのレイヤーから構成されている
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
370 <ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
371 <li>Perl6インタプリタ</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
372 <li>Perl6インタプリタを記述するPerl6のサブセットNQP</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
373 <li>Perl6のバイトコードを解釈するMoarVM</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
374 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
375 </li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
376 <li>Perl6/NQPがフロントエンドに相当し、MoarVMがバックエンドに相当する</li>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
377 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
378
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
379
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
380
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
381 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
382
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
383 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
384 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
385 <h2 id="rakudoの構成図">Rakudoの構成図</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
386
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
387 <p><img src="fig/Rakudo_System_overview.png" alt="" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
388
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
389 <p>(http://brrt-to-the-future.blogspot.com/2015/03/advancing-jit-compiler.html)</p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
390
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
391
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
392
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
393 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
394
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
395 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
396 <!-- _S9SLIDE_ -->
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
397 <h2 id="perl6とnqp">Perl6とNQP</h2>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
398
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
399 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
400 <li>NQP(NotQuitPerl Perl)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
401 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
402 <li>Perl6のサブセット。Perl6っぽい言語</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
403 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
404 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
405 <li>Perl6、 NQP自体がNQPで記述されている</li>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
406 <li>NQPもNQPで記述されている為、 セルフビルド(自分自身で自分自身をコンパイルする)を行う</li>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
407 <li>NQPはPerl6の文法をベースにしているが、 制約がいくつか存在する</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
408 <li>元々はPerl6の主力実装がParrotだった時代に登場
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
409 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
410 <li>文法がアップデートされており、当時の資料は古くなっている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
411 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
412 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
413 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
414
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
415 <pre><code>my $value := "hello!";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
416 say($value);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
417 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
418
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
419
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
420
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
421 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
422
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
423 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
424 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
425 <h2 id="nqpスクリプト">NQPスクリプト</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
426
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
427 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
428 <li>変数は束縛 <code>:=</code> を使う</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
429 <li>関数の間に空白を入れてはいけない</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
430 <li>再帰呼び出しを使うフィボナッチ数列</li>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
431 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
432
4
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
433 <pre><code>#! nqp
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
434 sub fib($n) {
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
435 $n &lt; 2 ?? $n !! fib($n-1) + fib($n - 2);
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
436 }
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
437
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
438 my $N := 29;
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
439
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
440 my $z := fib($N);
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
441
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
442 nqp::say("fib($N) = " ~ fib($N));
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
443 </code></pre>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
444
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
445
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
446
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
447 </div>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
448
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
449 <div class='slide'>
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
450 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
451 <h2 id="nqpスクリプトnまでの整数の和">NQPスクリプト(nまでの整数の和)</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
452
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
453 <pre><code class="language-perl6">sub add_test($n){
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
454 my $sum := 0;
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
455 while ( $n &gt; 1) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
456 $sum := $sum + $n;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
457 --$n;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
458 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
459 return $sum;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
460 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
461
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
462 say(add_test(10000));
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
463 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
464
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
465
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
466
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
467 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
468
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
469 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
470 <!-- _S9SLIDE_ -->
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
471 <h2 id="nqp">NQP</h2>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
472
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
473 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
474 <li>NQPはPerl6の中で一番レイヤーが低い言語</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
475 <li>その為、 実行するVMのオペコード(処理単位)を使用することができる</li>
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
476 <li>NQPオペコードは、 Perl6の内部の抽象構文木でも使用されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
477 <li>また、 Perl6と同様に型を指定することが可能</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
478 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
479
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
480 <pre><code class="language-perl6">sub add_test(int $n){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
481 mu $sum := 0;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
482 while nqp::isgt_i($n,1) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
483 $sum := nqp::add_i($sum,$n);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
484 $n := nqp::sub_i($n,1);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
485 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
486 return $sum;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
487 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
488 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
489
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
490
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
491
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
492 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
493
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
494 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
495 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
496 <h2 id="nqpとmoarvm">NQPとMoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
497 <ul>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
498 <li>NQPは実行する際にMoarVM/JVMが必要となる
5
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
499 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
500 <li>NQPコンパイラが各VMに対応したバイトコードに変換する</li>
3
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
501 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
502 </li>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
503 <li>MoarVMの場合は、MoarVMのバイナリ moar に、 NQPのインタプリタのバイトコードをライブラリや入力として与える</li>
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
504 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
505
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
506
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
507
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
508 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
509
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
510 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
511 <!-- _S9SLIDE_ -->
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
512 <h2 id="perl6のvm">Perl6のVM</h2>
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
513 <ul>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
514 <li>MoarVM, JVM , JavaScriptが選択可能
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
515 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
516 <li>メインで開発されているのはMoarVMであり、 他のVMは機能が実装されていないものが存在する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
517 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
518 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
519 <li><code>rakudo-star</code> というPerl6のパッケージ環境では、 MoarVMがデフォルトでインストールされる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
520 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
521
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
522
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
523
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
524 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
525
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
526 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
527 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
528 <h2 id="moarvm">MoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
529 <ul>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
530 <li>Metamodel On A Runtime</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
531 <li>C言語で記述されているPerl6専用の仮想機械</li>
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
532 <li>レジスタマシン
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
533 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
534 <li>型情報を持つレジスタに対しての演算として処理される</li>
9
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
535 <li>Rubyなどはスタックマシンとして実装されている</li>
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
536 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
537 </li>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
538 <li>Unicodeのサポートや、LuaJITなどを利用したJITコンパイルなども可能</li>
7
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
539 <li>Perl6やNQPは、MoarVMに対してライブラリなどを設定して起動する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
540 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
541
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
542
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
543
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
544 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
545
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
546 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
547 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
548 <h2 id="バイトコード">バイトコード</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
549 <ul>
3
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
550 <li>Perl6も、Rakudo/NQPはバイトコードに変換され、 バイトコードをVMが実行する</li>
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
551 <li>Perl6/NQPはバイトコードにコンパイルすることが可能
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
552 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
553 <li>直接実行することはできない</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
554 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
555 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
556 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
557
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
558 <pre><code>$nqp --target=mbc --output=fib.moarvm fib.nqp
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
559 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
560
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
561
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
562
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
563 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
564
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
565 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
566 <!-- _S9SLIDE_ -->
12
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
567 <h2 id="バイトコード-1">バイトコード</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
568 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
569 <li>バイナリ形式で表現される為、 VMがどのように読み取るかでバイトコードの意味が異なる</li>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
570 <li>スクリプト言語系のVMは、 VMという名前の通り、 計算機をエミュレートしている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
571 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
572 <li>その為、通常のCPUのストア命令などに相当する命令が実装されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
573 <li>スクリプト言語は、その命令の実行を繰り返すことでプログラムを評価する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
574 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
575 </li>
12
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
576 <li>スクリプト言語で重要なバイトコード表現は、「仮想機械がどの命令を実行するか」のバイトコード
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
577 <ul>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
578 <li>CPUに対するアセンブラの数値に対応する</li>
12
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
579 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
580 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
581 <li>どういった構成なのかは仮想機械によって異なる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
582 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
583
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
584
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
585
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
586 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
587
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
588 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
589 <!-- _S9SLIDE_ -->
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
590 <h2 id="バイトコードとmoarvm">バイトコードとMoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
591
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
592 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
593 <li>MoarVMバイトコードはMoarVMの実行バイナリ <code>moar</code> でディスアセンブルすることが可能</li>
2
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
594 </ul>
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
595
10
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
596 <pre><code> annotation: add_test.nqp:1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
597 00003 const_i64_16 loc_2_int, 0
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
598 00004 hllboxtype_i loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
599 00005 box_i loc_3_obj, loc_2_int, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
600 00006 set loc_1_obj, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
601 label_1:
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
602 00007 decont loc_3_obj, loc_0_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
603 00008 smrt_numify loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
604 00009 const_i64_16 loc_2_int, 1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
605 00010 coerce_in loc_5_num, loc_2_int
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
606 00011 gt_n loc_2_int, loc_4_num, loc_5_num
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
607 00012 unless_i loc_2_int, label_2(00031)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
608 00013 osrpoint
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
609 annotation: add_test.nqp:3
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
610 00014 decont loc_3_obj, loc_1_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
611 00015 smrt_numify loc_5_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
612 00016 decont loc_3_obj, loc_0_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
613 00017 smrt_numify loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
614 00018 add_n loc_4_num, loc_5_num, loc_4_num
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
615 00019 hllboxtype_n loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
616 00020 box_n loc_3_obj, loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
617 00021 set loc_1_obj, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
618 00022 decont loc_3_obj, loc_0_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
619 00023 smrt_numify loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
620 00024 coerce_ni loc_6_int, loc_4_num
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
621 00025 const_i64_16 loc_7_int, 1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
622 00026 sub_i loc_7_int, loc_6_int, loc_7_int
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
623 00027 hllboxtype_i loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
624 00028 box_i loc_3_obj, loc_7_int, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
625 00029 set loc_0_obj, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
626 00030 goto label_1(00007)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
627 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
628
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
629
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
630
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
631 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
632
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
633 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
634 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
635 <h2 id="nqpとバイトコードの対応">NQPとバイトコードの対応</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
636
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
637 <pre><code>say(add_test(10000));
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
638 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
639
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
640 <pre><code> annotation: add_test.nqp:1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
641 label_1:
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
642 00020 getlex_no loc_7_obj, '&amp;say'
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
643 00021 decont loc_7_obj, loc_7_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
644 00022 const_s loc_3_str, '&amp;add_test'
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
645 00023 getlexstatic_o loc_8_obj, loc_3_str
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
646 00024 decont loc_8_obj, loc_8_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
647 00025 const_i64_16 loc_5_int, 10000
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
648 00026 prepargs Callsite_1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
649 00027 arg_i 0, loc_5_int
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
650 00028 invoke_o loc_8_obj, loc_8_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
651 00029 prepargs Callsite_0
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
652 00030 arg_o 0, loc_8_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
653 00031 invoke_v loc_7_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
654 00032 null loc_7_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
655 00033 return_o loc_7_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
656 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
657
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
658 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
659 <li>Perl6の変数は直接実態を参照せず、中身が入っているコンテナを参照するようになっている。</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
660 <li>その為 <code>decont</code> 命令で、コンテナの中身をレジスタに設定する必要がある</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
661 <li><code>const_i64_16</code> などは64bitの数という意味で、 <code>int</code> 型としてレジスタに登録している</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
662 <li><code>prepargs</code> で引数の確認を行い, <code>invoke_o</code> で実際にサブルーチンに移行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
663 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
664
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
665
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
666
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
667 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
668
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
669 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
670 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
671 <h2 id="nqpとバイトコードの対応-1">NQPとバイトコードの対応</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
672
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
673 <pre><code>my $sum := 0;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
674 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
675
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
676 <pre><code> annotation: add_test.nqp:1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
677 00003 const_i64_16 loc_2_int, 0
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
678 00004 hllboxtype_i loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
679 00005 box_i loc_3_obj, loc_2_int, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
680 00006 set loc_1_obj, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
681 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
682
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
683 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
684 <li>まず <code>loc_2</code> レジスタをint型の整数0で初期化する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
685 <li>変数 <code>$sum</code> はint型の指定がないので、 obj型で登録しなければならない</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
686 <li>その為, 整数として登録された <code>loc_2</code> から、 obj型に一旦キャストし、 <code>loc_3</code> レジスタに設定したものを、 <code>loc_1</code> レジスタに設定する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
687 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
688
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
689
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
690
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
691 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
692
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
693 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
694 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
695 <h2 id="nqpとバイトコードの対応-2">NQPとバイトコードの対応</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
696
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
697 <pre><code> while ( $n &gt; 1) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
698 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
699
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
700 <pre><code> label_1:
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
701 00007 decont loc_3_obj, loc_0_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
702 00008 smrt_numify loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
703 00009 const_i64_16 loc_2_int, 1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
704 00010 coerce_in loc_5_num, loc_2_int
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
705 00011 gt_n loc_2_int, loc_4_num, loc_5_num
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
706 00012 unless_i loc_2_int, label_2(00031)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
707 00013 osrpoint
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
708 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
709
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
710 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
711 <li>比較にもint型の指定がない為、 <code>num</code> 型にキャストし、 <code>num</code> 型のレジスタでの大小を比較する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
712 <li>比較命令は <code>gt_n</code> であり、 結果により <code>unless_i</code> 命令で、別のラベルにジャンプする</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 9
diff changeset
713 </ul>
6
f8f9af788fa7 remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
714
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
715
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
716
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
717 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
718
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
719 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
720 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
721 <h2 id="decode命令">decode命令</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
722
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
723 <pre><code> while ( $n &gt; 1) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
724 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
725
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
726 <pre><code>00007 decont loc_3_obj, loc_0_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
727 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
728
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
729 <p><img src="fig/decont_perl6_loc3.svg" alt="" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
730
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
731 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
732 <li>変数 <code>$n</code> と 整数 <code>1</code> を大小比較する為、 まず <code>$n</code> から値を取り出す</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
733 <li>とりだした時点では、何の型で使うかは決定していない為、 obj型として判定する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
734 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
735
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
736
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
737
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
738 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
739
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
740 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
741 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
742 <h2 id="smrt_nomify">smrt_nomify</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
743
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
744 <pre><code> while ( $n &gt; 1) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
745 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
746
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
747 <pre><code>00008 smrt_numify loc_4_num, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
748 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
749
17
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
750 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
751 <li><code>smrt_numify</code> はレジスタ上のオブジェクトを、 num型に変換し、 別のレジスタに登録する命令</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
752 <li>今回の整数の比較では、 int型の強制がない為、 数値として比較するためにnum型にキャストしている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
753 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
754
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
755 <p><img src="fig/perl6_num_convert.svg" alt="" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
756
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
757
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
758
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
759 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
760
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
761 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
762 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
763 <h2 id="moarvmのバイトコードインタプリタ部分">MoarVMのバイトコードインタプリタ部分</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
764 <p>MoarVMなどの言語処理系のバイトコードインタプリタは次のことを繰り返している</p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
765 <ol>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
766 <li>入力されたバイトコード列から命令に対応する部分を読み取る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
767 <li>読み込んだ数値から、 対応する命令を取得する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
768 <li>命令部分を実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
769 <li>バイトコード列を次に進め、繰り返す</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
770 </ol>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
771
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
772 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
773 <li>この部分の実装は大体次のような処理をしている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
774 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
775
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
776
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
777
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
778 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
779
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
780 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
781 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
782 <h2 id="巨大なswitch文を使うケース">巨大なswitch文を使うケース</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
783
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
784 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
785 <li>命令に対応するバイトコードを数値に変換できるようにし、 switch-case文で分岐させる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
786 <li>実行のたびにループで先頭に戻り、次の命令を計算する必要があるので低速</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
787 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
788
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
789 <pre><code>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
790 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
791
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
792
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
793
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
794 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
795
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
796 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
797 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
798 <h2 id="cコンパイラのラベルgotoを使うケース">Cコンパイラのラベルgotoを使うケース</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
799
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
800 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
801 <li>巨大なcase文とループではなく、 次の命令の実行場所に直接jmpで移動する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
802 <li>次の命令に対応するラベルを取得する必要があるが、 ループする必要がなく高速</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
803 <li>ラベルgotoであり、 Cコンパイラの拡張機能として搭載されている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
804 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
805 <li>gccおよびLLVM/clangには実装されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
806 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
807 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
808 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
809
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
810 <pre><code>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
811 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
812
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
813
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
814
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
815 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
816
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
817 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
818 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
819 <h2 id="moarvmでは">MoarVMでは</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
820 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
821 <li>ラベルgotoが利用できる場合は利用する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
822 <li>使えないコンパイラの場合は、 switch文を利用する
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
823 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
824 <li>この判断はマクロで処理をしている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
825 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
826 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
827 <li>一般的にはラベルgotoの方が高速である為、他のスクリプト言語でもラベルgotoが使われている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
828 </ul>
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
829
0
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
830 </div>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
831
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
832
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833 </div><!-- presentation -->
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
834 </body>
19155754a586 create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
835 </html>