Mercurial > hg > Papers > 2016 > kaito-master
comparison paper/chapter3.tex @ 9:7161b80a7e19
冥 ANOTHER
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 10 Feb 2016 14:12:31 +0900 |
parents | e9a6d390a401 |
children | 3afb4bfe1100 |
comparison
equal
deleted
inserted
replaced
8:e9a6d390a401 | 9:7161b80a7e19 |
---|---|
110 \end{lstlisting} | 110 \end{lstlisting} |
111 | 111 |
112 これらの編集により, LLVM 側でも code segment を認識できるようになった. | 112 これらの編集により, LLVM 側でも code segment を認識できるようになった. |
113 | 113 |
114 \section{軽量継続} | 114 \section{軽量継続} |
115 CbC で軽量継続は goto に code segment 冥を添えることで行う. この新しい goto syntax を追加する. 継続のための goto syntax は, goto の後に関数呼び出しと同じ構文が来る形になる. したがって, goto の構文解析を行う際にこの構文も解析できるように変更を加える必要がある. clang が goto 文の構文解析を行っているのは, Parser クラスの ParseStatementOrDeclarationAfterAttributes 関数であり, この関数は \$(clang)/lib/Parse/ParseStmt.cpp で定義されている. この関数内にも switch 文があり, この中の kw\_goto が来た時の処理に手を加える. 具体的には以下のように変更した. | 115 CbC で軽量継続は goto に code segment 名を添えることで行う. この新しい goto syntax を追加する. 継続のための goto syntax は, goto の後に関数呼び出しと同じ構文が来る形になる. したがって, goto の構文解析を行う際にこの構文も解析できるように変更を加える必要がある. clang が goto 文の構文解析を行っているのは, Parser クラスの ParseStatementOrDeclarationAfterAttributes 関数であり, この関数は \$(clang)/lib/Parse/ParseStmt.cpp で定義されている. この関数内にも switch 文があり, この中の kw\_goto が来た時の処理に手を加える. 具体的には以下のように変更した. |
116 | 116 |
117 | 117 |
118 \begin{lstlisting}[frame=lrbt,label=ParseStmt,caption={goto 文の構文解析}] | 118 \begin{lstlisting}[frame=lrbt,label=ParseStmt,caption={goto 文の構文解析}] |
119 : | 119 : |
120 case tok::kw_goto: // C99 6.8.6.1: goto-statement | 120 case tok::kw_goto: // C99 6.8.6.1: goto-statement |