Open main menu

Difference between revisions of "SCI/Specifications/SCI in action/Parser"

→‎The Parse tree: more tweaks and corrections
(→‎The Parse tree: Some rephrasing)
(→‎The Parse tree: more tweaks and corrections)
Line 160: Line 160:
* <i>&omega;<sub>j</sub> &isin; W</i>, with <i>W</i> being the set of all words;
* <i>&omega;<sub>j</sub> &isin; W</i>, with <i>W</i> being the set of all words;
* <i>&gamma;<sub>j</sub> &isin; &Gamma;</i>, with <i>&Gamma;</i> being the set of all word groups;
* <i>&gamma;<sub>j</sub> &isin; &Gamma;</i>, with <i>&Gamma;</i> being the set of all word groups;
* <i>&mu;<sub>j</sub> &isin; 2<sup>c</sup> </i>, with <i>C</i> being the set of all class masks <nowiki>{0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100}</nowiki>;
* <i>&mu;<sub>j</sub> &isin; 2<sup>C</sup> </i>, with <i>C</i> being the set of all class masks <nowiki>{0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100}</nowiki>, and <i>2<sup>C</sup></i> being the set of all subsets of <i>C</i>;
* <i>&omega;<sub>j</sub> = (&gamma;<sub>j</sub>, &mu;<sub>j</sub>)</i>, with &gamma;<sub>j</sub> being the word group <i>&omega;<sub>j</sub></i> belongs to, and <i>&mu;<sub>j</sub></i> being its class mask
* <i>&omega;<sub>j</sub> = (&gamma;<sub>j</sub>, &mu;<sub>j</sub>)</i>, with <i>&gamma;<sub>j</sub></i> being the word group <i>&omega;<sub>j</sub></i> belongs to, and <i>&mu;<sub>j</sub></i> being its class mask.
<!-- Math formulas
<!-- Math formulas
* <math>\omega_j \in W</math>
* <math>\omega_j \in W</math>
Line 167: Line 167:
*<math>\mu_j \in 2^C</math>
*<math>\mu_j \in 2^C</math>
*<math>\omega_j = (\gamma_j, \mu_j</math> -->
*<math>\omega_j = (\gamma_j, \mu_j</math> -->
Note that elements of <i>2<sup>C</sup></i> (i.e. sets of class masks) can be identified with the ORed value of these class masks. So the set <nowiki>{0x2,0x4,0x80}</nowiki> can be identified with the value 0x86.


For the following sections, we define
For the following sections, we define


* group: <i>W &rarr; &Gamma;  : (&gamma;,&mu;)  &#8614; &gamma;</i>
* group: <i>W &rarr; &Gamma;  : (&gamma;,&mu;)  &#8614; &gamma;</i>
* classes: <i>W &rarr; C : (&gamma;,&mu;) &#8614; &mu;</i>
* classes: <i>W &rarr; 2<sup>C</sup> : (&gamma;,&mu;) &#8614; &mu;</i>
* <i>C<sub>x</sub> = {&omega; &isin; W | x &isin; classes(&omega;)}</i>
* <i>C<sub>x</sub> = {&omega; &isin; W | x &isin; classes(&omega;)}</i>


Line 329: Line 330:
====Example: Parser example====
====Example: Parser example====
Parse is called with <i>"open door"</i>.
Parse is called with <i>"open door"</i>.
* <i>"open" &isin; &lang;842,{C<sub>8</sub>0}&rang;</i> (an imperative word of the word group 0x842)
* <i>"open" &isin; &lang;842,{C<sub>80</sub>}&rang;</i> (an imperative word of the word group 0x842)
* <i>"door" &isin; &lang;917,{C<sub>1</sub>0}&rang; (a substantive of the word group 0x917)</i>
* <i>"door" &isin; &lang;917,{C<sub>10</sub>}&rang; (a substantive of the word group 0x917)</i>
* <i>I = &lang;842,{C<sub>8</sub>0}&rang;,&lang;917,{C<sub>1</sub>0}&rang;</i>
* <i>I = &lang;842,{C<sub>80</sub>}&rang;,&lang;917,{C<sub>10</sub>}&rang;</i>


<i>I</i> is clearly accepted by automatons based on the grammar described above, There are two possible derivations:
<i>I</i> is clearly accepted by automatons based on the grammar described above, There are two possible derivations:
1,079

edits