[BACK]Return to formal-expression.tex CVS log [TXT][DIR] Up to [local] / OpenXM / doc / OpenXM-specs

Annotation of OpenXM/doc/OpenXM-specs/formal-expression.tex, Revision 1.1

1.1     ! noro        1: %% $OpenXM$
        !             2: //&jp \section{ CMO の形式的表現方法 }
        !             3: //&eg \section{ A formal expression of CMO }
        !             4:
        !             5: /*&jp
        !             6: 前の節で CMO の表現方法を形式的に定義せず,
        !             7: CMO のBasic0 の表現法を説明したが,
        !             8: ここでは, CMO の Lisp 風表現 (Lisp-like expression)
        !             9: である
        !            10: CMOexpression
        !            11: および前節で説明した CMO の標準 encoding 法をもう一度説明する.
        !            12: % (タグの省略記法がほしい.)
        !            13: */
        !            14: /*&eg
        !            15: In the previous setion, we have explained the format of CMO's in the
        !            16: Basic0 group.
        !            17: In this section, we will introduce CMOexpression which is like the
        !            18: bracket expression of Lisp.
        !            19: We again explain a standard encoding method of CMO,
        !            20: which we have already explained in the previous section.
        !            21: */
        !            22:
        !            23: /*&jp
        !            24:
        !            25: まず, CMOexpression を形式的に 拡張 BNF 記法を用いて定義しよう.
        !            26: タイプライタフォントでかかれた記号は終端記号を意味する.
        !            27: ``:'' は定義を意味する. ``$|$'' は''または''を意味する.
        !            28: \{ X \} は X の 0 回以上の繰り返しを表す.
        !            29: [ x ] は X が 0 回または 1 回出現することを表す.
        !            30: この記法を用いると CMOexpression は次のように定義できる.
        !            31:
        !            32: */
        !            33: /*&eg
        !            34:
        !            35: Let us define CMOexpression by the extended BNF expression.
        !            36: Symbols in the type writer fonts mean terminals.
        !            37: ``:'' means a definition.
        !            38: ``$|$'' means ''or''.
        !            39: \{ X \} is a repetition of X of more than or equal to 0 times.
        !            40: [ x ] stands for X or nothing.
        !            41: By using this notation, CMOexpression is defined as follows.
        !            42:
        !            43: */
        !            44:
        !            45: /*&C
        !            46: \begin{eqnarray*}
        !            47: \mbox{CMOexpression}
        !            48: &:& \quad
        !            49: \mbox{\tt (} \mbox{\tt cmo\_tag} \
        !            50: \{ \mbox{ expression} \} \mbox{\tt )}\\
        !            51: \mbox{expression}
        !            52: &:& \quad  \mbox{CMOexpression} \\
        !            53: &   &|\   \mbox{\tt int32}  \\
        !            54: &   &|\   \mbox{\tt string} \\
        !            55: &   &|\   \mbox{\tt byte} \\
        !            56: \end{eqnarray*}
        !            57: */
        !            58: /*&jp
        !            59: 終端記号 {\tt int32} は, 32 bit integer を表す, 10 進または 16 進の数字の
        !            60: 列である.
        !            61: 終端記号 {\tt string} は''文字''の列である.
        !            62: 終端記号 {\tt byte} は 8 bit データを表す, 10 進または 16 進の数字の列である.
        !            63:
        !            64: */
        !            65: /*&jp
        !            66: Terminal {\tt int32} is signed 32 bit integer.
        !            67: Terminal {\tt string} is a byte array which usually expresses a string.
        !            68: Terminal {\tt byte} is 8 bit data.
        !            69:
        !            70: */
        !            71:
        !            72: /*&jp
        !            73: CMOexpression にあらわれる各要素を区切るために {\tt ,} (コンマ) を用いてもよい.
        !            74: {\tt cmo\_tag} は {\tt CMO\_} で始まる定数である.
        !            75: CMOexpression で表現される object を CMObject と呼ぶ.
        !            76:
        !            77: */
        !            78: /*&eg
        !            79: The comma ({\tt ,}) may be used to separate each element in CMOexpressions.
        !            80: {\tt cmo\_tag} is a constant that starts with {\tt CMO\_}.
        !            81:
        !            82: */
        !            83:
        !            84: /*&jp
        !            85: この表記法 CMOexpression を利用して, CMO Basic0 の object を記述
        !            86: してみよう.
        !            87: Object 自体の構造を説明するため,
        !            88: BNF をもうすこし拡張して, 非終端記号, 終端記号名のみならず, 変数の
        !            89: 名前も書くことにする. こうすることにより, object の意味の説明も容易になる
        !            90: からである. また ``---'' でコメントのはじまりを表すものとする.
        !            91: */
        !            92: /*&eg
        !            93: Let us describe CMO's in the Basic0 group.
        !            94: In order to explain the meaning of objects,
        !            95: we may also put variable names to CMOexpressions.
        !            96: The start of comments are denoted by ``---''.
        !            97: */
        !            98: /*&jp
        !            99: たとえば, (CMObject の) 32 bit integer である integer32 を
        !           100: BNFで定義すれば,
        !           101: \begin{center}
        !           102: Integer32 \  : \ ({\tt CMO\_INT32}, {\tt int32})
        !           103: \end{center}
        !           104: と書くのが本来の書き方による記法であるが, ここでは,
        !           105: \begin{eqnarray*}
        !           106: \mbox{Integer32} \  &:& \ ({\tt CMO\_INT32}, {\sl int32}\  n) \\
        !           107: & & \  \mbox{--- 32 bit integer $n$ を表す. } \\
        !           108: \end{eqnarray*}
        !           109: と書くことを許すことにする.
        !           110: このように書くことにより, 非終端記号  Integer32 は,
        !           111: \begin{center}
        !           112: Integer32 \  : \ ({\tt CMO\_INT32}, {\tt int32})
        !           113: \end{center}
        !           114: のように, 終端記号 {\tt CMO\_INT32} と {\tt int32} を成分にもち,
        !           115: CMObject の
        !           116: ({\tt CMO\_INT32}, {\sl int32}\ n)
        !           117: は,
        !           118: 32 bit integer $n$ を表現しているんだということが, 1 行でわかる.
        !           119: */
        !           120: /*&eg
        !           121: (This part has not yet been translated.)
        !           122: */
        !           123: /*&jp
        !           124: この記法を用いて, 前節で導入した, Basic0 の CMObject を
        !           125: 形式的に定義しよう.
        !           126: */
        !           127: /*&eg
        !           128: By using this notation, let us define formally CMObjects in the group
        !           129: Basic0.
        !           130: */
        !           131:
        !           132: /*&C
        !           133:
        !           134: \bigbreak
        !           135: \noindent
        !           136: Group CMObject/Basic0  requires nothing. \\
        !           137: Error2, Null, Integer32, Datum, Cstring, Mathcap, List $\in$ CMObject/Basic0. \\
        !           138: Document of CMObject/Basic0 is at {\tt http://www.math.kobe-u.ac.jp/OpenXM}
        !           139: (in English and Japanese) \\
        !           140: \begin{eqnarray*}
        !           141: \mbox{Error2}&:& ({\tt CMO\_ERROR2}, {\sl CMObject}\, \mbox{ob}) \\
        !           142: \mbox{Null}  &:& ({\tt CMO\_NULL}) \\
        !           143: \mbox{Integer32}
        !           144: &:& ({\tt CMO\_INT32}, {\sl int32}\ \mbox{n}) \\
        !           145: \mbox{Datum} &:& ({\tt CMO\_DATUM}, {\sl int32}\, \mbox{n}, {\sl byte}\,
        !           146: \mbox{data[0]},
        !           147: \ldots , {\sl byte}\, \mbox{data[n-1]}) \\
        !           148: \mbox{Cstring}&:& ({\tt CMO\_STRING},{\sl int32}\,  \mbox{ n},
        !           149: {\sl string}\, \mbox{s}) \\
        !           150: \mbox{Mathcap}&:& ({\tt CMO\_MATHCAP},{\sl CMObject}\,  \mbox{ob} ) \\
        !           151: \mbox{List} &:&
        !           152: \mbox{({\tt CMO\_LIST}, {\sl int32}\, m, {\sl CMObject}\, ob[0], $\ldots$,
        !           153: {\sl CMObject}\, ob[m-1])} \\
        !           154: & & \mbox{---  m is the length of the list.}
        !           155: \end{eqnarray*}
        !           156:
        !           157: */
        !           158:
        !           159:
        !           160: //&jp Cstring で, {\sl string} s の部分を {\tt byte} に分解すれば,
        !           161: //&eg In the definition of ``Cstring'', if we decompose  ``{\sl string} s'' into bytes, then  ``Cstring'' should be defined as
        !           162: /*&C
        !           163: \begin{eqnarray*}
        !           164: \mbox{Cstring}&:& ({\tt CMO\_STRING},{\sl int32}\,  \mbox{ n},
        !           165: {\sl byte}\, \mbox{s[0]},
        !           166: \ldots, {\sl byte}\ \mbox{s[n-1]})
        !           167: \end{eqnarray*}
        !           168: */
        !           169: //&jp となる.
        !           170: /*&jp
        !           171: また,
        !           172: ``Group CMObject/Basic0  requires nothing''
        !           173: は, 以下は, グループ CMObject/Basic0 の定義であり,
        !           174: このグループの CMObject を定義するのに, 要請される CMObject のグループは
        !           175: ないことを示す.
        !           176: ``Error2, Null, Integer32, Datum, Cstring, Mathcap, List
        !           177: $\in$ CMObject/Basic0''
        !           178: は, グループ CMObject/Basic0 には,  Error2, Null, Integer32,
        !           179: Datum, Cstring なるクラスの object が属することを示す.
        !           180: */
        !           181: /*&eg
        !           182: また,
        !           183: ``Group CMObject/Basic0  requires nothing''
        !           184: means that there is no super group to define CMO's in the group Basic0.
        !           185: ``Error2, Null, Integer32, Datum, Cstring, Mathcap, List
        !           186: $\in$ CMObject/Basic0''
        !           187: means that
        !           188: Error2, Null, Integer32, Datum, Cstring
        !           189: are members of the group CMObject/Basic0.
        !           190: */
        !           191:
        !           192: /*&C
        !           193:
        !           194: */
        !           195:
        !           196: /*&jp
        !           197: では, 実際のデータの表現の例をみてみよう.
        !           198: たとえば, 32 bit integer の 1234 は,
        !           199: */
        !           200: /*&eg
        !           201: Let us see examples.
        !           202: 32 bit integer 1234 is expressed as
        !           203: */
        !           204: /*&C
        !           205: \begin{center}
        !           206: ({\tt CMO\_INT32}, 1234)
        !           207: \end{center}
        !           208: */
        !           209: /*&jp
        !           210: とかく.
        !           211: 文字列 ``Hello''  は
        !           212: */
        !           213: /*&eg
        !           214: The string ``Hello'' is expressed as
        !           215: */
        !           216: /*&C
        !           217: \begin{center}
        !           218: ({\tt CMO\_STRING}, 5, "Hello")
        !           219: \end{center}
        !           220: */
        !           221: //&jp と書く.
        !           222:
        !           223: /*&C
        !           224:
        !           225: */
        !           226: /*&jp
        !           227: CMOexpression と, CMObject の区別を理解しておくのは重要である.
        !           228: たとえば
        !           229: \begin{center}
        !           230: ({\tt CMO\_INT32}, 234, "abc",({\tt CMO\_STRING}))
        !           231: \end{center}
        !           232: は CMOexpression ではあるが, CMObject ではない.
        !           233: これは, 文法的には正しいプログラムだが, なにをやるのかは全く不明な
        !           234: プログラムと似ている.
        !           235:
        !           236: さて, Open math 風 (\cite{openmath})
        !           237: の SGML 表現法も可能であり, その場合は, 上の二つの例は次のように
        !           238: 書く.
        !           239: \begin{verbatim}
        !           240: <CMO_INT32>
        !           241: 1234
        !           242: </CMO_INT32>
        !           243:
        !           244: <CMO_STRING>
        !           245: 5
        !           246: "Hello"
        !           247: </CMO_STRING>
        !           248: \end{verbatim}
        !           249: */
        !           250:
        !           251: /*&C
        !           252:
        !           253: */
        !           254:
        !           255: /*&jp
        !           256: 次に, 標準 encoding 法を説明しよう.
        !           257: 標準 encoding 法では, cmo\_tag を ネットワークバイトオーダーの
        !           258: 32 bit integer {\tt int32} に,
        !           259: その他のフィールドは, 定義に記述されているデータ型に従い,
        !           260: byte データ {\tt byte} かまたは
        !           261: ネットワークバイトオーダーの 32 bit integer {\tt int32} に, 変換する.
        !           262: */
        !           263: /*&eg
        !           264: Let us explain the standard encoding method.
        !           265: All {\tt int32} data are encoded into network byte order 32 bit integers
        !           266: and byte data are encoded as it is.
        !           267: */
        !           268:
        !           269: /*&C
        !           270:
        !           271: */
        !           272:
        !           273: /*&jp
        !           274: 高速の通信方法を用いて
        !           275: 効率を重視する接続の場合には, {\tt int32} を network byte order
        !           276: に変換する操作がおおきなオーバヘッドとなることが
        !           277: 報告されている.
        !           278: 100Mbps の通信路で 12Mbytes の {\tt CMO\_ZZ} の転送では
        !           279: 約 90\% の時間が network byte order への変換についやされているという
        !           280: 実験データもある.
        !           281: 効率を重視した encoding 法については後述する.
        !           282: */
        !           283: /*&eg
        !           284: When we are using a high speed network,
        !           285: the translation from the internal expression of 32 bit integers to
        !           286: network byte order may become a bottle neck.
        !           287: There are experimental data which presents that 90 percents of the transmission
        !           288: time are
        !           289: for the translation to the network byte order to send {\tt CMO\_ZZ} of size
        !           290: 12M bytes on a 100Mbps network.
        !           291: In a later section, we will discuss a protocol to avoid the translation.
        !           292: */
        !           293:
        !           294: /*&C
        !           295:
        !           296: */
        !           297:
        !           298: /*&jp
        !           299: 標準 encoding と CMOexpression の間の変換は容易である.
        !           300: 前節で用いたデータの表記法,
        !           301: たとえば,
        !           302: */
        !           303: /*&eg
        !           304: The translation between the standard encoding and CMOexpression
        !           305: is easy.
        !           306: For example,
        !           307: */
        !           308: /*&C
        !           309: \begin{center}
        !           310: \begin{tabular}{|c|c|}
        !           311: \hline
        !           312: {\tt int32 CMO\_INT32}& {\tt int32 1234}  \\
        !           313: \hline
        !           314: \end{tabular}
        !           315: \end{center}
        !           316: */
        !           317: /*&jp
        !           318: は, CMOexpression
        !           319: */
        !           320: /*&eg
        !           321: is the encoding of the CMOexpression
        !           322: */
        !           323: /*&C
        !           324: \begin{center}
        !           325: ({\tt CMO\_INT32}, 1234)
        !           326: \end{center}
        !           327: */
        !           328: /*&jp
        !           329: の 標準 encoding 法による表現である.
        !           330: */
        !           331:
        !           332:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>